diff --git a/tools/draw.py b/tools/draw.py index d55de83e271827cee47a4cbb5fa5cf89ad166af9..6b99ba71b324dfce197c54b7a0335db7376c8f5c 100755 --- a/tools/draw.py +++ b/tools/draw.py @@ -1,21 +1,21 @@ #!/usr/bin/env python3 #-*- encoding: utf-8 -*- -import sys +try: + while True: + bitboard = int(input("Enter board : ")) -while True: - bitboard = int(input("Enter board : ")) + output = [" "] - output = [] - - for i in range(59, -1, -1): - if(i % 15 == 14): - output.append("|\n ") - elif(i % 15 == 7): - output.append("|\n") - if((bitboard >> i) & 1 == 1): - output.append("|x") - else: - output.append("| ") - - output.append("|") - print(''.join(output)) + for i in range(59, -1, -1): + if((bitboard >> i) & 1 == 1): + output.append("|x") + else: + output.append("| ") + + if(i % 15 == 0): + output.append("|\n ") + elif(i % 15 == 8): + output.append("|\n") + print(''.join(output)) +except KeyboardInterrupt: + print("\nMay the fish be with you.")