def randomizePuzzle(self): self.clearPuzzle() solved_puzzle = all_puzzles.get_random_puzzle() self.puzzle_solution = solved_puzzle num_whitespaces = self.get_num_whitespaces() game = self.get_current_game() whitespace_list = self.create_whitespaces(solved_puzzle, {}, num_whitespaces) new_puzzle = self.get_puzzle_list(game) self.generate_game(game, num_whitespaces, new_puzzle) #
def __init__(self, master): """ Create Sudoku application page to select from three difficulties (represented by buttons). """ self.frame = Frame(master) self.currDifficulty = None self.puzzle = [] self.puzzle_solution = all_puzzles.get_random_puzzle() self.game = None master.title("Sudoku") selectDifficulty = Label(root, text="Select a Difficulty:", font=("Play", 20)) easyButton = Button(self.frame, text="EASY", command=self.easyDifficulty, font=("Helvetica", 18)) mediumButton = Button(self.frame, text="MEDIUM", command=self.mediumDifficulty, font=("Helvetica", 18)) hardButton = Button(self.frame, text="HARD", command=self.hardDifficulty, font=("Helvetica", 18)) selectDifficulty.pack(pady=(20, 15)) easyButton.pack() mediumButton.pack(pady=(5, 5)) hardButton.pack() self.frame.pack(padx=(150, 150), pady=(0, 40))
def __init__(self, master): """ Create Sudoku application page to select from three difficulties (represented by buttons). """ self.frame = Frame(master) self.rightFrame = Frame(master) self.currDifficulty = None self.puzzle = [] self.puzzle_solution = all_puzzles.get_random_puzzle() self.game = None master.title("Sudoku") selectDifficulty = Label(self.frame, text="Select a Difficulty") image = Image.open("start_screen.jpeg") photo = ImageTk.PhotoImage(image) label = Label(self.rightFrame, image=photo) label.image = photo easyButton = Button(self.frame, text="EASY", command=self.easyDifficulty, font=("Helvetica", 18)) mediumButton = Button(self.frame, text="MEDIUM", command=self.mediumDifficulty, font=("Helvetica", 18)) hardButton = Button(self.frame, text="HARD", command=self.hardDifficulty, font=("Helvetica", 18)) label.pack() selectDifficulty.pack(pady=(20, 15)) easyButton.pack() mediumButton.pack(pady=(5, 5)) hardButton.pack() self.frame.pack(side=LEFT, padx=(25, 25), pady=(0, 40)) self.rightFrame.pack(side=RIGHT)
def main(): puzzle = puzzles.get_random_puzzle() board_obj = board.Board(puzzle)