Had – Logika hry – Řešení [7]

    def add_food(self):
        x = random.randrange(self.width)
        y = random.randrange(self.height)
        position = x, y
        self.food.append(position)