Skip to content

A human is but a fleshy Robot, is it not? (Player Interface) #7

@ikyman

Description

@ikyman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions