Some cleanup
parent
7d269b4041
commit
364e124c2c
|
@ -118,7 +118,7 @@ def propagate_array(sudoku_array, N):
|
||||||
prev_bigcol = -1
|
prev_bigcol = -1
|
||||||
prev_rot = -1
|
prev_rot = -1
|
||||||
swap_choice = ((0, 1), (0, 2), (1, 2))
|
swap_choice = ((0, 1), (0, 2), (1, 2))
|
||||||
print(prop_seq)
|
#print(prop_seq)
|
||||||
for num in prop_seq:
|
for num in prop_seq:
|
||||||
if num == 0:
|
if num == 0:
|
||||||
rot = random.randint(0, 2)
|
rot = random.randint(0, 2)
|
||||||
|
@ -152,7 +152,7 @@ def propagate_array(sudoku_array, N):
|
||||||
|
|
||||||
prev_num = num
|
prev_num = num
|
||||||
|
|
||||||
print('Propagate Complete')
|
#print('Propagate Complete')
|
||||||
|
|
||||||
|
|
||||||
def generate_sudoku_grid(difficulty):
|
def generate_sudoku_grid(difficulty):
|
||||||
|
@ -188,10 +188,11 @@ def generate_sudoku_grid(difficulty):
|
||||||
|
|
||||||
def generate_sudoku_puzzle(difficulty):
|
def generate_sudoku_puzzle(difficulty):
|
||||||
grid = generate_sudoku_grid(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)
|
sudoku_array = grid_to_array(grid)
|
||||||
propagate_array(sudoku_array, 18)
|
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
|
return sudoku_array
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,7 @@ class MenuButton(AnimBox):
|
||||||
"""Reimplemented from QGraphicsObject. Receive the click event,
|
"""Reimplemented from QGraphicsObject. Receive the click event,
|
||||||
then reverse its animation and emit buttonClicked signal
|
then reverse its animation and emit buttonClicked signal
|
||||||
"""
|
"""
|
||||||
|
event.accept()
|
||||||
self.toggle_anim(False)
|
self.toggle_anim(False)
|
||||||
self.buttonClicked.emit(self.text)
|
self.buttonClicked.emit(self.text)
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ from PyQt5.QtGui import QPainter, QBrush, QPen
|
||||||
from PyQt5.QtWidgets import (QSizePolicy, QGraphicsWidget, QGraphicsItem,
|
from PyQt5.QtWidgets import (QSizePolicy, QGraphicsWidget, QGraphicsItem,
|
||||||
QGraphicsObject, QGraphicsProxyWidget,
|
QGraphicsObject, QGraphicsProxyWidget,
|
||||||
QGraphicsScene, QGraphicsView, )
|
QGraphicsScene, QGraphicsView, )
|
||||||
|
from general.highscore import DIFFICULTIES
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import buttons
|
import buttons
|
||||||
|
@ -19,8 +20,6 @@ else:
|
||||||
from . import scoreboard as scb
|
from . import scoreboard as scb
|
||||||
|
|
||||||
|
|
||||||
DIFFICULTIES = ['Very Easy', 'Easy', 'Normal', 'Hard', 'Insane']
|
|
||||||
|
|
||||||
|
|
||||||
class TimerDisplayer(QGraphicsWidget):
|
class TimerDisplayer(QGraphicsWidget):
|
||||||
|
|
||||||
|
@ -78,7 +77,6 @@ class DifficultyDisplayer(QGraphicsWidget):
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent=parent)
|
super().__init__(parent=parent)
|
||||||
#self.setParent(parent)
|
|
||||||
|
|
||||||
self.width = 100
|
self.width = 100
|
||||||
self.height = 50
|
self.height = 50
|
||||||
|
|
|
@ -226,7 +226,6 @@ class SudokuGrid(BaseSudokuItem):
|
||||||
# self.buttonClicked.emit(0, 0, self.scribbling)
|
# self.buttonClicked.emit(0, 0, self.scribbling)
|
||||||
|
|
||||||
def mouseReleaseEvent(self, event):
|
def mouseReleaseEvent(self, event):
|
||||||
print('lol')
|
|
||||||
if self.drawn:
|
if self.drawn:
|
||||||
w = (self.mouse_w + 0.5) * self.cell_width
|
w = (self.mouse_w + 0.5) * self.cell_width
|
||||||
h = (self.mouse_h + 0.5) * self.cell_height
|
h = (self.mouse_h + 0.5) * self.cell_height
|
||||||
|
|
Loading…
Reference in New Issue