Chess player: Difference between revisions

(→‎{{libheader|python-chess}}: needs more HAL 9000)
Line 966:
 
board = chess.Board()
 
def hal9000():
print("Thank you for a very enjoyable game.")
 
while not board.outcome():
Line 971 ⟶ 974:
try:
move = input("Your move? ")
if move ==in ("quit":, sys."resign", "exit("):
hal9000()
sys.exit()
board.push_uci(move)
except ValueError: print("Sorry?")
Line 997 ⟶ 1,002:
print(board.unicode())
 
print(f"Game finished, result is {board.result()}")</lang>
hal9000()</lang>
{{Output}} (in ASCII)
<pre>$ python3 simplechess.py
Anonymous user