I am trying to build a very simple console-based game with a focus on using OOP instead of procedural programming because I intend to build up on that code for more complex projects.
I am wondering if there is a design pattern that nicely handles this use case:
- There is a
Playerclass with a
MakeMove()method interacting with the board game.
MakeMove() method has to somehow get the user input yet I do not want to code it into the
Player class as this would reduce cohesion and augment coupling.
I was thinking of maybe having some controller class handle the sequence of events and thus the calls to keyboard input. However, that controller class would need to be able to handle differently the subclasses of
Player (e.g. the
AI class does not require keyboard input).