Math Adventure: An Interactive Educational Math Game for Grades 1-5
Math Adventure is a dynamic, grade-progressive educational game that helps students practice math operations through an engaging interactive interface. The game adapts to student performance, automatically advancing through grade levels as players demonstrate mastery of mathematical concepts.
The game features a carefully designed difficulty progression system that introduces new mathematical operations and larger numbers as students advance through grades 1-5. Starting with simple addition and subtraction with numbers up to 10, it gradually incorporates multiplication and division with larger numbers up to 200. The game provides immediate feedback, tracks lives and scores, and includes visual rewards for correct answers and level progression.
Game Demo
Github Repository
mohamednizzad
/
mathsadventure
This is a simple project for Amazon Q CLI Game Challenge Developed along with my kid
Math Adventure - Educational Game
A fun and educational math game designed for students in grades 1-5, built with Pygame.
Features
- Progressive difficulty levels matching grades 1-5
- Interactive and engaging gameplay
- Various math operations (addition, subtraction, multiplication, division)
- Colorful graphics and sound effects
- Score tracking and achievements
Requirements
- Python 3.7+
- Pygame
Installation
- Clone this repository
- Install requirements:
pip install -r requirements.txt
Running the Game
python src/main.py
Testing
python -m pytest tests/
Project Structure
.
โโโ src/
โ โโโ main.py
โ โโโ game.py
โ โโโ levels.py
โ โโโ utils.py
โโโ tests/
โ โโโ test_game.py
โ โโโ test_levels.py
โโโ assets/
โ โโโ fonts/
โ โโโ images/
โ โโโ sounds/
โโโ requirements.txt
โโโ README.md
Repository Structure
math-adventure/
โโโ requirements.txt # Python package dependencies (pygame, pytest)
โโโ src/
โ โโโ game.py # Core game logic, UI, and game state management
โ โโโ levels.py # Math problem generation and difficulty scaling
โ โโโ main.py # Application entry point and pygame initialization
โโโ tests/ # Test suite directory
โโโ test_game.py # Game mechanics and UI tests
โโโ test_levels.py # Math problem generation tests
Usage Instructions
Prerequisites
- Python 3.6 or higher
- pip (Python package installer)
Installation
Clone the repository:
git clone https://github.com/mohamednizzad/mathsadventure.git
cd math-adventure
Create and activate a virtual environment:
# Windows
python -m venv venv
venv\Scripts\activate
# macOS/Linux
python3 -m venv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Quick Start
Run the game:
python src/main.py
Game Controls:
- Enter numbers using the keyboard
- Press Enter to submit your answer
- Press Backspace to delete input
- Press 'R' to restart when game is over
- Press 'Q' to quit when game is over
More Detailed Examples
Grade 1 Problems:
- Addition and subtraction with numbers 1-10
- Example: "5 + 3 = ?"
Grade 2 Problems:
- Addition and subtraction with numbers 1-20
- Example: "15 - 7 = ?"
Grade 3 Problems:
- Addition, subtraction, and multiplication
- Numbers up to 50
- Example: "6 * 8 = ?"
Grade 4 Problems:
- All operations including division
- Numbers up to 100
- Example: "48 รท 6 = ?"
Grade 5 Problems:
- Advanced operations with larger numbers
- Numbers up to 200
- Example: "156 + 44 = ?"
Troubleshooting
Pygame Installation Issues:
# Windows
pip install --upgrade pip
pip install pygame --pre
# Linux
sudo apt-get install python3-pygame
Display Issues:
- Ensure your display resolution is at least 800x600
- Try updating your graphics drivers
Performance Issues:
- Check CPU usage with Task Manager/Activity Monitor
- Close other resource-intensive applications
- Verify pygame version is 2.1.0 or higher
Data Flow
The game processes math problems through a generate-solve-validate cycle, with progressive difficulty scaling based on player performance.
[User Input] -> [Problem Generator] -> [Game Logic] -> [UI Renderer]
^ |
| v
[Score/Lives Update] <- [Answer Validation] <- [Player Response]
Component Interactions:
- Problem Generator creates grade-appropriate math problems
- Game Logic manages game state and processes user input
- UI Renderer displays problems and feedback
- Answer Validation checks responses and updates game state
- Score/Lives system tracks player progress
- Grade progression system monitors score thresholds
- Feedback system provides immediate response to player actions
Bonus
Checkout my article that won the Amazon Q Developer Challenge
Top comments (0)