diff --git a/include/hanabi_types.hpp b/include/hanabi_types.hpp index 4eaadc1..fe8b9fc 100644 --- a/include/hanabi_types.hpp +++ b/include/hanabi_types.hpp @@ -63,10 +63,11 @@ namespace Hanabi { suit_t suit; rank_t rank; + uint8_t deck_index; /** Order of card in deck, numbered 0, 1, ... */ // These attributes are not needed in general for a card, // they represent internal states during backtracking. - uint8_t local_index; + uint8_t local_index; /** Used for the local representation of the current game state. */ bool in_starting_hand; bool initial_trash; diff --git a/src/parse_game.cpp b/src/parse_game.cpp index 2ab237f..8ca611f 100644 --- a/src/parse_game.cpp +++ b/src/parse_game.cpp @@ -71,12 +71,15 @@ namespace Parsing std::pair, Hanabi::suit_t> parse_deck(const boost::json::value & deck_json) { auto deck = boost::json::value_to>(deck_json); + uint8_t deck_index = 0; for (auto & card: deck) { ASSERT(card.rank < 5); ASSERT(card.rank >= 0); ASSERT(card.suit < 6); ASSERT(card.suit >= 0); + card.deck_index = deck_index; + deck_index++; } Hanabi::suit_t num_suits = 0; for (const auto & card: deck)