Some cleanup

master
En Yi 2018-07-23 17:45:45 +08:00
parent 7d269b4041
commit 364e124c2c
4 changed files with 7 additions and 8 deletions

View File

@ -118,7 +118,7 @@ def propagate_array(sudoku_array, N):
prev_bigcol = -1
prev_rot = -1
swap_choice = ((0, 1), (0, 2), (1, 2))
print(prop_seq)
#print(prop_seq)
for num in prop_seq:
if num == 0:
rot = random.randint(0, 2)
@ -152,7 +152,7 @@ def propagate_array(sudoku_array, N):
prev_num = num
print('Propagate Complete')
#print('Propagate Complete')
def generate_sudoku_grid(difficulty):
@ -188,10 +188,11 @@ def generate_sudoku_grid(difficulty):
def generate_sudoku_puzzle(difficulty):
grid = generate_sudoku_grid(difficulty)
print('Givens: ', check_for_givens(grid))
print('Difficulty level: ', difficulty, 'Givens: ', check_for_givens(grid))
sudoku_array = grid_to_array(grid)
propagate_array(sudoku_array, 18)
print("Warning: the solution to the puzzle may be non-unique.")
print('Puzzle: ', array_to_grid(sudoku_array))
return sudoku_array

View File

@ -288,6 +288,7 @@ class MenuButton(AnimBox):
"""Reimplemented from QGraphicsObject. Receive the click event,
then reverse its animation and emit buttonClicked signal
"""
event.accept()
self.toggle_anim(False)
self.buttonClicked.emit(self.text)

View File

@ -10,6 +10,7 @@ from PyQt5.QtGui import QPainter, QBrush, QPen
from PyQt5.QtWidgets import (QSizePolicy, QGraphicsWidget, QGraphicsItem,
QGraphicsObject, QGraphicsProxyWidget,
QGraphicsScene, QGraphicsView, )
from general.highscore import DIFFICULTIES
if __name__ == "__main__":
import buttons
@ -19,8 +20,6 @@ else:
from . import scoreboard as scb
DIFFICULTIES = ['Very Easy', 'Easy', 'Normal', 'Hard', 'Insane']
class TimerDisplayer(QGraphicsWidget):
@ -78,7 +77,6 @@ class DifficultyDisplayer(QGraphicsWidget):
def __init__(self, parent=None):
super().__init__(parent=parent)
#self.setParent(parent)
self.width = 100
self.height = 50

View File

@ -226,7 +226,6 @@ class SudokuGrid(BaseSudokuItem):
# self.buttonClicked.emit(0, 0, self.scribbling)
def mouseReleaseEvent(self, event):
print('lol')
if self.drawn:
w = (self.mouse_w + 0.5) * self.cell_width
h = (self.mouse_h + 0.5) * self.cell_height