Exemple #1
0
 def hard_game(self):
     self.endboard = generate_sudoku_board.completedSudokuBoard()
     self.difficulty = "hard"
     self.board = generate_sudoku_board.puzzleSudokuBoard(
         self.endboard, self.difficulty)
     self.canvas.delete("victory")
     self.draw_numbers()
Exemple #2
0
        elif self.endboard == self.board:
            self.victory_text()
            return
        elif self.row >= 0 and self.col >= 0 and event.char in "1234567890":
            self.board[self.row][self.col] = int(event.char)
            self.draw_numbers()
            self.draw_highlight()
            if self.endboard == self.board:
                self.victory_text()


#says that the player won

    def victory_text(self):
        x = y = margin + 4 * side + side / 2
        self.canvas.create_text(x,
                                y,
                                text="You win!",
                                tags="victory",
                                fill="coral",
                                font=("Arial", 64))

answerboard = generate_sudoku_board.completedSudokuBoard()
puzzleboard = generate_sudoku_board.puzzleSudokuBoard(answerboard, "easy")

root = Tk()
root.geometry("%dx%d" % (width, height + 40))

sudokuGUI(root, answerboard, puzzleboard)
root.mainloop()