My personal preference for the game would be an immutable interface that returns the next state of the game, see pseudo code:
let first_turn = Game::new()
match first_turn.place_next([0, 0], TileOrientation::Up) {
Ok(second_turn) => { ... }
Err(PlacementError::NotAdjacent)) => { ... }
Err(PlacementError::TileAlreadyAtCoordinate)) => { ... }
}
The underlying states could then be represented by creating new games that use Persistent Date Structures. From a cursory glance, this page seems like what we would be after: https://github.com/reem/adamantium
My personal preference for the game would be an immutable interface that returns the next state of the game, see pseudo code:
The underlying states could then be represented by creating new games that use Persistent Date Structures. From a cursory glance, this page seems like what we would be after: https://github.com/reem/adamantium