Game类
whitePlayer: Player
blackPlayer: Player
board: Block[8][8]
validateMove(): boolean
updateBoard(): void
checkKills(): boolean
isGameOver(): boolean
Player类
pieces: Collections<Piece>
playTurn(): Move
Move类
form: Block
to: Block
piece: Piece
Block类
piece: Piece
x: int
y: int
Piece类(Abstract)
type: Enum
color: Enum
isMoveValid(move: Move, board: Block[][])
Gameplay
A Player gets a turn [ Game.play() ]
Player makes a plays a turn and returns the played ‘move’ to Game Player.playTurn()
Game delegates the move validation processing to the moved Piece instance, passing destination-block and board instances. ( Piece.isValidMove(...): boolean )(Board instance is required to check is a piece lies in path of the move)
Piece calculates validity of the move and returns a boolean to Game
If move is valid, GameController
- updates location of Piece on board (Game.updateBoard(...))
- checks if move has performed any kills ( Game.checkKills(...))
- checks if any of game terminations conditions are valid ( Game.isGameOver(...))