Snake
A playable snake game: steer with the arrow keys / WASD or the direction buttons while the seed decides the food, with real eating, self-collision and wall detection. It auto-steps on a real millisecond timer (pausable, speed editable) and tracks steps, length, score and food left — clear the board by eating every piece.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Snake board
Steer with the arrow keys / WASD or the direction buttons; eating grows the snake and scores, walls and your own body end the run, and eating every last piece of food clears the game.
- Steps
- 0
- Score
- 0
- Length
- 1
- Food eaten
- 0 / 5
- Food left
- 5
Arrow keys / W A S D steer the snake (an opposite direction is ignored — no U-turns).
Move log
0 steps this game
No moves recorded yet
What this tool does
- Play snake right here: steer with the arrow keys / WASD (or the direction buttons), eat to grow and score, and a wall or your own body ends the run.
- Reproduce the same food slots from a seed: the same seed and size place the food in the same cells, which is handy for comparing scores.
- Turn the food count down (say to 1) for a warm-up: eat everything to clear the game, then use "Undo one step" and the greedy hint to review your route.
Example
Input
seed demo · 20 columns × 15 rows · 5 pieces of food · press the right key four times
Output
..........*.......*. .......*............ .................... .................... .................... .................... .................... ..........oooo@..... .................... .*.................. .................... ..*................. .................... .................... .................... Step 4 · length 1 · eaten 0 / 5 · 5 left
The food slots come from seed demo (xorshift128 shuffles the non-start cells): `@` is the head, `o` the body and `*` the food. The step 4 head position above is exactly what the rules compute.
Frequently asked questions
How do I play, and what counts as winning?
Steer with the arrow keys or W/A/S/D, or click the up/down/left/right buttons next to the board. Eating grows the snake by one and scores 10; a wall or your own body ends the run immediately, and eating every last piece of food clears the game (the page shows "All the food is gone!").
Does it move on its own?
Auto-step is on by default and advances one cell every 220 ms (the interval is editable, 80–2000 ms) — a real timer. Press Pause to stop it, or switch auto-step off for pure manual play where every key press is one step.
Is the food random?
No. The seed (through xorshift128) shuffles the non-start cells and takes the first few, so the same seed, size and food count always give the same slots. "New game" re-generates from your inputs and "Restart this game" reproduces the previous one exactly.
What happens if I press the opposite direction, and how good is the hint?
An input opposite to the current direction is ignored — the snake does not make U-turns — and it does not count as a step. Hitting your own body (any body cell except the current head) ends the run. The hint only suggests the greedy direction towards the nearest food: it is guaranteed to be legal, not to keep you alive, and the board never moves for you.
Is anything uploaded?
Everything runs in your browser: no network requests and no saved progress, so a reload starts a new game. Columns accept 6–40, rows 6–30, and the food count can go up to (cells − 1).
Keywords:snake