🚧 Work in progress: This article is still a work in progress. The bot is really shit right now.

Play AI me in chess.

Written:

Over the past month or two I’ve started getting into chess.

First it was over the board with some friends.

Then it was with my coworker inbetween claude prompts.

Now that I’m on vacation and traveling around, it’s basically every day.

I’m still really shit at it, but it’s fun being shit at a game, because you can only get better.

I was sitting in my airbnb with nothing to do and I wanted to get some code down. Soooo uhhhhh let’s make an AI version of my playstyle.

If you know nothing about Chess engines, close this page and watch Sebastian Lague’s chess engine exploration video.

Setting up the board

Lichess publishes their chessboard component called chessground. It’s well typed and has good examples. Thanks lichess!

Querying the engine

Getting the data

It’s actually really easy to export your chess games as a PGN string.

You can look at them at

My Games

I use chessinsights.xyz to export the full pgn.

Each game in PGN looks something like this.

[Event "Live Chess"]
[Site "Chess.com"]
[Date "2026.06.03"]
[Round "-"]
[White "hodgehoghore"]
[Black "Kennnan"]
[Result "0-1"]
[WhiteElo "261"]
[BlackElo "393"]
[TimeControl "600"]
[EndTime "21:08:53 GMT+0000"]
[Termination "Kennnan won by checkmate"]

1. d3 d5 2. Nd2 e5 3. c4 Nf6 4. cxd5 Nxd5 5. Nc4 f6 6. Nf3 Bc5 7. Qa4+ Nc6 8.
Bd2 Bd7 9. Nh4 Ncb4 10. Qa5 Nc2+ 11. Kd1 b6 12. Nxb6 Nxa1 13. Qxc5 axb6 14. Qxd5
Ba4+ 15. Qb3 Nxb3 16. axb3 Bxb3+ 17. Kc1 Ra1# 0-1

Openers