play

suspend fun play(coordinate: Coordinate): Game

Plays a move at the specified coordinate. Saves the piece to data access if the game is not local. Only check player turn if it is a not local game. And resets the pass count to 0.

Return

The new game state after the move.

Parameters

coordinate

The (row, column) coordinate for the move.

Throws

if it's not the player's turn or if the play is invalid.

if the position is out of bounds.

if the game is not started yet (board or players are null,empty).

if there is an error saving the game state.

if the game has already ended.