ritchie/elements/player
Types
Player index: 0, 1, 2, 3, the player assigned east, south, west, north in the initial round.
This is forced to mod-4 arithmetic, and can represent both the absolute player index or the relative differences between the player indices.
pub type Player {
Player(Int)
}
Constructors
-
Player(Int)
Values
pub fn all_players_from(p: Player) -> List(Player)
Returns a list of all players, starting from the given player, in natural turn order.
pub fn oppo(p: Player) -> Player
Returns the player 2 turns after the given player. In a physical game, this player would sit across the table.
pub fn other_players_after(p: Player) -> List(Player)
Returns a list of the three players after the given player, in natural turn order.
pub fn pred(p: Player) -> Player
Returns the player 1 turn before the given player. In a physical game, this player would to the left.