Nauč se Python > Materiály > Snake Workshop for PyLadies > The Snake > Game logic

Game logic – Řešení [5]

In the initialize method, instead of setting self.food to a list with food positions, you can write:

        self.food = []
        self.add_food()
        self.add_food()

Then at the beginning of the game, two random foods will be waiting for the snake.


Toto je stránka lekce z kurzu, který probíhá nebo proběhl naživo s instruktorem.