A polished browser-based Snake game built with TypeScript, Vite, and HTML Canvas. The game keeps the core model separate from rendering so movement, food spawning, collision checks, and state transitions are covered by unit tests.
- TypeScript
- Vite
- HTML Canvas
- Vitest
- Local storage for high score persistence
npm install
npm run devnpm run buildnpm run test:run- Arrow keys or WASD: change direction
- Space: pause or resume
- Enter or R: restart
- Grid-based Snake movement
- Food spawning away from the snake
- Growth and scoring after eating
- Wall and self-collision game over
- Pause, resume, and restart
- Difficulty increases as score grows
- Responsive canvas layout
- Persistent high score
- Add sound effects with a mute toggle
- Add touch controls for mobile
- Add selectable board sizes
- Add a compact leaderboard stored locally