A minimal classic Snake game built with plain HTML, CSS, and JavaScript.
The project focuses on the original gameplay loop only:
- grid-based movement
- food spawning
- snake growth
- score tracking
- game over on wall or self collision
- restart support
- HTML
- CSS
- JavaScript ES modules
- Node.js built-in test runner
npm startThen open http://localhost:3000.
npm testindex.html— app shellsrc/snake/game.mjs— deterministic core game logicsrc/snake/app.mjs— browser rendering and controlssrc/snake/styles.css— minimal presentationscripts/serve.mjs— zero-dependency local static servertests/snake.test.mjs— core logic tests
- Arrow keys or
WASDto move Spaceto pause or resumeRestartbutton to reset the run- On smaller screens, on-screen directional buttons are available
This project is static and can be deployed anywhere that serves plain files.
Create a Static Space and upload:
index.htmlsrc/package.jsonREADME.md
If you host it separately, it can be embedded with a standard iframe.