A nostalgic 8-bit pixel-art Tower of Hanoi game built with Next.js, TypeScript, and Tailwind CSS. Experience the classic puzzle with retro GameBoy/NES aesthetics!
- Classic Tower of Hanoi Gameplay - Move all disks from the left peg to the right peg
- 8-Bit Pixel Art UI - Authentic retro gaming aesthetic
- Multiple Difficulty Levels - From 3 to 10 disks
- Retro Color Palettes - GameBoy, NES, and Apple II themes
- CRT Scanline Effects - Optional vintage monitor simulation
- Retro Sound Effects - 8-bit beep sounds for all actions
- Move Validation - Follows classic Tower of Hanoi rules
- Undo/Redo System - Perfect your solution
- Performance Tracking - Move counter, timer, and efficiency rating
- Keyboard & Mouse Controls - Full accessibility support
- Mobile Responsive - Play on any device
- Move all disks from the leftmost peg to the rightmost peg
- Only one disk can be moved at a time
- A disk can only be placed on top of a larger disk or on an empty peg
- The goal is to complete the puzzle in the minimum number of moves (2^n - 1)
- Click a disk to select it
- Click a destination peg to move the selected disk
- Use the on-screen buttons for game controls
- Arrow Keys - Navigate between pegs
- Enter/Space - Select/move disks
- U - Undo last move
- R - Reset current game
- Escape - Return to menu
- Node.js (18+ recommended)
- pnpm package manager
- Clone the repository:
git clone <your-repo-url>
cd tower-of-hanoi- Install dependencies:
pnpm install- Start the development server:
pnpm dev- Open your browser and navigate to
http://localhost:3000
pnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm lint- Run ESLintpnpm type-check- Run TypeScript type checking
- Authentic green monochrome palette
- Perfect for that handheld console nostalgia
- Classic Nintendo color scheme
- Warm, nostalgic gaming colors
- Monochrome green terminal aesthetic
- Vintage computer feel
- Perfect: Minimum moves (2^n - 1)
- Excellent: 80-99% efficiency
- Good: 60-79% efficiency
- Fair: 40-59% efficiency
- Needs Work: Below 40% efficiency
- Next.js 14 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- Zustand - Lightweight state management
- Web Audio API - Retro sound generation
- Press Start 2P - Authentic pixel font
src/
├── app/ # Next.js app router
│ ├── globals.css # Global styles & retro CSS
│ ├── layout.tsx # Root layout
│ └── page.tsx # Main game component
├── components/
│ ├── game/ # Game-specific components
│ │ ├── Disk.tsx # Disk component
│ │ ├── GameScreen.tsx # Main game view
│ │ ├── HUD.tsx # Heads-up display
│ │ └── Peg.tsx # Peg component
│ ├── retro/ # Retro UI components
│ │ ├── CreditsScreen.tsx
│ │ ├── MenuScreen.tsx
│ │ ├── RetroLayout.tsx
│ │ ├── SettingsScreen.tsx
│ │ ├── SplashScreen.tsx
│ │ └── VictoryScreen.tsx
│ └── ui/ # Reusable UI components
└── lib/
├── game/ # Game logic
│ ├── logic.ts # Game rules & algorithms
│ ├── store.ts # Zustand state management
│ └── types.ts # TypeScript definitions
├── audio/
│ └── sounds.ts # Retro sound effects
└── utils.ts # Utility functions
- Easy: 3 disks (7 moves optimal)
- Medium: 4 disks (15 moves optimal)
- Hard: 5 disks (31 moves optimal)
- Expert: 7 disks (127 moves optimal)
- Master: 10 disks (1023 moves optimal)
- CRT Filter: Simulates old monitor scanlines
- Pixel Perfect: Sharp pixelated rendering
- Retro Animations: 8-bit style transitions
- Glow Effects: Authentic CRT glow
- Move Sound: Satisfying click sound
- Error Sound: Buzz for invalid moves
- Victory Jingle: 8-bit fanfare
- Menu Navigation: Beepy interface sounds
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
- Press Start 2P Font - By CodeMan38
- Tower of Hanoi - Classic mathematical puzzle
- 8-bit Gaming Era - The inspiration behind this project
- Sound not working: Ensure you've interacted with the page first (browser autoplay policy)
- CRT effect performance: Disable CRT filter on lower-end devices
- Mobile responsiveness: Use landscape orientation for best experience
If you encounter any issues or have suggestions, please:
- Check existing issues
- Create a new issue with detailed information
- Include your browser and device information
Made with ❤️ and pixel-perfect attention to detail
Enjoy your journey back to the golden age of gaming! 🎮✨