Getting Started
This guide will help you set up MindGames for local development.
Prerequisitesโ
- Node.js 18+
- npm or yarn
- Git
Installationโ
1. Clone the Repositoryโ
git clone https://github.com/zeroleaf/MindGames.git
cd MindGames
2. Install Dependenciesโ
npm install
3. Start Development Serverโ
npm run dev
The app will be available at http://localhost:3000.
Project Structureโ
MindGames/
โโโ src/
โ โโโ app/
โ โ โโโ layout.tsx # Root layout with providers
โ โ โโโ page.tsx # Main game page
โ โ โโโ globals.css # Global styles + Tailwind
โ โโโ components/
โ โ โโโ ChainDisplay.tsx # Problem chain UI
โ โ โโโ OperationMixSlider.tsx # Mix configuration
โ โ โโโ Timer.tsx # Countdown timer
โ โโโ contexts/
โ โ โโโ GameContext.tsx # Game state management
โ โ โโโ ThemeContext.tsx # Dark/light theme
โ โโโ lib/
โ โ โโโ problem-generator.ts # Core generation logic
โ โโโ types/
โ โโโ index.ts # TypeScript definitions
โโโ __tests__/ # Test files
โโโ jest.config.js # Jest configuration
โโโ tailwind.config.ts # Tailwind configuration
โโโ package.json
Available Scriptsโ
| Script | Description |
|---|---|
npm run dev | Start development server |
npm run build | Build for production |
npm run start | Start production server |
npm run lint | Run ESLint |
npm test | Run Jest tests |
npm run test:watch | Run tests in watch mode |
npm run test:coverage | Run tests with coverage report |
Configurationโ
Game Configurationโ
Default configuration is defined in src/types/index.ts:
export const DEFAULT_CONFIG: GameConfig = {
maxResult: 100, // Maximum result value
chainLength: 6, // Problems per chain
chainCount: 5, // Number of chains
timeLimit: 0, // Seconds (0 = no limit)
operationMix: {
add: 40,
subtract: 40,
multiply: 10,
divide: 10,
},
allowNegativeResults: false,
};
Tailwind Themeโ
Custom colors are defined in tailwind.config.ts:
colors: {
primary: {
// Indigo color scale
500: '#6366f1',
// ...
},
accent: {
// Violet color scale
500: '#8b5cf6',
// ...
},
}
Usage Guideโ
Basic Flowโ
- Configure Settings - Adjust operation mix and other settings
- Generate Worksheet - Click "Generate" to create problem chains
- Start Session - Click "Start" to begin timed practice
- Solve Problems - Enter answers and press Tab/Enter to submit
- Review Results - See score and accuracy when complete
Keyboard Navigationโ
| Key | Action |
|---|---|
Tab | Submit current answer and move to next |
Enter | Submit current answer and move to next |
| Number keys | Enter answer |
Profile Modesโ
Kid Mode:
- Encouraging messages after each chain
- Confetti celebration when all chains complete
- Fun, motivating language
Adult Mode:
- Clean, professional interface
- Focus on metrics and accuracy
- No animations or celebrations
Next Stepsโ
- Architecture - Learn about technical decisions
- Testing - Understand the test suite