Snake Lab Inefy interactive lab / Grid run
Game guide

Snake Lab

Canvas Snake with timed movement, buffered keyboard/touch input, food, growth, collisions, pace changes, and best scores.

Status
Archived experiment / live demo
Last updated
May 2026
Back to Interactive Lab
Controls
Steer, collect food, avoid walls/body, and survive as pace increases.
Keyboard
Arrow/WASD turn, Space/P/Escape pauses, and Enter starts or resumes.
Touch
Swipe on the canvas or use the large on-screen direction pad.
Accessibility
Score, best score, length, pace, and live run status are readable outside the canvas.
Score 0
Best 0
Length 4
Pace 1.0x

Ready

Snake Lab ready.

Control reference

Keyboard and touch controls

Keyboard shortcuts

  • Arrow keysTurn the snake up, right, down, or left.
  • W A S DAlternate direction keys for movement.
  • SpaceStart from idle or pause and resume during a run.
  • EnterStart or resume when the game is not actively playing.
  • P / EscPause or resume a live run.

Touch controls

  • SwipeSwipe on the canvas to turn in that direction.
  • Direction padUse the four large movement buttons below the canvas.
  • Tap canvasStart a run from the idle menu.
Implementation notes

Grid state, buffered turns, and pace feedback.

Main state tracks segments, direction, food, score, pace, and run state. One timed step moves, collides, grows, and saves.

What I built

Grid movement, input buffering, and compact run feedback.

The classic Snake rules are the reference point; the rendering, state model, controls, and HUD are custom JavaScript.

Production readiness

Archived experiment with solid grid state.

Solid: deterministic movement, buffered input, collisions, best score, and keyboard/touch controls. Hardening: turn/collision tests, save reset, screen-reader alternatives, and mobile QA.

Deployment and run notes

Static browser game with no runtime secrets.

GitHub Pages serves snake-lab.html, snake-lab.css, and snake-lab.js. No env vars or external APIs beyond browser APIs and LocalStorage. Local: run python -m http.server 8000 and open /snake-lab.html.

Keep exploring

More grid-state experiments

Compare buffered grid input with the other demos and main case studies.