@simontatham I am very amused that the first thing I did on seeing this post was decide to go find a 3x3 implementation to try, before reading it... only to discover at the very top a playable 3x3 implementation :) Nice.
The Satan version doesn't seem to want to play for me. New game generates 2 random tiles, but then they won't move (Firefox on Windows 11).
I am clearly less good at 2048 than I thought, as I'm not getting to 256 anywhere near 90% of the time!