Skip to content

Classic Snake game rebuilt with React. Uses a Queue for smooth movement and HTML5 Canvas for a retro, responsive experience.

Notifications You must be signed in to change notification settings

real-devance/retro-snake-react

Repository files navigation

Retro Snake 🐍

Welcome to Retro Snake Game, a nostalgic revival of the classic Snake game! Built with React and inspired by LeetCode's "353. Design Snake Game" problem,.

🕹️ Live Demo

🌟 Features

  • 🗺️ Multiple map options for varied gameplay
  • 📏 Adjustable board sizes to suit your style
  • 🎮 On-screen arrow buttons for easy mobile play
  • 🚀 Dynamic speed increases as your snake grows
  • 📊 Local storage for high scores

🛠️ Under the Hood

Custom Hooks

  • useLocalStorage.ts: Keeps your high scores safe and sound
  • useQueue.ts: Manages the snake's movement with queue magic
  • useRAF.ts: Ensures buttery-smooth animations
  • useRadioState.ts: Handles those pesky radio button states

Context API

  • Score Context: Keeps tabs on your growing score
  • Game Config Context: Manages all your game settings in one place

🚀 Get It Running

# Clone 
git clone https://github.com/real-devance/retro-snake-react.git

# Dive into the project
cd retro-snake-react

# Install 
npm install

# run
npm run dev

🧰 Tech Stack

  • ⚛️ React
  • 📜 TypeScript
  • 🎨 Tailwind CSS
  • 🎮 HTML5 Canvas
  • ⚡ Vite
  • 🧪 Vitest

Acknowledgements

LeetCode's 353 Design Snake Game

About

Classic Snake game rebuilt with React. Uses a Queue for smooth movement and HTML5 Canvas for a retro, responsive experience.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published