Skip to content

Instantly share code, notes, and snippets.

@libswan
libswan / M2-PS6-Correct
Created May 12, 2013 09:04
Correct code from Steve_Flynn
# Enter the code for the functions rabbitGrowth, foxGrowth, and runSimulation
# in this box.
def rabbitGrowth():
"""
rabbitGrowth is called once at the beginning of each time step.
It makes use of the global variables: CURRENTRABBITPOP and MAXRABBITPOP.
The global variable CURRENTRABBITPOP is modified by this procedure.
@libswan
libswan / L19 PROBLEM 2
Last active December 17, 2015 12:08
Isn't there a way to programmatically figure out the connections? E.g. Instead of "telling the program" that node[0] connects with node[1], because the position of 'A' in these two nodes is position 0, can't we figure it out programmatically?
nodeNameList = []
for i in nodes:
nodeName = Node.getName(i)
nodeNameList.append(nodeName)
print nodeNameList
for n in nodeNameList[0]:
if nodeNameList[0].index(n) == nodeNameList[1].index(n):
connectionLetter = n
print connectionLetter