add sorts to position vectors for bijective id mapping

This commit is contained in:
Maximilian Keßler 2023-08-12 14:00:54 +02:00
parent 1c716ffeab
commit 012b73879f
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -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]);
}
}