Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ac-unefm/snake-game/llms.txt

Use this file to discover all available pages before exploring further.

Snake Classic Game has no manual difficulty setting. Difficulty increases automatically as your score grows — the higher your score, the faster the snake moves. Speed is governed by the tick interval: the number of milliseconds the game waits between each update cycle. A shorter tick means the snake moves more often per second, leaving you less time to react and plan.

Level formula

Your current level is derived directly from your score:
level = Math.floor(score / STEP_SCORE) + 1
With STEP_SCORE = 5, a level-up occurs every 5 points. Level 1 starts the moment a new attempt begins (score = 0) and there is no upper cap on levels — the speed cap is reached at level 8, but the level counter continues climbing.
ScoreLevel
0–41
5–92
10–143
15–194
20–245
25–296
30–347

Speed formula

The tick interval for a given score is calculated as:
tick = Math.max(MIN_TICK, BASE_TICK - (level - 1) * STEP_MS)
With the actual constants from source:
  • BASE_TICK = 130 ms — starting interval at level 1
  • MIN_TICK = 45 ms — absolute floor; the game never moves faster than this
  • STEP_MS = 12 ms — interval reduction per level-up
function getTick(score) {
  const lvl = Math.floor(score / 5) + 1;
  return Math.max(45, 130 - (lvl - 1) * 12);
}
Each level subtracts 12 ms from the interval until the 45 ms floor is hit. From that point on, extra levels no longer change the speed.

Speed table

LevelTick (ms)Cells/sec
11307.7
21188.5
31069.4
49410.6
58212.2
67014.3
75817.2
84621.7
8+45 (cap)22.2
Cells/second is calculated as 1000 / tick. The value shown for level 8+ (45 ms cap) represents the maximum attainable speed of approximately 22.2 cells per second.

Level-up notification

Every time the snake eats enough food to cross a level boundary, three things happen simultaneously:
  1. HUD colour flash — the level indicator (LVL: N) in the HUD briefly turns orange for 400 ms, then returns to its normal yellow colour.
  2. Flash message — the status area below the canvas displays LVL N — ¡MÁS RÁPIDO! for 900 ms before clearing automatically.
  3. Screen-reader announcementannounceAlert() fires an assertive aria-live announcement so assistive technology users receive the same level-up notification: “Nivel N. ¡La velocidad ha aumentado!”
Level 6 and above (tick ≤ 70 ms) is considered expert speed. The absolute minimum tick of 45 ms is reached at level 8.

How speed affects strategy

At low levels (1–3) the snake moves slowly enough that you can react turn-by-turn. As levels climb past 5, the window between one move and the next shrinks below 100 ms — faster than a typical human reaction time for a fully deliberate keypress. At the 45 ms cap you have less than a twentieth of a second per cell. Effective high-level play requires planning routes several steps ahead rather than reacting to each frame. Memorising safe looping paths, avoiding dead-end corridors, and keeping the snake’s body distributed evenly across the grid all become essential habits once the speed exceeds level 5.

Build docs developers (and LLMs) love