diff --git a/malaria.py b/malaria.py index f5af246..4325827 100644 --- a/malaria.py +++ b/malaria.py @@ -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()