My program is to Write a program that will simulate a network of computer that is infected with a virus at various spots.
Based off a list of random numbers 0 (healthy),1 (infected), and 2 (dead) my function needs to display a circle at the given position on the graphics window. Here is the code I have so far for the given function below.
def displaygen(generation, win):
for row in generation:
for col in row:
position = Point(5,5)
if generation[row][col] == '0':
circ = Circle(position,3)
circ.setFill('green')
circ.draw(win)
elif generation[row][col] == '1':
circ = Circle(position,3)
circ.setFill('red')
elif generation[row][col] == '2':
circ = Circle(position,3)
circ.setFill('black')
Aucun commentaire:
Enregistrer un commentaire