overengineering / rustassonne

0 stars 0 forks source link

Discussion on Game implementation #19

Open nadinengland opened 7 years ago

nadinengland commented 7 years ago

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