Started a binary adder

master
Micke Nordin 7 years ago
parent 7e4fcbf35e
commit 9f3e859a46

@ -1,6 +1,6 @@
1
0
1
2
1
0
2
0

@ -1,6 +1,6 @@
0
1
3
1
0
1
0
0

@ -0,0 +1,6 @@
0
1
4
1
0
2

@ -0,0 +1,6 @@
0
1
5
1
0
3

@ -0,0 +1,6 @@
0
1
6
1
0
4

@ -0,0 +1,6 @@
0
1
7
1
0
5

@ -0,0 +1,6 @@
0
1
8
1
0
6

@ -0,0 +1,6 @@
0
1
9
1
0
7

@ -0,0 +1,6 @@
1
1
8
1
0
8

@ -16,7 +16,7 @@ class Register:
else:
return p + str(self.positive[self.pos])
def read(self):
def read(self):
if self.pos == 0:
return self.zero
elif self.pos < 0:
@ -51,12 +51,15 @@ class Card:
with open("cards/" + str(self.number) ,'r') as f:
for row in f:
line.append(row[:-1])
self.zero_write = bool(line[0])
self.zero_move = bool(line[1])
self.zero_write = bool(int(line[0]))
self.zero_move = bool(int(line[1]))
self.zero_next = int(line[2])
self.one_write = bool(line[3])
self.one_move = bool(line[4])
self.one_write = bool(int(line[3]))
self.one_move = bool(int(line[4]))
self.one_next = int(line[5])
def __str__(self):
return "Card number: " + str(self.number) + "\nIf 1 :\nMove: " + str(self.one_move) + "\nWrite: " + str(self.one_write) + "\nNext card: " + str(self.one_next) + "\nIf 0 :\nMove: " + str(self.zero_move) + "\nWrite: " + str(self.zero_write) + "\nNext card: " + str(self.zero_next) + '\n'
class Machine:
def __init__(self):
@ -93,4 +96,5 @@ class Machine:
turing = Machine()
run = True
while run:
run = turing.evolve()
# print (turing.card)
run = turing.evolve()

Loading…
Cancel
Save