From c6a7eec903f1ffb3cb71337278e4e1eb153cf0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Tue, 9 Jan 2024 04:13:13 +0100 Subject: [PATCH] fix assertions and when to consider stalling --- include/game_state.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/game_state.hpp b/include/game_state.hpp index f0ae6ee..f5b0546 100644 --- a/include/game_state.hpp +++ b/include/game_state.hpp @@ -91,7 +91,7 @@ namespace Hanabi template void HanabiState::give_clue() { - ASSERT(_num_clues > 0); + ASSERT(_num_clues >= clue_t(1)); --_num_clues; _actions_log.emplace(ActionType::clue, Cards::unknown, 0); @@ -591,9 +591,10 @@ namespace Hanabi ASSERT(last_action.action_type == ActionType::discard); decr_turn(); - ASSERT(_num_clues > 0); _num_clues -= _clues_gained_on_discard_or_stack_finished; + ASSERT(_num_clues >= clue_t(0)); + _pace++; revert_draw(last_action.index, last_action.discarded, cycle, false); @@ -806,7 +807,7 @@ namespace Hanabi } } - if (_num_clues > 0) + if (_num_clues >= clue_t(1)) { give_clue(); const std::optional prob = lookup(); @@ -945,7 +946,7 @@ namespace Hanabi } // Last option is to stall - if (_num_clues > 0) + if (_num_clues >= clue_t(1)) { give_clue(); const probability_t probability_stall = evaluate_state();