Before implementing the Tic-Tac-Toe game, let’s take a look at the design considerations we should take into account:
- It should be a command-line application, so the game should be rendered into the console and the user should interact via text commands.
- The application should be divided into three modes, where a mode is defined by its state and a list of commands available to the user. These modes should be:
- Confirm Mode: This mode should just await user confirmation, in the form of yes/no commands.
- Menu Mode: This mode should allow the user to start, resume or quit a game.
- Game Mode: This mode should implement the Game Logic itself and allow the user to play against an Opponent AI.
- Our program should read from the Terminal, modify the state accordingly and write to the Terminal in a Loop.
- We’d also like to clear the console before each frame.
We will create a separate service for each of these concerns. Each service will depend on other Services as depicted in the image below: