mosquitos now move around :)
This commit is contained in:
parent
68962f71ad
commit
a795535a64
1 changed files with 14 additions and 4 deletions
18
malaria.py
18
malaria.py
|
@ -101,10 +101,22 @@ class Model:
|
||||||
indices = [(i % self.width, j % self.height) for i in range(x_min, x_max + 1)
|
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)]
|
for j in range(y_min, y_max + 1)]
|
||||||
|
|
||||||
|
# remove current location from the indices
|
||||||
|
indices.remove((x, y))
|
||||||
|
|
||||||
return indices
|
return indices
|
||||||
|
|
||||||
def move_mosquitos(self):
|
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):
|
def gen_humans(self):
|
||||||
"""
|
"""
|
||||||
|
@ -203,7 +215,5 @@ class Human(IntEnum):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
model = Model()
|
model = Model()
|
||||||
# model.run()
|
model.run()
|
||||||
|
|
||||||
print(model.get_movementbox(0,0))
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue