Currently GameState knows about Decision and vice versa. This is not really good design and should be eliminated. When solved, it will make the program easier to reason about. Also, it doesn't force a bad practice onto interface implementers.
GameState's knowledge lies in GameState::getDecisions(): Decision[] and Decision's knowledge lies in Decision::apply(GameState): GameState.
One possible solution is to move apply from Decision to GameState. It could also help to think about extracting a Board class from GameState and making only that known to Decision. However, care should be taken to keep the interface as simple as needed.
Currently
GameState
knows aboutDecision
and vice versa. This is not really good design and should be eliminated. When solved, it will make the program easier to reason about. Also, it doesn't force a bad practice onto interface implementers.GameState
's knowledge lies inGameState::getDecisions(): Decision[]
andDecision
's knowledge lies inDecision::apply(GameState): GameState
.One possible solution is to move
apply
fromDecision
toGameState
. It could also help to think about extracting aBoard
class fromGameState
and making only that known toDecision
. However, care should be taken to keep the interface as simple as needed.