-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
65 lines (56 loc) · 2.14 KB
/
models.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
class Model:
def __init__(self):
self.Model = None
def getModel(self):
return self.Model
class Zero(Model):
def __init__(self):
self.Model = {
(1, 0): [1, 'O', 2],
(1, 1): [0, 'R', 1]
}
class Add(Model):
def __init__(self):
self.Model = {
(1, 0): [1, 'L', 2], (1, 1): [1, 'R', 1],
(2, 0): [0, 'R', 3], (2, 1): [1, 'L', 2],
(3, 1): [0, 'R', 4],
(4, 1): [0, 'R', 5],
}
class Minus(Model):
def __init__(self):
self.Model = {
(1, 1): [0, 'R', 2],
(2, 0): [0, 'R', 8], (2, 1): [1, 'R', 3],
(3, 0): [0, 'R', 4], (3, 1): [1, 'R', 3],
(4, 0): [0, 'R', 4], (4, 1): [0, 'R', 5],
(5, 0): [0, 'L', 10], (5, 1): [1, 'L', 6],
(6, 0): [0, 'L', 6], (6, 1): [1, 'L', 7],
(7, 0): [0, 'R', 1], (7, 1): [1, 'L', 7],
(8, 0): [0, 'R', 8], (8, 1): [0, 'R', 9],
(9, 0): [1, 'O', 13], (9, 1): [0, 'R', 9],
(10, 0): [0, 'L', 10], (10, 1): [1, 'R', 11],
(11, 0): [1, 'L', 12],
(12, 0): [0, 'R', 13], (12, 1): [1, 'L', 12]
}
class Multiply(Model):
def __init__(self):
self.Model = {
(1, 1): [0, 'R', 2],
(2, 0): [0, 'R', 14], (2, 1): [0, 'R', 3],
(3, 0): [0, 'R', 4], (3, 1): [1, 'R', 3],
(4, 0): [0, 'R', 5], (4, 1): [0, 'R', 5],
(5, 0): [0, 'R', 16], (5, 1): [0, 'R', 6],
(6, 0): [0, 'R', 7], (6, 1): [1, 'R', 6],
(7, 0): [1, 'L', 8], (7, 1): [1, 'R', 7],
(8, 0): [0, 'L', 9], (8, 1): [1, 'L', 8],
(9, 0): [1, 'R', 5], (9, 1): [1, 'L', 9],
(10, 0): [0, 'L', 11], (10, 1): [1, 'L', 10],
(11, 0): [0, 'L', 12],
(12, 0): [0, 'R', 14], (12, 1): [1, 'L', 13],
(13, 0): [0, 'R', 2], (13, 1): [1, 'L', 13],
(14, 0): [0, 'R', 14], (14, 1): [0, 'R', 15],
(15, 0): [1, 'O', 18], (15, 1): [0, 'R', 15],
(16, 0): [1, 'L', 17], (16, 1): [1, 'L', 17],
(17, 0): [0, 'L', 10], (17, 1): [0, 'L', 10],
}