From df3d6a2deb35d71c6ab864a6bbbe3a6a3fd96520 Mon Sep 17 00:00:00 2001 From: En Yi Date: Fri, 6 Jul 2018 21:41:31 +0800 Subject: [PATCH] Clean up and add TODOs --- gameplay/sudoku_gameplay.py | 9 +++++++++ graphic_components/board.py | 6 ++++++ graphic_components/sudoku_graphics.py | 13 +++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gameplay/sudoku_gameplay.py b/gameplay/sudoku_gameplay.py index 7647398..40426d4 100644 --- a/gameplay/sudoku_gameplay.py +++ b/gameplay/sudoku_gameplay.py @@ -11,6 +11,7 @@ if __name__ == "__main__": else: test_dir = './gameplay/test_board.txt' + class SudokuSystem: def __init__(self): @@ -117,3 +118,11 @@ class SudokuSystem: for r, c in zip(row, col): self.cell_status[r, c] = EMPTY + + def generate_random_board(self): + # TODO: Write function to generate a random board + pass + + def check_valid_moves(self): + # TODO: Write function to return a possible valid numbers for a cell + pass diff --git a/graphic_components/board.py b/graphic_components/board.py index f9a7ac5..7407c45 100644 --- a/graphic_components/board.py +++ b/graphic_components/board.py @@ -70,3 +70,9 @@ class GameBoard(BoxBoard): val = 0 self.gamegrid.replace_cell_number(int(val)) self.show_number_ring() + + +class MenuBoard(BoxBoard): + # TODO: Create the components for the menu: A timer and a difficulty selector + def __init__(self, width, height, parent=None): + super().__init__(width, height, parent) diff --git a/graphic_components/sudoku_graphics.py b/graphic_components/sudoku_graphics.py index 5526c72..6c0e1b3 100644 --- a/graphic_components/sudoku_graphics.py +++ b/graphic_components/sudoku_graphics.py @@ -11,6 +11,8 @@ import numpy as np class NumberPainter(QGraphicsItem): + # TODO: Use different font to differentiate the status of a cell + def __init__(self, parent, grid): super().__init__(parent=parent) self.parent = parent @@ -48,7 +50,8 @@ class NumberPainter(QGraphicsItem): class SudokuGrid(QGraphicsObject): - # Prepare the signal + # TODO: Add functions to animated the grid lines + buttonClicked = pyqtSignal(float, float) def __init__(self, width, height, parent=None): @@ -64,9 +67,6 @@ class SudokuGrid(QGraphicsObject): self.thick_unit = 5 self.thick_pen.setWidth(self.thick_unit) - self.horiz_gridlines = [] - self.vert_gridlines = [] - self.thinlines = [] self.thicklines = [] @@ -120,6 +120,8 @@ class SudokuGrid(QGraphicsObject): painter.setPen(self.selection_pen) painter.drawRect(self.selection_box) + # TODO: Possibly draw the fixed cell here + def hoverMoveEvent(self, event): box_w = bound_value(0, int(event.pos().x()/self.cell_width), 8) box_h = bound_value(0, int(event.pos().y() / self.cell_height), 8) @@ -139,6 +141,9 @@ class SudokuGrid(QGraphicsObject): class NumberRing(QGraphicsItem): + # TODO: Add functions to animated the ring appearing + # TODO: Adjust the positioning of each element + # TODO: Make it transparent when mouse is out of range def __init__(self, parent=None): super().__init__(parent=parent)