💾 Archived View for perso.pw › blog › articles › chess.gmi captured on 2021-12-04 at 18:04:22. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
It's possible to play chess using email. This is possible because
there are notations like PGN (Portable Game Notation) that describe
the state of a game.
By playing on your computer and sending the PGN of the game to
your opponent, that person will be able to play their move and
send you the new PGN so you can play.
This is quite easy with xboard (which should be available in most
bsd/linux/unix distributions), as long as you are aware of the few
keybindings.
When you start a game, press **Ctrl+E** to enter edition mode, this
will prevent the AI to play, then make your move.
From there, you can press **Ctrl+C** to copy the state of the game.
You will have something like this in your clipboard.
[Event "Edited game"]
[Site "solene.local"]
[Date "2020.09.28"]
[Round "-"]
[White "-"]
[Black "-"]
[Result "*"]
1. d3
*
You can send this to your opponent, but the only needed data is `1.
d3` which is the PGN notation of the moves. You can throw the rest.
In a more advanced game, you will end up mailing this kind of data:
1. d3 e6 2. e4 f5 3. exf5 exf5 4. Qe2+ Be7 5. Qxe7+ Qxe7+
When you want to play your turn, load that line and press **Ctrl+V**,
you should see the moves happening on the board.
gnuchess allow playing chess in command line.
When you want to start a game, you will have a prompt, type `manual`
to not play against the AI. I recommend using `coords` to display
coordinates on the axis of the board.
When you type `show board` you will have this display:
white KQkq
8 r n b q k b n r
7 p p p p p p p p
6 . . . . . . . .
5 . . . . . . . .
4 . . . . . . . .
3 . . . . . . . .
2 P P P P P P P P
1 R N B Q K B N R
a b c d e f g h
Then, I can type `d3` I get a display
8 r n b q k b n r
7 p p p p p p p p
6 . . . . . . . .
5 . . . . . . . .
4 . . . . . . . .
3 . . . P . . . .
2 P P P . P P P P
1 R N B Q K B N R
a b c d e f g h
From the game, you can save the game using `pgnsave FILE`
and load a game using `pgnload FILE`.
You can see the list of the moves using `show game`.