Repository navigation
Neural Snake 1.0.1
By Dev Suthar and the LDS Team. Published by Let's Data Science.
Play Snake in your browser with no game rules in the code: a 78,177-parameter neural network predicts every next frame from the current frame and your key press. Build the board encoding, the food-head loss and a Kaplan-Meier measure yourself, train your own model, export it to ONNX and play it.
- Starter ZIP: three exercises to complete, their tests, Dev's shipped model and evidence, and completed versions to restore from.
- Reference ZIP: the finished teaching edition, with every exercise complete.
- SHA256SUMS.txt: checksums for both archives.
Use Python 3.12 and Node.js 22 or newer. Follow README.md after extraction. The repository itself contains the completed reference.
Dev's held-out evaluation reproduces exactly from regenerated data: 99.987% of 133,848 held-out steps predicted exactly, and 19 of 200 test games drifted from the real engine within 1,000 steps. That evaluation ran once; measure your own models on validation rows with eval_heldout.py dryrun.
Validation: from a fresh download, 52 Python tests pass and 5 wait for the data and a trained model; all 57 pass once they exist. All 80 JavaScript tests pass. No API key, account or paid service is needed, and no credentials, data or trained weights beyond the shipped model are included.
Apache License 2.0. Dev Suthar's original MIT notice is kept in NOTICE, with provenance in UPSTREAM.json.
This patch makes three of Dev's test checks read Node's test summary the same way on every version, so the full suite also passes on Node.js 22. The project checks in this repository pass on Ubuntu with Node.js 22.