-
Notifications
You must be signed in to change notification settings - Fork 4
/
debug.py
58 lines (45 loc) · 1.12 KB
/
debug.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from Cube import*
from gui.main_gui import *
class Debug:
cube = Cube(2)
move_list = []
def __init__(self):
pass
@staticmethod
def view(hash):
if hash == None:
return
m = Cube(2)
m.state = Cube.decode(hash)
g = GUI(cube=m, player=True, width=800, height=600)
while True:
g.update()
@staticmethod
def reset(cube=Cube(2)):
Debug.cube = cube
Debug.move_list = [((None,None),cube.__hash__())]
@staticmethod
def addMove(move):
Debug.move_list.append(move)
@staticmethod
def viewMoves():
g = GUI(cube=Debug.cube, width=800, height=600)
g.moveList(Debug.move_list)
while True:
g.update()
if __name__ == '__main__':
hash = None
print("Enter the hash: ")
Debug.view(int(input()))
pass
# Initial setup debug
c = Cube(2)
c.makeMove((1,1))
c.makeMove((2,1))
Debug.reset(c)
# Add moves
c.makeMove((2,3))
Debug.addMove(((2,3), c.__hash__()))
c.makeMove((1,3))
Debug.addMove(((1,3), c.__hash__()))
Debug.viewMoves()