Advertisement
Tkap1

Untitled

Jan 17th, 2019
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. mazes = []
  2. maze = None
  3. mazeIndex = 0
  4. def initMazes(self):
  5.     self.mazes.append(# here you create level 1)
  6.     # Set the current maze to level 1
  7.     self.maze = self.mazes[0]
  8.     self.mazes.append(# here you create level 2, and so on)
  9.  
  10. def eatSprouts(self):
  11.     self.maze.sprouts -= 1
  12.     if self.maze.sprouts == 0:
  13.         self.mazeIndex += 1
  14.         # Here we check if mazeIndex is equal to len(mazes), in which case there are no more mazes
  15.         if self.mazeIndex == len(mazes):
  16.             print("You win!")
  17.         # Else, if there are more levels, set the next one as the current maze
  18.         else:
  19.             self.maze = self.mazes[self.mazeIndex]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement