mosquitos now move around :)

This commit is contained in:
Chris Bras 2019-03-07 21:31:21 +01:00
parent 68962f71ad
commit a795535a64

View file

@ -101,10 +101,22 @@ class Model:
indices = [(i % self.width, j % self.height) for i in range(x_min, x_max + 1)
for j in range(y_min, y_max + 1)]
# remove current location from the indices
indices.remove((x, y))
return indices
def move_mosquitos(self):
pass
for mosq in self.mosquitos:
# get the movement box for every mosquito
movement = self.get_movementbox(mosq.x, mosq.y)
# choose random new position
new_pos = random.choice(movement)
mosq.x = new_pos[0]
mosq.y = new_pos[1]
def gen_humans(self):
"""
@ -203,7 +215,5 @@ class Human(IntEnum):
if __name__ == "__main__":
model = Model()
# model.run()
print(model.get_movementbox(0,0))
model.run()