NEON SNAKE
Press Space or Button to Start
Neon Snake runs on a 25×25 grid drawn as a 500×500 canvas: a pink pellet, a glowing green snake, three rules. Eat, grow, and do not hit a wall or your own body. No lives, no levels, no power-ups. The only pressure comes from the food you take. Every pellet is worth 10 points, adds one segment, and cuts the interval between moves by 1 ms. The game starts at 10 moves per second and floors at 20, so difficulty rises only when you score.
The only thing written to your browser is the best score, under the localStorage key axonix-snake-highscore. The game keeps no server-side record, needs no account, and sends nothing about your run off your device.
- Press Start Game, Space, or Enter. The snake spawns as three segments on row 10, heading right.
- Steer with the arrow keys or W/A/S/D. A 180° turn into your own neck is refused.
- Eat the pink pellet. Every pellet scores 10 points and adds one segment to the tail.
- Each pellet also removes 1 ms from the tick, so the board accelerates with every point.
- Stay off the edges. The board does not wrap, so crossing one ends the run.
- Stay off your body, including the tail segment that is mid-move this tick.
- Pause with Space or Enter. The PAUSED overlay leaves the board intact beneath it.
- On death, GAME OVER shows your final score. Play Again resets the board, not your best.
- Difficulty is opt-in. Speed only rises when you eat, so a run that avoids pellets holds at 100 ms per move.
- Every 10 points costs you 1 ms of reaction time and one more segment to dodge.
- Only one turn is buffered at a time. The last key press inside a tick overwrites the queued one.
- The tail is solid for the whole tick it moves. A cell your tail is vacating is still lethal.
- Food never spawns on your body, so it always occupies a free cell. Start the approach early.
- Your length is three segments plus one per pellet. At 50 pellets you steer 53 segments.
- The head is a lighter green with a stronger glow than the body, so you can find it instantly.
- Keep the outer ring for transit. Turning near an edge leaves you no room to recover.
Board
A 25×25 grid of 20 px cells on a 500×500 canvas. CSS scales it down on narrow screens without changing the logical grid.
The tick
A requestAnimationFrame loop advances the snake only once the current speed interval in milliseconds has elapsed.
Speed ramp
The tick interval starts at 100 ms, loses 1 ms for every pellet eaten, and floors at 50 ms. Reaching the floor takes 50 pellets.
Collisions
Leaving the grid ends the run. The body check runs before the tail is popped, so the cell your tail is vacating is still lethal.
Food and growth
Pellets spawn uniformly on free cells, never on the snake, and never expire. Eating skips the tail pop, so a pellet adds exactly one segment.
States
MENU, PLAYING, PAUSED, GAME_OVER. The grid is painted only while a run is live, so the menu shows an empty canvas and a finished run keeps its last frame. Starting over resets to three segments and score 0.
- Arrow keys
- Turn up, down, left, or right. Their default scroll action is blocked.
- W / A / S / D
- Identical to the arrow keys, for players who keep their left hand on WASD.
- Space
- Pause and resume a live run; from the menu or game-over screen it starts one.
- Enter
- Same three-way role as Space: pause, resume, or start.
- Touch up
- Queues an upward turn on pointer-down, before the finger lifts.
- Touch left
- Queues a left turn on pointer-down, with the same reversal guard.
- Touch right
- Queues a right turn on pointer-down, guarded again on the tick.
- Touch down
- Queues a downward turn on pointer-down. There is no swipe gesture and no touch pause button.
- Start button
- Begins a run from the menu overlay that covers the board.
- Resume / Play Again
- Play Again resets the board after a crash; Resume restores the paused board.
- Pellet
- 10 points, every time. The value never scales with length, speed, or position.
- Total
- A plain count of pellets, so the score is always a multiple of 10.
- Bonuses
- None. No combo, streak, multiplier, level, or survival bonus exists in the scoring path.
- Best score
- Kept in localStorage under axonix-snake-highscore and written the moment your score passes it, not at the end of the run.
- Reset
- Start Game and Play Again both zero the score and leave the stored best untouched. Only clearing site data removes it.
- Speed link
- Score is also a difficulty dial: every 10 points removes 1 ms, and 500 points is the floor speed of 20 moves per second.
Eat on your terms
Food is the only thing that speeds the game up, and speed is the only thing that kills you that walls do not. Each pellet trades a point for less reaction time and a longer body.
Plan around the tail
The collision check runs before the tail is popped, so a cell your tail is vacating is still lethal. Only the interior of a loop is safe.
Think in ticks
The direction buffer holds one pending turn, and the last press inside a tick wins, so a mis-aimed turn can only be corrected before the tick fires.
Length is the real limit
You always steer three segments plus one per pellet, and the board holds 625 cells. At 50 pellets you move 53 segments at 20 moves per second, and your own geometry ends runs.
- Cell
- One square of the 25×25 grid. Each is 20 px, so 25 cells span the 500 px canvas.
- Tick
- One discrete move of the snake, fired once the current speed interval has elapsed.
- Speed
- The tick interval in milliseconds, not a multiplier: 100 at the start, 1 less per pellet, 50 at the floor.
- Body trail
- The segments behind the head. It still includes the cell the tail is leaving.
- Growth segment
- The extra segment kept on the tick you score, since the tail is not popped then.
- Direction buffer
- The single pending direction, held apart from the committed one until the next tick.
- Reversal guard
- The check that refuses a 180° turn. It runs twice: on input, and again on the tick.
- Record
- The stored best score under axonix-snake-highscore. It survives reloads and is never cleared.