A beautiful, modern take on the classic Mastermind code-breaking game. Play a new puzzle every day!
๐ฎ Play Now | ๐ Live Demo
- ๐จ 6 Colors, 4 Positions - Classic Mastermind rules
- ๐ฏ 10 Attempts - Crack the code before you run out of guesses
- ๐ Daily Puzzle - New challenge every day with date-based seeding
- ๐ด Smart Feedback - Red dots for correct position, white for correct color
- ๐พ Auto-Save - Your progress is saved automatically
- ๐ค Share Results - Copy your game results as emoji grid
- ๐ Dark Theme - Beautiful glassmorphism design
- โจ Smooth Animations - Polished micro-interactions
- ๐ฑ Fully Responsive - Perfect on mobile and desktop
- โ How to Play - Interactive tutorial with examples
- ๐ Secret Reset - Tap modal background 4 times to replay
Visit heavenly-sugar.surge.sh to play instantly!
# Clone the repository
git clone https://github.com/YOUR_USERNAME/mastermind.git
cd mastermind
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build- Select 4 colors from the palette to make your guess
- Submit your guess
- Check feedback:
- ๐ด Red dot = Correct color in correct position
- โช White dot = Correct color in wrong position
- Keep guessing until you crack the code or run out of attempts!
- Share your results with friends
- Framework: React 18.3 with Hooks
- Build Tool: Vite 7.2
- Styling: Tailwind CSS v4
- State Management: React Hooks + localStorage
- Deployment: Surge.sh
mastermind/
โโโ src/
โ โโโ components/
โ โ โโโ Board.jsx # Game grid
โ โ โโโ Row.jsx # Single guess row
โ โ โโโ Peg.jsx # Color peg component
โ โ โโโ ColorSelector.jsx # Color input interface
โ โ โโโ GameStatusModal.jsx # Win/Loss modal
โ โ โโโ HowToPlayModal.jsx # Tutorial modal
โ โโโ hooks/
โ โ โโโ useDailyGame.js # Game state management
โ โโโ utils/
โ โ โโโ gameLogic.js # Core game logic
โ โโโ App.jsx # Main app component
โ โโโ main.jsx # Entry point
โโโ public/ # Static assets
โโโ dist/ # Production build
Uses a seeded random number generator based on the current date, ensuring everyone gets the same puzzle each day:
const generateDailyCode = () => {
const today = new Date();
const seed = `${today.getFullYear()}${today.getMonth() + 1}${today.getDate()}`;
// ... seeded random logic
};Game state is automatically saved and restored:
- Current guesses
- Game status (playing/won/lost)
- Tied to the current date
Results are formatted as emoji grid for easy sharing:
Daily Mastermind 11/19/2025
6/10
๐ด๐ดโช
๐ด๐ด๐ด
๐ด๐ด๐ด๐ด
# Build the project
npm run build
# Deploy to Surge
npx surge ./dist your-subdomain.surge.shThe project is ready for deployment on any static hosting platform. Just build and deploy the dist folder.
Contributions are welcome! Feel free to:
- ๐ Report bugs
- ๐ก Suggest new features
- ๐ง Submit pull requests
MIT License - feel free to use this project for learning or personal use.
- Statistics tracking (win rate, streak)
- Difficulty levels (more colors, positions)
- Multiplayer mode
- Leaderboard
- Custom color schemes
- Sound effects
Built with โค๏ธ using React and Tailwind CSS
Live Demo โข Report Bug โข Request Feature