Struct advent_of_code_2021::day_21::Game[−][src]

struct Game {
    players: Vec<Player>,
    current_player: usize,
    next_die_face: usize,
    rolls: usize,
}
Expand description

Represents a deterministic game of Dirac dice, tracking the current value of the deterministic d100, the players, whose turn it is, and how many rolls have occurred.

Fields

players: Vec<Player>

List of the players of the game

current_player: usize

The index of the player that will take the next turn

next_die_face: usize

The next face that the deterministic d100 will roll

rolls: usize

how many times the die has been rolled so far

Implementations

Get the next number rolls from the game’s deterministic die, and update the next facing and roll count.

Play the game until a player reaches target_score returning the score of the loser at that point, and the number of rolls made.

Trait Implementations

Formats the value using the given formatter. Read more

Pass the lines of the input to Player::from to turn it into the player list and set the counters to their initial values.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.