PGN files from handwritten chess notation
02 Dec 2024
Our family has been playing quite a bit of chess recently. The younger members - initially insistent that all games must be “full chess” - have been persuaded to complete a few exercises with just pawns, practise some end games and get the ideas about planning more than one move ahead. We got a chess puzzle/exercise book and it’s proved a hit.
I’m now routinely losing to a 9.5 year old - he has had more practice than his big sister.
We love recording our chess moves (algorithmic notation) and then getting the games analysed online afterwards. We are doing some online chess, including watching free lessons and YouTubers, but the best bits are offline, analog, IRL, so the moves from our games are all handwritten. Until now, we’ve found the typing in part of the process - taking handwritten standard algorithmic notation and entering it into a computer - rather tricky.
The .pgn
file format is fairly simple, so I tried out a couple of tools. My idea was: if I tried to type out every move, I’d surely make a mistake (or have made a mistake in the handwriting). So I wanted on-the-go validation: the computer should tell me if my move is illegal or ambiguous. I searched online and didn’t find many options.
Two that I did find:
chess-cli
- tage64/chess-cli - we had some success with this, but it suffers from overly-complex dependencies, no simple install process, and bugs. No easy way to go back and edit if you realise you made a mistake a few lines back.- PGN Maker - requires each move to be entered by clicking and dragging pieces on an on-screen chessboard, as far as I can make out. That’s too slow and cumbersome, so I didn’t look further at this one.
I considered trying to submit some improvements to chess-cli
, but after spending a couple of evenings I think I’ve made my own tool which is closer to what I want. It uses chess.js for chess logic and chessboard.js for display.
Click the button below to try it out:
It looks pretty bare bones, but you should be able to just open it in any browser and
- start typing moves
- edit and update the whole set of moves as you go
- see the board update as soon as you stop typing/editing
- see the cleaned list of moves update as soon as you stop typing/editing. I find this helps with making sure you’re getting it right/
- get told if your move is ambiguous or illegal
It follows your entered moves as far as it can and shows the resulting position. If it encounters an invalid move (ambiguous/illegal), it shows the last good position and you can edit the text you’ve entered to put things right.
If that sounds complicated, I’d say it’s way less complicated than any other option I’ve found. And look! It’s child’s play:
I can copy/paste the PGN
text into an online chess platform, or save it in a text file. It’s all in the browser, nothing server-side.
If you’ve found this blog post while trying to convert your own handwritten chess games into PGN files, I hope you find it useful. A future version could use handwriting recognition or some nice buzzword-friendly AI to make it even quicker, maybe.
Tags: geeky, chess, family, code
< Previous postFavourite posts
- On wiggly lines and being normal
- On infinite villages
- Running a race backwards
- Brainmaking
- Their tables were stored full, to glad the sight
- The structure of a smell
Recent posts
- PGN files from handwritten chess notation
- Souvenirs des villes européennes
- Pic'n'mix reinvented
- Super slow-mo Tetris
- Skill swaps
Blog archives
Posts from 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024.