Finish homework

This commit is contained in:
Jan-Niclas Loosen
2025-10-18 18:52:00 +02:00
parent 7f3cd757ae
commit 5e616dd0a2
3 changed files with 55 additions and 32 deletions

View File

@@ -61,8 +61,19 @@ if __name__ == "__main__":
print(f"{passed}/{len(tests)} tests passed.")
# Load machine
machine = MaMa(prog, [4,6])
machine = MaMa(prog, [4, 6])
journal = machine.run()
with open("run.txt", "w") as f:
i = 1
for step in journal:
s = step["p_stack"]
p = step["p_prog"]
S = tuple(step["stack"].values())
f.write(f"{i}: ({s},{p},{S})\n")
i += 1
# Visualize finished execution using journal
machine = MaMa(prog, [4, 6])
gui = MaMaGUI(machine)
gui.display()