Play Snake Online
Play the classic Snake game in your browser—no download, no sign-up. Steer the snake around the board, eat food to grow, and avoid crashing into yourself (and walls, in Walls mode). Try to maximize your score and combo while the speed ramps up.
Game Rules
- The game is played on a 20×20 grid.
- You control a moving snake using the arrow keys or WASD.
- When the snake’s head reaches a food cell:
- The snake grows by one segment.
- You gain points.
- The game ends when:
- The snake hits its own body, or
- In Walls mode, the snake hits the border of the board.
Modes:
- Classic mode – The snake wraps around edges (left ↔ right, top ↔ bottom).
- Walls mode – Borders are solid; hitting them causes game over.
Controls
- Arrow keys or WASD – Change snake direction:
- Up:
↑orW - Down:
↓orS - Left:
←orA - Right:
→orD
- Up:
- Space – Pause/resume (planned for future enhancement).
- R – Restart the game instantly.
Direction changes:
- You cannot reverse directly (e.g. going right → left in a single step).
- Only one direction change is applied per movement tick.
Speed & Difficulty
Speed levels:
- Easy – Slow speed (≈150ms per tick).
- Medium – Normal speed (≈100ms).
- Hard – Fast (≈70ms).
- Extreme – Very fast (≈50ms).
Dynamic difficulty:
- Every 5 foods eaten:
- The movement interval decreases slightly (snake speeds up).
- Speed is always capped at a minimum of 40ms (very fast).
You can change the speed level before starting a run; speed adjustments then apply on top of that base level as you eat more food.
Scoring & Combos
- Base score per food: 10 points.
- Combo system:
- If you eat food within 3 seconds of the previous one:
- Your combo multiplier increases by 1.
- Score gained per food:
score += 10 × comboMultiplier
- Combo resets to 1 if:
- You wait too long (no food within 3 seconds), or
- The game ends.
- If you eat food within 3 seconds of the previous one:
- The UI shows:
- Current combo (
×N) - Highest combo reached this run.
- Current combo (
High Scores
High scores are stored locally in your browser using localStorage:
- Best score (highest total score).
- Best combo (highest combo multiplier).
- Best speed level (fastest base speed at which you set a record).
Scores are persistent per browser, but not shared or synced between devices.
Strategy Tips
- Plan ahead – Don’t just chase the nearest food; avoid boxing yourself in.
- Use walls/wrap smartly:
- In Classic mode, wrapping lets you escape tight spots.
- In Walls mode, treat the border as an obstacle you must never touch.
- Manage your speed – As the snake speeds up, prioritize survival over a risky combo.
- Control the tail – Leave yourself escape routes; try not to create closed loops you can’t exit.
Why Play Snake Online?
This Snake implementation is:
- Fast and responsive – runs fully client-side.
- Flexible – mode and speed controls let you tailor the challenge.
- Rewarding – combo scoring, increasing difficulty, and local high scores keep it interesting.
Open the game, pick your mode and speed, and see how long you can survive!