Score {{ hudValue('score', 0) }}
Length {{ hudValue('length', 4) }}
Food {{ hudValue('food', 0) }}
Pace {{ hudValue('pace', 'Medium') }}
{{ playTextState }}

{{ feedbackText }}

Snake turns open space into a shrinking route-planning problem. Each food pickup makes the body one cell longer, so a turn that looks harmless early in a run can close the only exit later.

The head moves on a rectangular grid and the body follows its exact path. A direct reverse turn is ignored because it would send the head into the next body segment. Useful steering therefore comes from planning two or three turns ahead, especially near a wall or a loop in the tail.

Snake route choices and their consequences
ChoiceWhat changesMain risk
Open routeLeaves several turns availableA longer trip to the next food
Tight loopShortens the pathThe head can meet the body before the tail clears
Wrap edgeContinues from the opposite sideThe re-entry cell may already be occupied
Solid edgeStops movement at the borderTouching the border ends the run

Speed changes how much thinking time fits between moves, not the scoring rule. Wall behavior changes the legal route itself. Scores from different pace and wall settings therefore describe different challenges even when the food count matches.

A seed fixes food placement, which makes the same route available for another attempt. The replay remains exact only when the pace, wall rule, and ordered turns also stay the same. Random-looking food positions are repeatable practice conditions, not evidence that one seed is easier in every possible run.

How to Use This Tool:

Set the board rule first, then steer for open space rather than only chasing the nearest food.

  1. Choose Pace and decide whether Walls wrap to the opposite edge or end the run on contact.
  2. Enter a Run seed and start the game. Save that seed when you want to practise the same food placements.
  3. Turn with the arrow keys or WASD, swipe across the board, or use the touch pad. Press P or Space to pause when keyboard input belongs to the game.
  4. Review Score, Food, Length, and Level after a wall collision, self-collision, or cleared board. Retry the same route before changing the seed if you want a fair route comparison.

Interpreting Results:

Score, food, and growth are different views of the same progress because each pickup adds 10 points and one body cell. Level changes every five pickups, so it is a compact progress marker rather than a separate performance score.

The ending reason carries the useful diagnosis. A wall collision applies only to solid edges; a self-collision means the planned route closed before the tail moved away. Compare two runs only when pace, wall rule, and seed match, then use the higher food count or later collision as evidence of a better turn sequence.

Technical Details:

The board contains 24 columns and 16 rows. A run begins with four occupied cells, moving right. Food is placed on an unoccupied cell from a seeded sequence; filling every cell leaves no legal food position and clears the board.

Formula Core

One pickup changes score, length, and level together. These equations make the displayed totals auditable.

S=10F , L=4+F , V=1+F5

F is food collected, S is score, L is snake length, and V is level. Five pickups therefore produce 50 points, length 9, and level 2.

The simulation advances in 100 millisecond fixed ticks. Slow moves every 3 ticks, Medium every 2, and Fast every tick, giving nominal move intervals of 300 ms, 200 ms, and 100 ms respectively.

Rule Core

Snake movement and collision rules
RuleExact behavior
Turn queueThe most recent legal turn is applied at the next grid move; an immediate reverse is ignored.
Normal movementA new head cell is added and the tail cell is removed.
Food movementThe new head remains while the tail stays in place, increasing length by one.
Self-collisionThe run ends when the new head overlaps the body, excluding a tail cell that moves away on the same non-growth step.
Wrap edgeCoordinates continue from the opposite edge before body collision is checked.
Solid edgeA head coordinate outside the 24 by 16 grid ends the run immediately.

Pausing stops fixed ticks and clears any queued turn. A same-seed replay reproduces food placement only when the same settings and action order are used; changing pace changes when queued turns reach the movement step.