play

fun play(board: Board, myPiece: Piece): Board

Plays a piece on the board and returns the new state of the board. The play is valid if it captures at least one of the opponent's pieces.

Return

The new state of the board after the play.

Parameters

board

The current state of the board.

myPiece

The piece being placed on the board.

Throws

if the position is out of bounds

if the play is not valid (when no pieces are captured or position is occupied)