A fun and educational browser-based tile game where kids navigate maps, solve math challenges, and collect currency. Built with React, TypeScript, and Express.
- Tile-Based Navigation: Navigate 2D grid maps using arrow keys (like classic Zelda games)
- Math Challenges: Solve addition, subtraction, multiplication, and division problems
- Progressive Difficulty: Each completed map unlocks harder challenges with better rewards
- Boss Battles: Defeat challenging bosses to advance to the next level
- Currency System: Earn in-game currency for completing challenges
- Local Progress: Game progress saved locally with optional backend sync
math-cash/
├── packages/
│ └── shared/ # Shared TypeScript types and game logic
│ ├── src/
│ │ ├── types.ts # Game types (Player, TileMap, Challenge, etc.)
│ │ ├── utils.ts # Math utilities and helper functions
│ │ └── game-logic.ts # Map generation and game rules
│ └── package.json
├── apps/
│ ├── frontend/ # React frontend application
│ │ ├── src/
│ │ │ ├── components/ # Reusable UI components
│ │ │ ├── pages/ # Route pages (Home, Game)
│ │ │ ├── context/ # React context for game state
│ │ │ └── hooks/ # Custom React hooks
│ │ └── package.json
│ └── backend/ # Express backend API (future)
├── .github/
│ └── copilot-instructions.md
└── package.json # Workspace root
- Node.js 18+
- npm 9+
-
Clone the repository
git clone <repository-url> cd math-cash
-
Install dependencies
npm install
-
Start development servers
npm run dev
This will start:
- Frontend: http://localhost:3000
- Backend: http://localhost:3001 (when implemented)
# Install all dependencies
npm install
# Start all development servers
npm run dev
# Build all packages
npm run build
# Run all tests
npm test
# Lint all code
npm run lint
# Type check all code
npm run typecheck
# Format all code
npm run format- Start: Enter your name and begin your adventure
- Navigate: Use arrow keys to move around the tile map
- Challenges: Step on challenge tiles (📚) to solve math problems
- Boss: Find and defeat the boss tile (👑) to complete the map
- Progression: Each completed map generates a new, harder level
- Currency: Earn coins for each correct answer to track your progress
- Shared Package: Contains all game logic, types, and utilities
- Frontend: React components and game UI
- Backend: Express API for progress sync (future implementation)
- Type Safety: Strict TypeScript with runtime validation using Zod
- Accessibility: Large buttons, high contrast, keyboard navigation
- Kid-Friendly: Simple visuals, positive feedback, appropriate difficulty curves
- Performance: Efficient rendering and state management
- Define Types: Add new types to
packages/shared/src/types.ts - Implement Logic: Add game logic to
packages/shared/src/game-logic.ts - Create Components: Build UI components in
apps/frontend/src/components/ - Add Tests: Write tests for both logic and components
- Beginner: 1-5 (addition/subtraction)
- Easy: 1-10 (all operations)
- Medium: 5-20 (mixed challenges)
- Hard: 10-50 (complex problems)
- Expert: 20-100 (advanced math)
- Maps are procedurally generated based on difficulty
- Challenge density increases with difficulty
- Boss placement optimized for maximum distance from start
- Rewards scale with difficulty level
types.ts: Core game types with Zod validationutils.ts: Math utilities and helper functionsgame-logic.ts: Map generation and game rulesindex.ts: Package exports
pages/HomePage.tsx: Landing page with game start/continuepages/GamePage.tsx: Main game interface with tile mapcontext/GameContext.tsx: Global game state managementcomponents/: Reusable UI components (TileMap, Challenge Modal, etc.)
- Strict TypeScript checking
- React hooks validation
- Import order enforcement
- No unused variables
- 2-space indentation
- Single quotes
- Trailing commas
- 100-character line width
- Complete tile map rendering system
- Implement challenge modal UI
- Add keyboard navigation
- Create boss battle mechanics
- Build backend API for progress sync
- Add sound effects and animations
- Implement leaderboard system
- Follow existing code patterns and conventions
- Ensure all tests pass before submitting PRs
- Add tests for new features
- Update documentation as needed
- Use conventional commit messages
[Add your license here]