https://github.com/duaa-a/multi-gameboard-engine
A robust, object-oriented game engine that supports multiple board games
https://github.com/duaa-a/multi-gameboard-engine
cpp gameboard oops-in-cpp tic-tac-toe xo
Last synced: 11 months ago
JSON representation
A robust, object-oriented game engine that supports multiple board games
- Host: GitHub
- URL: https://github.com/duaa-a/multi-gameboard-engine
- Owner: DuaA-A
- Created: 2025-01-02T18:27:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-02T19:23:10.000Z (about 1 year ago)
- Last Synced: 2025-01-22T13:52:49.054Z (about 1 year ago)
- Topics: cpp, gameboard, oops-in-cpp, tic-tac-toe, xo
- Language: C++
- Homepage: https://github.com/DuaA-A
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Multi-GameBoard-Engine
A robust, object-oriented game engine that supports multiple board games, including
advanced versions of Tic Tac Toe and Four in a Row, with flexible player configurations.
This project leverages C++ to deliver a scalable framework for creating and managing board games
for two or more players.
Features
-
Multi-Game Support: Includes standard Tic Tac Toe, 5x5 Tic Tac Toe,
Pyramid Tic Tac Toe, and Four in a Row. -
Customizable Players: Allows different types of players, including
human players and AI bots (e.g., RandomPlayer). -
Flexible Game Rules: Configurable game board sizes and winning conditions. -
Object-Oriented Design: Modular classes for managing game boards, players,
and game logic independently. -
Scalable Player Count: Supports games with more than two players, adding variety and complexity.
Project Structure
Multi-GameBoard-Engine/
├── src/
│ ├── main.cpp # Entry point of the program
│ ├── X_O_Board.cpp # Logic for standard Tic Tac Toe
│ ├── X_O_5x5_Board.cpp # Logic for 5x5 Tic Tac Toe
│ ├── PyramidTicTacToe.cpp # Logic for Pyramid Tic Tac Toe
│ ├── FourInARow.cpp # Logic for Four in a Row
│ ├── RandomPlayer.cpp # AI player logic
│ ├── Player.cpp # Player interface implementation
│ ├── GameManager.cpp # Game management logic
├── include/
│ ├── BoardGame_Classes.hpp # Base classes and interfaces
│ ├── genericBoardGame.hpp # Generic board game utilities
│ ├── GameManager.hpp # Game management interface
├── build/
│ └── ... # Compiled binaries
└── README.html # Project documentation
Supported Games
-
Standard Tic Tac Toe: The classic 3x3 board with two players. -
5x5 Tic Tac Toe: A larger version with increased complexity. -
Pyramid Tic Tac Toe: A unique twist with a triangular board. -
Four in a Row: Connect four pieces in a row to win.
Code Explanation
The engine uses a modular architecture where each game board type, player type,
and game manager is implemented in separate classes to ensure extensibility.
For example:
-
GameManager: Manages the game loop, player turns, and win/draw detection. -
Board: Encapsulates game board states and updates. -
Player: Abstracts player behavior, allowing custom implementations like AI.
Example Snippet
void GameManager::run() {
int x, y;
boardPtr->display_board();
while (!boardPtr->game_is_over()) {
for (int i = 0; i < player_count; ++i) {
players[i]->get_move(x, y);
while (!boardPtr->update_board(x, y, players[i]->get_symbol())) {
players[i]->get_move(x, y);
}
boardPtr->display_board();
if (boardPtr->is_winner()) {
cout << players[i]->to_string() << " wins\n";
return;
}
if (boardPtr->is_draw()) {
cout << "Draw!\n";
return;
}
}
}
}
Getting Started
Prerequisites
- A C++ compiler supporting C++11 or higher.
- A text editor or IDE for C++ development.
Building and Running
- Clone the repository:
git clone https://github.com/your-username/Multi-GameBoard-Engine.git
- Navigate to the directory:
cd Multi-GameBoard-Engine
- Compile the code:
g++ -std=c++11 src/main.cpp -o build/MultiGameEngine
- Run the game:
./build/MultiGameEngine
Future Enhancements
- Add more AI strategies for competitive gameplay.
- Include visual enhancements with a GUI.
- Support custom rules for more game variations.
Contributing
Contributions are welcome! Feel free to fork the repository and submit pull requests
for new features or bug fixes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Authors
Duaa AbdelAti
AbdelRahman Ashraf
Roaa Sabry
Feel free to reach out with questions or suggestions!