You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
531 B

from strutils import parseInt
import rdstdin
import ./chess
proc runGame(): void =
var game = initGame()
game.echoBoard(game.toMove)
while not game.isCheckmate(game.toMove):
echo "Make a move"
echo game.toMove
var move = readLine(stdin)
while not game.checkedMove(notationToMove(move, game.toMove)):
move = readLine(stdin)
game.echoBoard(game.toMove)
if game.isCheckmate(game.toMove):
echo $game.toMove & " was checkmated"
if game.isStalemate(game.toMove):
echo "Stalemate"
runGame()