Chris Mair

Language selector

A chess engine in Go: part 2 - board state and FEN input

Important things first: my toy chess engine will be called MOCHI. In the tradition of bad acronyms, MOCHI stands for MinOr CHess engIne and should not be mistaken for the Japanese rice cake of the same name1.

At this point, MOCHI just implements a board representation and FEN2 input with some consistency checks. For example, MOCHI sees if a king is in check and recognizes positions as invalid if it’s one side’s turn while the opposite side’s king is in check.

The source code found its home on Codeberg3.

MOCHI console output
go run mochi showing some debugging output…

The next step is to implement a move generator and test it against some sample positions4 from the chess programming wiki.


  1. Mochi, the rice cake ↩︎

  2. FEN at Wikipedia ↩︎

  3. MOCHI, the chess engine on Codeberg ↩︎

  4. PERFT results at the chess programming wiki ↩︎

Menu

Language selector