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):
}
print("Pos: {pos}, A:{A}, B:{B}, C:{C}, D:{D}, E:{E}, F:{F}, Tot: {tot}".format(**args))
try:
while True:
read = []
print("Enter state:")
if __name__ == "__main__":
try:
while True:
line = input()
if line == "":
break
read.append(line)
read = []
print("Enter state:")
while True:
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))
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])
except KeyboardInterrupt:
print("\nMay the fish be with you.")
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