|
|
@ -7,7 +7,7 @@
|
|
|
|
import pickle
|
|
|
|
import pickle
|
|
|
|
import random
|
|
|
|
import random
|
|
|
|
import qdarkstyle
|
|
|
|
import qdarkstyle
|
|
|
|
from PySide6.QtCore import QTimer
|
|
|
|
from PySide6.QtCore import QTimer, QPropertyAnimation, QRect, QPoint
|
|
|
|
from PySide6.QtWidgets import *
|
|
|
|
from PySide6.QtWidgets import *
|
|
|
|
from PySide6.QtGui import QIcon
|
|
|
|
from PySide6.QtGui import QIcon
|
|
|
|
from win.win import Ui_Form as Form1
|
|
|
|
from win.win import Ui_Form as Form1
|
|
|
@ -50,6 +50,9 @@ class Form(Form1):
|
|
|
|
self.B_read.clicked.connect(self.B_read_fun)
|
|
|
|
self.B_read.clicked.connect(self.B_read_fun)
|
|
|
|
|
|
|
|
|
|
|
|
self.timer = QTimer()
|
|
|
|
self.timer = QTimer()
|
|
|
|
|
|
|
|
self.shake_timer = QTimer(self)
|
|
|
|
|
|
|
|
self.shake_times = 0
|
|
|
|
|
|
|
|
self.shake_timer.timeout.connect(self.shake_window)
|
|
|
|
self.timer.setInterval(1000)
|
|
|
|
self.timer.setInterval(1000)
|
|
|
|
self.timer.timeout.connect(self.update_time)
|
|
|
|
self.timer.timeout.connect(self.update_time)
|
|
|
|
self.init_bt()
|
|
|
|
self.init_bt()
|
|
|
@ -248,40 +251,58 @@ class Form(Form1):
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
print(e)
|
|
|
|
print(e)
|
|
|
|
|
|
|
|
|
|
|
|
def check_sudo(self):
|
|
|
|
def check_sudo(self,mode=0):
|
|
|
|
global cnt, del_cnt, subject_with_answer
|
|
|
|
global cnt, del_cnt, subject_with_answer
|
|
|
|
f = 1
|
|
|
|
f = 1
|
|
|
|
|
|
|
|
|
|
|
|
for row_index in range(9):
|
|
|
|
for row_index in range(9):
|
|
|
|
for col_index in range(9):
|
|
|
|
for col_index in range(9):
|
|
|
|
num = subject_with_answer[row_index, col_index]
|
|
|
|
num = subject_with_answer[row_index, col_index]
|
|
|
|
|
|
|
|
if num == 0:
|
|
|
|
# 获取该格子对应的行、列、九宫格
|
|
|
|
pass
|
|
|
|
sudo_row = sd.get_row(subject_with_answer, row_index)
|
|
|
|
else:
|
|
|
|
sudo_col = sd.get_col(subject_with_answer, col_index)
|
|
|
|
# 获取该格子对应的行、列、九宫格
|
|
|
|
sudo_block = sd.get_block(subject_with_answer, row_index, col_index)
|
|
|
|
sudo_row = sd.get_row(subject_with_answer, row_index)
|
|
|
|
# print(num)
|
|
|
|
sudo_col = sd.get_col(subject_with_answer, col_index)
|
|
|
|
# print(sudo_row)
|
|
|
|
sudo_block = sd.get_block(subject_with_answer, row_index, col_index)
|
|
|
|
# print(sudo_col)
|
|
|
|
|
|
|
|
# print(sudo_block)
|
|
|
|
cnt_oc1 = count_occurrences(sudo_row, num, 0)
|
|
|
|
|
|
|
|
cnt_oc2 = count_occurrences(sudo_col, num, 0)
|
|
|
|
cnt_oc1 = count_occurrences(sudo_row, num, 0)
|
|
|
|
cnt_oc3 = count_occurrences(sudo_block, num, 1)
|
|
|
|
cnt_oc2 = count_occurrences(sudo_col, num, 0)
|
|
|
|
# print(cnt_oc1, cnt_oc2, cnt_oc3)
|
|
|
|
cnt_oc3 = count_occurrences(sudo_block, num, 1)
|
|
|
|
if cnt_oc1 != 1 or cnt_oc2 != 1 or cnt_oc3 != 1:
|
|
|
|
if cnt_oc1 != 1 or cnt_oc2 != 1 or cnt_oc3 != 1:
|
|
|
|
f = 0
|
|
|
|
f = 0
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if f == 0:
|
|
|
|
if f == 0:
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
if f == 1:
|
|
|
|
if f == 1:
|
|
|
|
print("yes")
|
|
|
|
# print("yes")
|
|
|
|
QMessageBox.information(self, '提示', '成功')
|
|
|
|
if del_cnt == cnt:
|
|
|
|
self.timer.stop()
|
|
|
|
QMessageBox.information(self, '提示', '成功')
|
|
|
|
|
|
|
|
self.timer.stop()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print("no")
|
|
|
|
# print("no")
|
|
|
|
QMessageBox.information(self, '提示', '失败')
|
|
|
|
if mode == 1:
|
|
|
|
|
|
|
|
self.shake_timer.start(30)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
QMessageBox.information(self, '提示', '失败')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def shake_window(self):
|
|
|
|
|
|
|
|
self.shake_times += 1
|
|
|
|
|
|
|
|
if self.shake_times == 5:
|
|
|
|
|
|
|
|
self.shake_times = 0
|
|
|
|
|
|
|
|
self.shake_timer.stop()
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if self.shake_times % 2 == 0:
|
|
|
|
|
|
|
|
self.move(self.x() + 7, self.y())
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.move(self.x() - 7, self.y())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def put_num(self):
|
|
|
|
def put_num(self):
|
|
|
|
global cnt, del_cnt, subject_with_answer, stack
|
|
|
|
global cnt, del_cnt, subject_with_answer, stack
|
|
|
@ -327,6 +348,8 @@ class Form(Form1):
|
|
|
|
|
|
|
|
|
|
|
|
if cnt == del_cnt:
|
|
|
|
if cnt == del_cnt:
|
|
|
|
self.check_sudo()
|
|
|
|
self.check_sudo()
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.check_sudo(1)
|
|
|
|
|
|
|
|
|
|
|
|
def B_S_fun(self):
|
|
|
|
def B_S_fun(self):
|
|
|
|
global cnt, del_cnt, stack, sudo, subject_with_answer
|
|
|
|
global cnt, del_cnt, stack, sudo, subject_with_answer
|
|
|
|