def win(self): self.playerClicks = 0 self.__solution = [] self.hasWon = True if not self.isAdventure: winGUI = OptionGUI("YOU WIN!", "Quit", self.endGame, "Play Again", self.restart) winGUI.draw() while not winGUI.window.isClosed(): try: winGUI.checkClick(winGUI.window.getMouse()) except GraphicsError: # window was closed before user selected an option, assume they want to Quit self.endGame() break
def solve(self): if len(self.__solution) > 0: self.__solution.reverse() for move in self.__solution: self.playTile(*move, isPlayerMove = False, storeSolution = False) self.__solution = [] self.hasWon = True if not self.isAdventure: winGUI = OptionGUI("Solved! Maybe you could solve it next time?", "Quit", self.endGame, "Play Again", self.restart) winGUI.draw() while not winGUI.window.isClosed(): try: winGUI.checkClick(winGUI.window.getMouse()) except GraphicsError: # window was closed before user selected an option, assume they want to Quit self.endGame() break