Skip to main content

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โ€‹

ScriptDescription
npm run devStart development server
npm run buildBuild for production
npm run startStart production server
npm run lintRun ESLint
npm testRun Jest tests
npm run test:watchRun tests in watch mode
npm run test:coverageRun 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โ€‹

  1. Configure Settings - Adjust operation mix and other settings
  2. Generate Worksheet - Click "Generate" to create problem chains
  3. Start Session - Click "Start" to begin timed practice
  4. Solve Problems - Enter answers and press Tab/Enter to submit
  5. Review Results - See score and accuracy when complete

Keyboard Navigationโ€‹

KeyAction
TabSubmit current answer and move to next
EnterSubmit current answer and move to next
Number keysEnter 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โ€‹