Skip to content

moabdulhakim/GameBoards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

94 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Board Game Center

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.

๐Ÿ“‹ Table of Contents

๐ŸŽฏ Overview

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

โœจ Features

Core Features

  • ๐ŸŽจ 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

Technical Features

  • 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

๐ŸŽฒ Game Variants

The Board Game Center includes 13 unique game variants:

1. Numerical Tic-Tac-Toe

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.

2. 4ร—4 Tic-Tac-Toe

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.

3. Misรจre Tic-Tac-Toe

A reverse variant where the objective is to avoid getting three in a row. The first player to create three in a row loses!

4. Infinity Tic-Tac-Toe

Players can move their existing pieces after all pieces are placed, creating an endless strategic game where positions constantly shift.

5. 5ร—5 Tic-Tac-Toe

An expanded 5ร—5 board where players compete to create sequences of their symbol, adding complexity and strategic options.

6. S-U-S Sequence Game

Players place S's and U's attempting to create the sequence "SUS" in any direction. A unique word-based twist on traditional gameplay.

7. Diamond Tic-Tac-Toe

Features a diamond-shaped board layout, requiring players to adapt their strategies to the unique geometry.

8. Pyramid Tic-Tac-Toe

A triangular/pyramid-shaped board where the playing area is arranged in pyramid layers, offering a fresh spatial challenge.

9. Dynamic Obstacle Tic-Tac-Toe

The board contains randomly placed obstacles that block certain positions, forcing players to adapt their strategies dynamically.

10. Ultimate Tic-Tac-Toe

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.

11. Connect Four

The classic gravity-based game where players drop tokens into columns, trying to align 4 tokens horizontally, vertically, or diagonally.

12. Word Tic-Tac-Toe

Players form words on the board, combining wordplay with strategic positioning for a unique challenge.

13. Memory Tic-Tac-Toe

A memory-based variant where players must remember positions and make strategic decisions based on hidden information.

๐Ÿ—๏ธ Architecture

The project follows a clean, object-oriented architecture with three main layers:

Base Classes (Templates)

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

Game-Specific Implementations

Each game variant provides:

  • [Game]_Board - Inherits from Board<char> with specific game rules
  • [Game]_UI - Inherits from UI<char> for game-specific interactions
  • Custom win/draw/lose conditions
  • Specialized display and validation logic

Game Manager

The GameManager class orchestrates:

  • Player turns and move processing
  • Win/draw/lose detection
  • Game loop control
  • State management

Design Patterns

  • 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

๐Ÿ’ป Technologies Used

  • 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)

๐Ÿš€ Getting Started

Prerequisites

  • 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)

Compilation

Using CMake (Recommended)

# 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.

Using Make (Alternative)

make

This will compile all source files and create the GameCenter executable.

Manual Compilation - Using g++ (Linux/MinGW)

g++ -std=c++11 -Iinclude src/*.cpp -o GameCenter

Manual Compilation - Using MSVC (Windows)

cl /EHsc /std:c++11 /Iinclude src\*.cpp /Fe:GameCenter.exe

Running the Application

# 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

Usage

  1. Launch the application - You'll see a colorized welcome menu
  2. Navigate - Use arrow keys (โ†‘/โ†“) to select a game
  3. Select a game - Press Enter to start your chosen game
  4. Setup players - Choose player types (Human, AI, Random, Computer)
  5. Play - Follow on-screen prompts to make moves
  6. Repeat - Return to the menu to try different games

Player Types

  • 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

๐Ÿ“ Project Structure

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

Key Files

  • 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 registry
  • include/Menu.h / src/Menu.cpp: Interactive menu system with keyboard navigation
  • include/console_style.hpp: ANSI color codes and terminal formatting
  • include/[Game]_Classes.h / src/[Game]_Classes.cpp: Each game variant's implementation
  • CMakeLists.txt: CMake build configuration for cross-platform compilation
  • Makefile: Make build automation (alternative build method)

๐Ÿ“š Documentation

Generating Documentation

The project uses Doxygen for comprehensive API documentation. To generate:

cd docs
doxygen Doxyfile

Documentation will be generated in the docs/html/ directory. Open docs/html/index.html in a browser to view.

Code Documentation

All classes and functions are extensively documented with:

  • Detailed descriptions
  • Parameter explanations
  • Return value documentation
  • Usage examples where applicable
  • Implementation notes

Documentation Highlights

  • Class hierarchies - Visual inheritance diagrams
  • Call graphs - Function relationship visualization
  • File dependencies - Include file relationships
  • Detailed method documentation - Every public and protected method

๐Ÿค Contributing

This project was developed as part of an OOP assignment. Contributions, suggestions, and feedback are welcome!

Development Guidelines

  1. Follow the existing code style and naming conventions
  2. Document all new classes and methods using Doxygen format
  3. Ensure new games implement all required virtual methods
  4. Test thoroughly before submitting changes
  5. Update this README if adding new features or games

Adding a New Game

To add a new game variant:

  1. Create include/[YourGame]_Classes.h and src/[YourGame]_Classes.cpp
  2. Implement [YourGame]_Board : public Board<char>
  3. Implement [YourGame]_UI : public UI<char>
  4. Add factory functions to the games vector in src/main.cpp
  5. Add game name to the options vector
  6. Add the new source file to CMakeLists.txt in the SOURCES list
  7. Compile using cmake or make and test

๐Ÿ“Š Project Statistics

  • 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

๐ŸŽ“ Educational Value

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

๐Ÿ“ License

This project is part of an academic assignment. Please check with the repository owner regarding usage and licensing.

๐Ÿ‘ฅ Contributors

Acknowledgments

  • 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! ๐ŸŽฎ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages