Christian M. Andersen · senior backend developer, Copenhagen archive · 2026 · 5 channels open

cma:~$ ./play/snake

Executable ·· play.0002

Snake

Snake.exe ▸ running in page
score 0 length 3 level 1

Snake

Press Space or Start to run

←↑↓→orWASDmoveSpacestartPpauseRreset

The whole thing is one class and a setInterval. The grid sizes itself to the canvas rather than being fixed, so it fills whatever space it’s given, and the tick interval drops by 10ms every 50 points until it bottoms out at 80ms.

The only state that outlives the page is a top-ten score list in localStorage, which is validated on read. If something else has written garbage to that key, it starts over rather than throwing.

‹ back to play