This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOn the Subject of Memory.py
82 lines (73 loc) · 2.31 KB
/
On the Subject of Memory.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
n = 4
stages = 5
lst = [[1,3,2,4,1], [3,1,2,4,3], [2,3,4,1,2], [2,1,4,3,1], [4,1,2,3,4]]
def byPos(lst, i, buttonp):
return lst[i][buttonp]
def byLabel(lst, i, buttonx):
for j in range(n):
if lst[i][j] == buttonx:
return j
for i in range(stages):
# for j in range(n):
p = lst[i][n]
if i == 0: #stage 1
if p == 1 or p == 2:
button1p = 1 #2nd pos
button1 = byPos(lst, i, button1p)
elif p ==3:
button1p = 2 #3nd pos
button1 = byPos(lst, i, button1p)
elif p ==4:
button1p = 3 #4nd pos
button1 = byPos(lst, i, button1p)
print (button1)
elif i == 1: #stage 2
if p == 1:
button2 = 4
button2p = byLabel(lst, i, button2)
elif p ==3:
button2p = 0 #1st pos
button2 = byPos(lst, i, button2p)
elif p==2 or p ==4:
button2p = button1p
button2 = byPos(lst, i, button2p)
print (button2)
elif i == 2: #stage 3
if p == 1:
button3 = button2
button3p = byLabel(lst, i, button3)
elif p == 2:
button3 = button1
button3p = byLabel(lst, i, button3)
elif p ==3:
button3p = 2
button3 = byPos(lst, i, button3p)
elif p ==4:
button3 = 4 #button labelled 4
button3p = byLabel(lst, i, button3)
print (button3)
elif i == 3: #stage 4
if p == 1:
button4p = button1p
button4 = byPos(lst, i, button4p)
elif p == 2:
button4p = 0
button4 = byPos(lst, i, button4p)
elif p ==3 or p== 4:
button4p = button2p
button4 = byPos(lst, i, button4p)
print(button4)
elif i == 4: #stage 5
if p == 1:
button5p = button1p
button5 = byPos(lst, i, button5p)
elif p == 2:
button5p = button2p
button5 = byPos(lst, i, button5p)
elif p ==3:
button5p = button3p
button5 = byPos(lst, i, button5p)
elif p ==4:
button5p = button4p
button5 = byPos(lst, i, button5p)
print(button5)