Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Maze:
- def __init__(self):
- self.mazeIndex = 0
- self.mazes = []
- self.mazes.append({"tiles":
- [['#','#','#','#','#','#','#','#','#','#','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ','#',' ',' ',' ','#',' ',' ','#'], #Level 1
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#','#','#','#','#','#','#','#','#','#','#']],
- "sprouts":1, "width":11, "height":11})
- self.mazes.append({"tiles":
- [['#','#','#','#','#','#','#','#','#','#','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ','#',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ','#',' ',' ',' ','#'], #Level 2
- ['#',' ',' ',' ','#',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ','#',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#','#','#','#','#','#','#','#','#','#','#']],
- "sprouts":1, "width":11, "height":11})
- self.mazes.append({"tiles":
- [['#','#','#','#','#','#','#','#','#','#','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ','#',' ',' ',' ',' ',' ','#',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'], #Level 3
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ','#',' ',' ',' ',' ',' ','#',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#','#','#','#','#','#','#','#','#','#','#']],
- "sprouts":1, "width":11, "height":11})
- self.mazes.append({"tiles":
- [['#','#','#','#','#','#','#','#','#','#','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ',' ',' ','#',' ','#',' ','#',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ','#',' ',' ',' ','#',' ','#',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#',' ','#',' ','#',' ',' ',' ','#',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'], #Level 4
- ['#',' ','#',' ','#',' ','#',' ',' ',' ','#'],
- ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'],
- ['#','#','#','#','#','#','#','#','#','#','#']],
- "sprouts":1, "width":11, "height":11})
- self.currentMaze = self.mazes[0]
- def eatSprouts(self):
- self.currentMaze["sprouts"] -= 1
- if self.currentMaze["sprouts"] == 0:
- self.mazeIndex += 1
- if self.mazeIndex == len(self.mazes):
- print("You win!")
- else:
- self.currentMaze = self.mazes[self.mazeIndex]
- def toString(self):
- pass
- def placeseeker(self, seeker_char, row, col):
- self.currentMaze["tiles"][row][col] = seeker_char
- def clearAtPos(self, row, col):
- self.currentMaze["tiles"][row][col] = " "
- def getWidth(self):
- return self.currentMaze["width"]
- def getHeight(self):
- return self.currentMaze["height"]
- def getCharAtPos(self, row, col):
- return self.currentMaze["tiles"][row][col]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement