Existing chess server protocols (UCI) do a lot of things we don't need. Hence this simpler protocol.
Your chess program will read and write lines of input and output.
Informally, the first input line will either be black
or white
,
indicating which side your program will play.
Thereafter, your program will read and write moves in succession. Each move will be in long algebraic notation. Specifically, each move will be a 4 or 5 character string with the start and end positions of the moving piece.
Castling will use the king's move. Pawn promotion will add a 5th character indicating the promoted piece. For example:
e2e4
b8c6
f7f8q
e1c1
These moves are, respectively, advancing white's king pawn two squares, moving black's queen knight in front of the bishop pawn, white promoting to a queen on the f-file, and white castling queen-side.
Your program must fight it out.
When the game is over,
output the single line 1-0
or 0-1
or draw
,
whichever is correct.
Your program must correctly detect draw by repetition, stalemate, and draw after 50 moves without a capture or pawn move.