change some types

This commit is contained in:
Maximilian Keßler 2023-08-12 19:55:10 +02:00
parent 38e99cf662
commit 849c0a6538
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -25,14 +25,14 @@ namespace Hanabi {
using hand_index_t = std::uint8_t; using hand_index_t = std::uint8_t;
using probability_t = boost::rational<unsigned long>; using probability_t = boost::rational<unsigned long>;
/** /**
* We will generally assume that stacks are played from n to 0 * We will generally assume that stacks are played from n to 0
* Playing a 0 will yield a clue * Playing a 0 will yield a clue
* Therefore, for the default hanabi, we will play 4,3,2,1,0 in that order * Therefore, for the default hanabi, we will play 4,3,2,1,0 in that order
* on each stack. A stack with no cards played implicitly has value 5 on it * on each stack. A stack with no cards played implicitly has value 5 on it
* This is just easier to implement, since then the remaining number of cards * This is just easier to implement, since then the remaining number of cards
* to be played is always the current number of the stack * to be played is always the current number of the stack
*/ */
constexpr rank_t starting_card_rank = 5; constexpr rank_t starting_card_rank = 5;
constexpr suit_t max_suit_index = 5; constexpr suit_t max_suit_index = 5;
constexpr size_t max_card_duplicity = 3; constexpr size_t max_card_duplicity = 3;
@ -129,7 +129,7 @@ struct CardMultiplicity {
Card card; Card card;
unsigned multiplicity; unsigned multiplicity;
auto operator<=>(const CardMultiplicity &) const = default; bool operator==(const CardMultiplicity &) const = default;
}; };
template<typename T> template<typename T>
@ -163,7 +163,7 @@ private:
std::array<inner_array_t , num_suits> _array {}; std::array<inner_array_t , num_suits> _array {};
}; };
enum class ActionType { enum class ActionType : std::uint8_t {
play = 0, play = 0,
discard = 1, discard = 1,
clue = 2, clue = 2,
@ -302,15 +302,15 @@ private:
// Card positions of these cards. Indexes correspond to the cards stored in _good_cards_draw vector // Card positions of these cards. Indexes correspond to the cards stored in _good_cards_draw vector
boost::container::static_vector<boost::container::static_vector<player_t, max_card_duplicity>, 30> card_positions_draw; boost::container::static_vector<boost::container::static_vector<player_t, max_card_duplicity>, 30> card_positions_draw;
// Note this is not the same as _good_cards_draw.size(), since this accounts for multiplicities
size_t initial_draw_pile_size {};
// This will indicate whether cards that were in hands initially still are in hand // This will indicate whether cards that were in hands initially still are in hand
// The first n bits are used and cards are assumed to have been marked with their indices in this bitset // The first n bits are used and cards are assumed to have been marked with their indices in this bitset
std::bitset<num_players * hand_size> card_positions_hands {}; std::bitset<num_players * hand_size> card_positions_hands {};
// Note this is not the same as _good_cards_draw.size(), since this accounts for multiplicities
std::uint8_t initial_draw_pile_size { 0 };
// Number of bits from above bitset that is meaningful // Number of bits from above bitset that is meaningful
size_t num_useful_cards_in_starting_hands { 0 }; std::uint8_t num_useful_cards_in_starting_hands { 0 };
// Whether we initialized the values above and marked cards accordingly // Whether we initialized the values above and marked cards accordingly
bool initialized { false }; bool initialized { false };