Quaternity
|
This file defines state initialization and copy functions. More...
Go to the source code of this file.
Functions | |
std::vector< Card > | init_cards (const Settings &settings) |
Initialize the cards corresponding to the given settings. More... | |
std::vector< Player > | init_players (const Settings &settings) |
Initialize the players corresponding to the given settings. More... | |
State | init_state (const Settings &settings) |
Initialize the starting state corresponding to the given settings. More... | |
std::vector< Card > | copy_cards (const std::vector< Card > cards) |
Copy the old cards vector to a new cards vector. More... | |
std::vector< Player > | copy_players (const std::vector< Player > players) |
Copy the old player vector to a new player vector. More... | |
State | copy_state (const State &state) |
Copy the old state to a new state. More... | |
int | info_num_quartets (const State &state, int player) |
Get the number of quartets the given player has. More... | |
int | info_num_cards (const Settings &settings, const State &state, int player) |
Get the number of cards the player has without counting the cards from quartets, so the actual number of cards the player has in its hands. More... | |
This file defines state initialization and copy functions.
Definition in file state.cpp.
Copy the old cards vector to a new cards vector.
Definition at line 67 of file state.cpp.
Copy the old state to a new state.
Definition at line 96 of file state.cpp.
Get the number of cards the player has without counting the cards from quartets, so the actual number of cards the player has in its hands.
Definition at line 113 of file state.cpp.
int info_num_quartets | ( | const State & | state, |
int | player | ||
) |
Initialize the cards corresponding to the given settings.
The players vector for every card will be initilialized to all true, because at the start every player could have that card. There are a total of SET_SIZE * NUM_SETS
cards which will be generated.
Definition at line 20 of file state.cpp.
Initialize the players corresponding to the given settings.
The cards are equally distributed among the players which means that every player will start with (NUM_SETS * SET_SIZE) / NUM_PLAYERS
amount of cards. They further have the sets vector initialized to all zeros because they do not need to have any specific set at the start.
Definition at line 38 of file state.cpp.
Initialize the starting state corresponding to the given settings.
The cards and players are defined by their respective functions. The zero'th player starts the game (has the first turn).
Definition at line 58 of file state.cpp.