diff --git a/include/game_state.hpp b/include/game_state.hpp index 22e7bfc..9083158 100644 --- a/include/game_state.hpp +++ b/include/game_state.hpp @@ -284,6 +284,7 @@ namespace Hanabi { auto replaced_card_it = std::ranges::find(_relative_representation.card_positions_draw[discarded.local_index], _turn); ASSERT(replaced_card_it != _relative_representation.card_positions_draw[discarded.local_index].end()); *replaced_card_it = trash_or_play_stack; + std::ranges::sort(_relative_representation.card_positions_draw[discarded.local_index]); } } } @@ -308,6 +309,7 @@ namespace Hanabi { auto new_card_it = std::ranges::find(_relative_representation.card_positions_draw[draw.card.local_index], draw_pile); ASSERT(new_card_it != _relative_representation.card_positions_draw[draw.card.local_index].end()); *new_card_it = _turn; + std::ranges::sort(_relative_representation.card_positions_draw[draw.card.local_index]); } } @@ -342,6 +344,7 @@ namespace Hanabi { auto drawn_card_it = std::ranges::find(_relative_representation.card_positions_draw[drawn.local_index], _turn); ASSERT(drawn_card_it != _relative_representation.card_positions_draw[drawn.local_index].end()); *drawn_card_it = draw_pile; + std::ranges::sort(_relative_representation.card_positions_draw[drawn.local_index]); } _weighted_draw_pile_size++; @@ -359,6 +362,7 @@ namespace Hanabi { trash_or_play_stack); ASSERT(hand_card_it != _relative_representation.card_positions_draw[discarded_card.local_index].end()); *hand_card_it = _turn; + std::ranges::sort(_relative_representation.card_positions_draw[discarded_card.local_index]); } }