add sorts to position vectors for bijective id mapping
This commit is contained in:
parent
1c716ffeab
commit
012b73879f
1 changed files with 4 additions and 0 deletions
|
@ -284,6 +284,7 @@ namespace Hanabi {
|
||||||
auto replaced_card_it = std::ranges::find(_relative_representation.card_positions_draw[discarded.local_index], _turn);
|
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());
|
ASSERT(replaced_card_it != _relative_representation.card_positions_draw[discarded.local_index].end());
|
||||||
*replaced_card_it = trash_or_play_stack;
|
*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);
|
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());
|
ASSERT(new_card_it != _relative_representation.card_positions_draw[draw.card.local_index].end());
|
||||||
*new_card_it = _turn;
|
*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);
|
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());
|
ASSERT(drawn_card_it != _relative_representation.card_positions_draw[drawn.local_index].end());
|
||||||
*drawn_card_it = draw_pile;
|
*drawn_card_it = draw_pile;
|
||||||
|
std::ranges::sort(_relative_representation.card_positions_draw[drawn.local_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_weighted_draw_pile_size++;
|
_weighted_draw_pile_size++;
|
||||||
|
@ -359,6 +362,7 @@ namespace Hanabi {
|
||||||
trash_or_play_stack);
|
trash_or_play_stack);
|
||||||
ASSERT(hand_card_it != _relative_representation.card_positions_draw[discarded_card.local_index].end());
|
ASSERT(hand_card_it != _relative_representation.card_positions_draw[discarded_card.local_index].end());
|
||||||
*hand_card_it = _turn;
|
*hand_card_it = _turn;
|
||||||
|
std::ranges::sort(_relative_representation.card_positions_draw[discarded_card.local_index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue