-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Let's say I've gotten to the point where the chess game is actually playable.
Chess is a turn-based game, It's quite likely I'd have logic such as this:
while game is not won: playerw.chooseMove(Chessboard) checkCheckmated(playerb) playerb.choseMove(Chessboard) checkCheckmated(playerw)
Which Player is the Computer? Which one is the human?
The human player could be either the white player or the black player.
"Player" is just an interface, which would allow substitution of a player and a robot, and vice versa.
One side effect of this schema:
I, as a human player, do not consider it my job to ensure that the move I'm making is legal. The computer player, implementing the same interface, should pass off move legality to the game engine.
It would be awkward to have one player implementation check moves, while the other does not.