Game Interface Documentation
Application Preview

Overview
This C++ interface allows users to play one of four games: Tic-Tac-Toe, Checkers, Othello, and Connect 4. The interface supports multiple game modes, including:
- Computer vs Computer
- Player vs Player
- Computer vs Player
Additionally, the system includes functionality to save and load game states, allowing players to resume games at a later time.
Game Options
1. Tic-Tac-Toe (Morpion)
A simple 3x3 grid game where two players take turns marking spaces in an attempt to get three in a row (horizontally, vertically, or diagonally).
2. Checkers (Dame)
A strategic game played on an 8x8 board, where the objective is to capture all of the opponent's pieces or block them from moving.
3. Othello
A game played on an 8x8 board where the objective is to flip the opponent's pieces by sandwiching them between your own pieces. The player with the most pieces at the end of the game wins.
4. Connect 4 (Puissance 4)
Players take turns dropping pieces into a 7-column, 6-row grid, attempting to get four of their pieces in a row, either horizontally, vertically, or diagonally.
Game Modes
Computer vs Computer:
- Both players are controlled by the computer.
- This mode allows users to watch two AI players compete against each other.
Player vs Player:
- Two human players take turns.
- This mode allows for a local multiplayer experience.
Computer vs Player:
- One player is human, while the other is controlled by AI.
- Players can choose whether they want to play as the first or second player.
Saving and Loading Games
The system allows users to save and load games, so players can pause and resume games at a later time. The save and load functions work for all four games, preserving the current state of the board, scores, and any other relevant data.
Saving a Game
At any point during a game, the user can save the current game state. This functionality writes the current state of the board, the players' turns, and any other necessary data to a file.
Loading a Game
Users can load previously saved games. The interface reads the saved game state from the file and resumes the game from the exact point where it was last saved.
User Interface
The interface is a console-based C++ application with a simple menu system that allows players to choose from the following options:
- Select a Game: Choose between Tic-Tac-Toe, Checkers, Othello, and Connect 4.
- Select a Game Mode: Choose to play against the computer, another player, or watch a computer vs computer match.
- Load Game: Load a previously saved game.
- Save Game: Save the current game state.
- Exit: Exit the application.
Architecture
The system is built using object-oriented principles in C++. Each game is implemented as a separate class, inheriting from a common Game
interface. This ensures that all games share the same functionality for starting a game, managing turns, saving, and loading game states.
Classes
Game (abstract class):
- This class defines the basic structure for a game. It includes virtual functions for starting a game, managing turns, saving the game, and loading the game.
TicTacToe, Checkers, Othello, Connect4:
- These classes inherit from the
Game
class and implement the specific logic for each game. Each class contains the game board, logic for player moves, and rules for winning/losing.
- These classes inherit from the
Player:
- Represents a player (human or AI). Contains information about the player type (human or computer) and manages moves accordingly.
AI:
- This class handles the logic for the computer player. It includes algorithms for making moves in each game based on the current state of the board.
Future Improvements
- Networked Multiplayer: Allow users to play against each other over the network.
- Graphical Interface: Develop a GUI version of the game using a framework like Qt or SFML for better user experience.
- Improved AI: Enhance the AI to make smarter decisions, especially in more complex games like Checkers and Othello.
Conclusion
This C++ interface offers a versatile and engaging way to play four classic games with multiple game modes. The save and load functionality ensures that players can enjoy the game at their own pace, and the AI provides a challenging opponent for those looking to practice or just have fun.