aboutsummaryrefslogtreecommitdiff
path: root/flipper.py
diff options
context:
space:
mode:
authorAnthony Wang2024-03-02 21:02:45 -0500
committerAnthony Wang2024-03-02 21:02:45 -0500
commit97c68488f022ea79feb42e0146e2801179e1a3bf (patch)
treedf7246dc77b67cb71c750e8f3a9d10a5df5c7aaa /flipper.py
parent494de8e432e4e13f92800600467057c533b6bdd4 (diff)
Loop program until (0, 0) is 0 so that Flip can actually be Turing-completeHEADmaster
Diffstat (limited to 'flipper.py')
-rwxr-xr-xflipper.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/flipper.py b/flipper.py
index 9d06546..27dcd70 100755
--- a/flipper.py
+++ b/flipper.py
@@ -12,9 +12,14 @@ def flip(x, y):
return mem[x][y]
with open(argv[1]) as f:
- for line in f.readlines():
+ lines = f.readlines()
+
+while True:
+ for line in lines:
l = list(map(int, line.split()))
x = l[0]
for i in range(1, len(l)):
x = flip(x, l[i])
print(x)
+ if 0 not in mem[0] or mem[0][0] == 0:
+ exit()