Add check for draw pile size

This commit is contained in:
Maximilian Keßler 2024-06-14 11:18:24 +02:00
parent 9c1cb5ff4e
commit e602f2a41a
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -537,6 +537,12 @@ namespace Hanabi
template<suit_t num_suits, player_t num_players, hand_index_t hand_size> template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
void HanabiState<num_suits, num_players, hand_size>::init_backtracking_information() void HanabiState<num_suits, num_players, hand_size>::init_backtracking_information()
{ {
if (_weighted_draw_pile_size > 20)
{
std::stringstream ss;
ss << "Detected draw pile size of " << +_weighted_draw_pile_size << " is too big, can at most be 20.";
throw std::runtime_error(ss.str());
}
ASSERT(not _relative_representation.initialized); ASSERT(not _relative_representation.initialized);
// Note that this function does not have to be particularly performant, we only call it once to initialize. // Note that this function does not have to be particularly performant, we only call it once to initialize.
const Card trash = [this]() -> Card { const Card trash = [this]() -> Card {