Developer Mistakes Point To System Design Issue
Game game = new Game();
game.moveO();
game.moveO();
game.moveO();
class Game{
Game(Player playerX, Player playerO);
move();
...
}
void moveX(){
if(currentPlayer != Player.X){
throw new NotTheTurnOfThePlayerException();
}
}
class Game{
Game(Player playerX,
Player playerO);
move();
...
}
Game game =
new Game(firstPlayer,
secondPlayer);
game.addPlayer(thirdPlayer);
game.addPlayer(fourthPlayer);
game.move();
game.move("A1");
game.move(0, 0);
Place place =
new Place(Coordinate.One,
Coordinate.One);
game.move(place);