A comprehensive C++ board game collection featuring 13 unique game variants, built with object-oriented programming principles. This project demonstrates advanced OOP concepts including inheritance, polymorphism, templates, and design patterns.
- Overview
- Features
- Game Variants
- Architecture
- Technologies Used
- Getting Started
- Project Structure
- Documentation
- Contributing
The Board Game Center is an interactive console application that brings together multiple board game variants in a single, unified platform. Built entirely in C++, it showcases professional software engineering practices with a clean, extensible architecture that makes adding new games straightforward.
The project features:
- 13 different game variants ranging from classic Tic-Tac-Toe to unique variations
- Object-oriented design with templated base classes for maximum code reuse
- Interactive menu system with colorized console output
- Multiple player modes including Human vs Human, Human vs AI, and AI vs AI
- Professional documentation using Doxygen
- Modular architecture that separates game logic, UI, and player management
- ๐จ Colorized Console Interface - Enhanced user experience with ANSI color codes
- ๐ค AI Players - Multiple AI difficulty levels for single-player experience
- ๐ฒ Random Player Mode - Computer players that make random valid moves
- โจ๏ธ Keyboard Navigation - Arrow key support for menu navigation
- ๐ Game Selection Menu - Easy switching between different game variants
- ๐ Win/Loss/Draw Detection - Automatic game state tracking
- ๐ฏ Move Validation - Intelligent validation for all game types
- Generic templated base classes (
Board<T>,Player<T>,UI<T>) - Factory pattern for dynamic game instantiation
- Separation of concerns (Game logic, UI, Player management)
- Extensive inline documentation
- Clean code principles and consistent naming conventions
The Board Game Center includes 13 unique game variants:
Players use numbers instead of X's and O's. Player 1 uses odd numbers (1, 3, 5, 7, 9) and Player 2 uses even numbers (2, 4, 6, 8). The goal is to create a line that sums to 15.
A larger 4ร4 grid where players need to align 4 symbols in a row, column, or diagonal to win. More strategic depth than traditional 3ร3.
A reverse variant where the objective is to avoid getting three in a row. The first player to create three in a row loses!
Players can move their existing pieces after all pieces are placed, creating an endless strategic game where positions constantly shift.
An expanded 5ร5 board where players compete to create sequences of their symbol, adding complexity and strategic options.
Players place S's and U's attempting to create the sequence "SUS" in any direction. A unique word-based twist on traditional gameplay.
Features a diamond-shaped board layout, requiring players to adapt their strategies to the unique geometry.
A triangular/pyramid-shaped board where the playing area is arranged in pyramid layers, offering a fresh spatial challenge.
The board contains randomly placed obstacles that block certain positions, forcing players to adapt their strategies dynamically.
A meta-game consisting of 9 small Tic-Tac-Toe boards arranged in a 3ร3 grid. Your move determines which board your opponent must play on next.
The classic gravity-based game where players drop tokens into columns, trying to align 4 tokens horizontally, vertically, or diagonally.
Players form words on the board, combining wordplay with strategic positioning for a unique challenge.
A memory-based variant where players must remember positions and make strategic decisions based on hidden information.
The project follows a clean, object-oriented architecture with three main layers:
template <typename T> class Board- Manages game board state
- Provides virtual methods for game logic
- Handles move validation and game state checks
template <typename T> class Player- Represents a player (Human, AI, Random, Computer)
- Manages player symbols and turn logic
- Handles move input based on player type
template <typename T> class UI- Manages user interaction and display
- Handles player setup and game flow
- Provides game-specific input/output
Each game variant provides:
[Game]_Board- Inherits fromBoard<char>with specific game rules[Game]_UI- Inherits fromUI<char>for game-specific interactions- Custom win/draw/lose conditions
- Specialized display and validation logic
The GameManager class orchestrates:
- Player turns and move processing
- Win/draw/lose detection
- Game loop control
- State management
- Factory Pattern - Dynamic game instantiation using lambda factories
- Template Method Pattern - Base game flow with customizable steps
- Strategy Pattern - Different player types (Human, AI, Random)
- Polymorphism - Virtual methods for game-specific behavior
- Language: C++ (C++11 and later)
- Platform: Cross-platform console application (Windows/Linux)
- Libraries:
- Standard Template Library (STL)
<conio.h>for keyboard input (Windows)- ANSI escape codes for terminal styling
- Documentation: Doxygen
- Build Tools: C++ compiler (g++, MSVC, or Clang)
- C++ compiler supporting C++11 or later (g++, MSVC, Clang)
- Terminal/Console with ANSI color support (recommended)
- Windows environment for
<conio.h>features (or alternative for Linux)
# Create a build directory
mkdir build
cd build
# Generate build files
cmake ..
# Build the project
cmake --build .This will compile all source files and create the GameCenter executable in the build directory.
makeThis will compile all source files and create the GameCenter executable.
g++ -std=c++11 -Iinclude src/*.cpp -o GameCentercl /EHsc /std:c++11 /Iinclude src\*.cpp /Fe:GameCenter.exe# If built with CMake
./build/GameCenter # Linux/Mac
build\GameCenter.exe # Windows
# If built with Make or manual compilation
./GameCenter # Linux/Mac
GameCenter.exe # Windows- Launch the application - You'll see a colorized welcome menu
- Navigate - Use arrow keys (โ/โ) to select a game
- Select a game - Press Enter to start your chosen game
- Setup players - Choose player types (Human, AI, Random, Computer)
- Play - Follow on-screen prompts to make moves
- Repeat - Return to the menu to try different games
- Human: Manual input for each move
- Computer: Basic AI that makes strategic moves
- Random: Makes random valid moves
- AI: Advanced AI with improved decision-making
GameBoards/
โโโ include/ # Header files
โ โโโ BoardGame_Classes.h # Base template classes
โ โโโ Menu.h # Menu system header
โ โโโ console_style.hpp # Terminal styling utilities
โ โโโ XO_Classes.h # Standard Tic-Tac-Toe
โ โโโ Numerical_Classes.h # Numerical variant
โ โโโ 4X4_Classes.h # 4ร4 grid variant
โ โโโ 5X5_Classes.h # 5ร5 grid variant
โ โโโ Misere_XO_Classes.h # Reverse rules variant
โ โโโ Infinity_Classes.h # Movable pieces variant
โ โโโ SUS_Classes.h # Sequence game variant
โ โโโ Diamond_Classes.h # Diamond board variant
โ โโโ Pyramid_Classes.h # Pyramid board variant
โ โโโ Dynamic_Obstacle_Classes.h # Obstacle variant
โ โโโ Ultimate_Classes.h # Meta-game variant
โ โโโ ConnectFour_Classes.h # Connect Four game
โ โโโ Word_Classes.h # Word formation variant
โ โโโ Memory_Classes.h # Memory-based variant
โ
โโโ src/ # Source files
โ โโโ main.cpp # Main entry point and game registry
โ โโโ Menu.cpp # Menu system implementation
โ โโโ XO_Classes.cpp # Standard Tic-Tac-Toe
โ โโโ Numerical_Classes.cpp # Numerical variant
โ โโโ 4X4_Classes.cpp # 4ร4 grid variant
โ โโโ 5X5_Classes.cpp # 5ร5 grid variant
โ โโโ Misere_XO_Classes.cpp # Reverse rules variant
โ โโโ Infinity_Classes.cpp # Movable pieces variant
โ โโโ SUS_Classes.cpp # Sequence game variant
โ โโโ Diamond_Classes.cpp # Diamond board variant
โ โโโ Pyramid_Classes.cpp # Pyramid board variant
โ โโโ Dynamic_Obstacle_Classes.cpp # Obstacle variant
โ โโโ Ultimate_Classes.cpp # Meta-game variant
โ โโโ ConnectFour_Classes.cpp # Connect Four game
โ โโโ Word_Classes.cpp # Word formation variant
โ โโโ Memory_Classes.cpp # Memory-based variant
โ
โโโ docs/ # Documentation
โ โโโ Doxyfile # Doxygen configuration
โ โโโ html/ # Generated API documentation
โ
โโโ CMakeLists.txt # CMake build configuration
โโโ Makefile # Make build configuration (alternative)
โโโ README.md # Project documentation
include/BoardGame_Classes.h: Contains the generic base classes (Board<T>,Player<T>,UI<T>,GameManager<T>)src/main.cpp: Main application logic with game factory registryinclude/Menu.h/src/Menu.cpp: Interactive menu system with keyboard navigationinclude/console_style.hpp: ANSI color codes and terminal formattinginclude/[Game]_Classes.h/src/[Game]_Classes.cpp: Each game variant's implementationCMakeLists.txt: CMake build configuration for cross-platform compilationMakefile: Make build automation (alternative build method)
The project uses Doxygen for comprehensive API documentation. To generate:
cd docs
doxygen DoxyfileDocumentation will be generated in the docs/html/ directory. Open docs/html/index.html in a browser to view.
All classes and functions are extensively documented with:
- Detailed descriptions
- Parameter explanations
- Return value documentation
- Usage examples where applicable
- Implementation notes
- Class hierarchies - Visual inheritance diagrams
- Call graphs - Function relationship visualization
- File dependencies - Include file relationships
- Detailed method documentation - Every public and protected method
This project was developed as part of an OOP assignment. Contributions, suggestions, and feedback are welcome!
- Follow the existing code style and naming conventions
- Document all new classes and methods using Doxygen format
- Ensure new games implement all required virtual methods
- Test thoroughly before submitting changes
- Update this README if adding new features or games
To add a new game variant:
- Create
include/[YourGame]_Classes.handsrc/[YourGame]_Classes.cpp - Implement
[YourGame]_Board : public Board<char> - Implement
[YourGame]_UI : public UI<char> - Add factory functions to the
gamesvector insrc/main.cpp - Add game name to the
optionsvector - Add the new source file to
CMakeLists.txtin the SOURCES list - Compile using
cmakeormakeand test
- Total Lines of Code: 6,000+ lines
- Number of Classes: 39+ classes
- Game Variants: 13 unique games
- Languages: C++ with extensive STL usage
- Documentation: Comprehensive Doxygen comments
This project demonstrates:
- Object-Oriented Programming - Inheritance, polymorphism, encapsulation
- Generic Programming - Template classes and functions
- Design Patterns - Factory, Strategy, Template Method
- Code Organization - Separation of concerns, modular design
- Software Documentation - Professional documentation practices
- User Interface Design - Console-based interactive applications
This project is part of an academic assignment. Please check with the repository owner regarding usage and licensing.
- Mohammad Abdulhakim - @MohammadAbdulhakim
- Amr Tamer - @AmrTamer117
- Shaza Mosad
- Ali Mohamed
- Developed as part of an Object-Oriented Programming course assignment
- Inspired by classic board games and their variants
- Built with modern C++ best practices
Enjoy playing! ๐ฎ