Skip to content

herunan/mastermind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Daily Mastermind ๐ŸŽฏ

A beautiful, modern take on the classic Mastermind code-breaking game. Play a new puzzle every day!

๐ŸŽฎ Play Now | ๐ŸŒŸ Live Demo

Daily Mastermind Game React Vite Tailwind CSS

โœจ Features

Core Gameplay

  • ๐ŸŽจ 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

Premium UX

  • ๐ŸŒ™ 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

๐Ÿš€ Quick Start

Play Online

Visit heavenly-sugar.surge.sh to play instantly!

Run Locally

# 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

๐ŸŽฎ How to Play

  1. Select 4 colors from the palette to make your guess
  2. Submit your guess
  3. Check feedback:
    • ๐Ÿ”ด Red dot = Correct color in correct position
    • โšช White dot = Correct color in wrong position
  4. Keep guessing until you crack the code or run out of attempts!
  5. Share your results with friends

๐Ÿ› ๏ธ Tech Stack

  • Framework: React 18.3 with Hooks
  • Build Tool: Vite 7.2
  • Styling: Tailwind CSS v4
  • State Management: React Hooks + localStorage
  • Deployment: Surge.sh

๐Ÿ“ Project Structure

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

๐ŸŽจ Key Features Explained

Daily Code Generation

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
};

Local Storage Persistence

Game state is automatically saved and restored:

  • Current guesses
  • Game status (playing/won/lost)
  • Tied to the current date

Share Functionality

Results are formatted as emoji grid for easy sharing:

Daily Mastermind 11/19/2025
6/10

๐Ÿ”ด๐Ÿ”ดโšช
๐Ÿ”ด๐Ÿ”ด๐Ÿ”ด
๐Ÿ”ด๐Ÿ”ด๐Ÿ”ด๐Ÿ”ด

๐Ÿšข Deployment

Deploy to Surge

# Build the project
npm run build

# Deploy to Surge
npx surge ./dist your-subdomain.surge.sh

Deploy to Vercel/Netlify

The project is ready for deployment on any static hosting platform. Just build and deploy the dist folder.

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • ๐Ÿ› Report bugs
  • ๐Ÿ’ก Suggest new features
  • ๐Ÿ”ง Submit pull requests

๐Ÿ“„ License

MIT License - feel free to use this project for learning or personal use.

๐ŸŽฏ Future Enhancements

  • 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

About

Daily Mastermind puzzle game - crack the code every day! Built with React and Tailwind CSS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •