Skip to content
Snippets Groups Projects
Commit c4fb6ead authored by Bariatti Francesco's avatar Bariatti Francesco
Browse files

drawState main loop executed only when executed as a program

parent 592340da
No related branches found
No related tags found
No related merge requests found
...@@ -34,24 +34,25 @@ def drawPenguin(penguin): ...@@ -34,24 +34,25 @@ def drawPenguin(penguin):
} }
print("Pos: {pos}, A:{A}, B:{B}, C:{C}, D:{D}, E:{E}, F:{F}, Tot: {tot}".format(**args)) print("Pos: {pos}, A:{A}, B:{B}, C:{C}, D:{D}, E:{E}, F:{F}, Tot: {tot}".format(**args))
try: if __name__ == "__main__":
while True: try:
read = []
print("Enter state:")
while True: while True:
line = input() read = []
if line == "": print("Enter state:")
break while True:
read.append(line) line = input()
if line == "":
break
read.append(line)
state = json.loads(''.join(read))
drawBitboard(state["bitboards"]["onefish"],state["bitboards"]["twofish"],state["bitboards"]["threefish"])
print("Red penguins")
for i in range(4):
drawPenguin(state["penguins"]["red"][i])
print("Blue penguins")
for i in range(4):
drawPenguin(state["penguins"]["blue"][i])
state = json.loads(''.join(read)) except KeyboardInterrupt:
drawBitboard(state["bitboards"]["onefish"],state["bitboards"]["twofish"],state["bitboards"]["threefish"]) print("\nMay the fish be with you.")
print("Red penguins")
for i in range(4):
drawPenguin(state["penguins"]["red"][i])
print("Blue penguins")
for i in range(4):
drawPenguin(state["penguins"]["blue"][i])
except KeyboardInterrupt:
print("\nMay the fish be with you.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment