Tiny Arcade five small games
  1. Tiny Arcade
  2. Snake

Snake

The original grow-and-don't-crash game. Eat food, wrap at the edges, and keep the tail off your own head.

Your browser does not support the canvas element. The game cannot run, but the rules are described below.
Score 0 Best 0

Press Space to start or restart.Tap a direction to start, or use Restart.

The rules

Snake is a game of incremental pressure. The snake moves continuously in one direction, and you can only turn — never stop and never reverse. Each piece of food makes the snake one segment longer and ten points richer, so the board becomes more crowded the better you play.

Two rules define this particular version. The board wraps: leaving the right edge brings you back on the left, which makes escape routes available where other versions would kill you. And the run ends on self-collision: if your head enters a cell your body already occupies, the game is over.

Controls

Arrows / WASDChange direction (forward, left or right)
Space / EnterStart, or restart after a game over
TouchOn-screen direction buttons

Strategy

The reliable way to score is to keep the snake folded into a compact shape and travel in long loops rather than chasing food across the board. Because the board wraps, a lap around the perimeter is always safe as long as your body does not already sit on that lane. Speed increases every forty points, so the main threat later is your own reaction time rather than the board filling up.

Notes on the implementation

The board is twenty cells by fifteen. Input is buffered one turn deep, so a fast double-tap around a corner registers both turns instead of dropping one. The collision test excludes the tail cell, because it moves out of the way on the same tick — without that exclusion the snake would die into its own moving tail. The game advances on a fixed 60 Hz timestep with the snake's own movement rate on top, so it plays the same on a 60 Hz and a 120 Hz display.