Skip to content

justshobee/math-game

Repository files navigation

⚡ C++ Math Game

GitHub stars GitHub forks GitHub issues GitHub license

A simple command-line math game that challenges players with randomly generated arithmetic questions, testing their speed and accuracy.

📖 Overview

This repository hosts a command-line math game developed in C++. The game is designed to help players practice and improve their basic arithmetic skills across addition, subtraction, multiplication, and division. It dynamically generates random math questions, prompts the user for answers, and evaluates their performance based on both speed and accuracy. The project includes two distinct solutions: an instructor's version and a personal solution, offering different implementations of the core game logic.

✨ Features

  • Random Question Generation: Dynamically creates a wide range of math problems.
  • Multiple Arithmetic Operations: Supports addition (+), subtraction (-), multiplication (*), and division (/).
  • Player Speed Test: Measures the time taken to answer questions.
  • Accuracy Tracking: Verifies user answers and provides feedback on correctness.
  • Interactive Command-Line Interface: Engages players through a simple, text-based console.
  • Two Solution Implementations: Includes separate directories for an "Instructor's Solution" and a "My Solution" for comparison or alternative approaches.

🛠️ Tech Stack

  • Language: C++
  • Runtime: Standard C++ Environment
  • Build Tool: GNU Compiler Collection (GCC) or Clang (or any compatible C++ compiler)

🚀 Quick Start

To get a copy of the project up and running on your local machine, follow these steps.

Prerequisites

  • A C++ compiler (e.g., g++ for GCC, clang++ for Clang, or MSVC on Windows).

Installation

  1. Clone the repository
    git clone https://github.com/Choubi-Mohammed/math-game.git
    cd math-game

Building and Running the Game

This repository contains two separate solutions. You can build and run either one using the following instructions.

1. Instructor's Solution

This solution is located in the Project 2 [ Math Game ] ( Instructor's Solution ) directory.

  1. Navigate to the instructor's solution directory:

    cd "Project 2 [ Math Game ] ( Instructor's Solution )"
  2. Compile the source code: Assuming the main source file is main.cpp (common for simple C++ projects):

    g++ main.cpp -o math-game-instructor

    If main.cpp is not found, you may need to list the .cpp files in the directory and compile them together, e.g., g++ file1.cpp file2.cpp -o math-game-instructor.

  3. Run the game:

    ./math-game-instructor

2. My Solution

This solution is located in the Project 2 [ Math Game ] ( My Solution ) directory.

  1. Navigate to your solution directory:

    cd "../Project 2 [ Math Game ] ( My Solution )"
  2. Compile the source code: Assuming the main source file is main.cpp:

    g++ main.cpp -o math-game-my-solution

    As above, adjust the .cpp file names if different.

  3. Run the game:

    ./math-game-my-solution

📁 Project Structure

math-game/
├── Project 2 [ Math Game ] ( Instructor's Solution )/  # Instructor's implementation of the game
│   └── main.cpp                                       # (Assumed) C++ source file for instructor's solution
├── Project 2 [ Math Game ] ( My Solution )/           # My personal implementation of the game
│   └── main.cpp                                       # (Assumed) C++ source file for my solution
└── README.md                                          # This README file

(Note: The main.cpp files are assumed entry points within their respective solution directories. Actual filenames might vary.)

📖 Usage

Once the game executable is running:

  1. The game will present you with a series of randomly generated math questions.
  2. Input your answer and press Enter.
  3. The game will provide feedback on whether your answer was correct or incorrect.
  4. At the end of the game (number of questions not explicitly configured, but usually a fixed set or until the player quits), your overall score and performance (accuracy and speed) will be displayed.

⚙️ Configuration

This project does not include explicit configuration files (e.g., .env or dedicated config files) outside of the C++ source code. Any game parameters such as number of questions, difficulty level, or types of operations would be hardcoded within the main.cpp or related source files of each solution.

To modify game behavior, you would need to:

  1. Edit the respective C++ source files (main.cpp or others within the solution folders).
  2. Recompile the game executable using the build steps described in the Building and Running the Game section.

🤝 Contributing

Contributions are welcome! If you have suggestions for improvements, new features, or bug fixes, please open an issue or submit a pull request.

Development Setup

  1. Fork the repository.
  2. Clone your forked repository:
    git clone https://github.com/YOUR_USERNAME/math-game.git
    cd math-game
  3. Choose which solution you'd like to work on (Instructor's or My Solution).
  4. Make your changes to the C++ source files.
  5. Recompile and test your changes locally (refer to Building and Running the Game).
  6. Commit your changes and push them to your fork.
  7. Open a pull request to the master branch of the original repository.

📄 License

This project is licensed under the [TODO: Insert License Name Here] - see the LICENSE file for details.

🙏 Acknowledgments

  • Choubi-Mohammed - The original author and maintainer of this project.

📞 Support & Contact


⭐ Star this repo if you find it helpful!

Made with ❤️ by Choubi-Mohammed

About

A simple command-line math game where the player answers randomly generated math questions. The program tests the player’s speed and accuracy in basic arithmetic operations, including addition, subtraction, multiplication, and division.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages