From 6190040c25764652fcd880d481b4eb0189b89cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 11 Nov 2023 13:29:55 +0100 Subject: [PATCH] fix assertions --- include/game_state.hpp | 11 +++++------ src/game_state.cpp | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/game_state.hpp b/include/game_state.hpp index 296d0ad..e1bc4fa 100644 --- a/include/game_state.hpp +++ b/include/game_state.hpp @@ -517,7 +517,7 @@ namespace Hanabi { _score--; if (not cycle) { - ASSERT(last_action.draw_pile == _draw_pile); + ASSERT(last_action.draw_pile.size() == _draw_pile.size()); } check_draw_pile_integrity(); } @@ -539,7 +539,7 @@ namespace Hanabi { revert_draw(last_action.index, last_action.discarded, cycle); if (not cycle) { - ASSERT(last_action.draw_pile == _draw_pile); + ASSERT(last_action.draw_pile.size() == _draw_pile.size()); } check_draw_pile_integrity(); } @@ -589,8 +589,8 @@ namespace Hanabi { template void HanabiState::set_clues(Hanabi::clue_t clues) { - assert(0 <= clues); - assert(clues <= 8); + ASSERT(0 <= clues); + ASSERT(clues <= 8); _num_clues = clues; } @@ -744,7 +744,7 @@ namespace Hanabi { template ActionType HanabiState::last_action_type() const { - assert(not _actions_log.empty()); + ASSERT(not _actions_log.empty()); return _actions_log.top().action_type; } @@ -857,7 +857,6 @@ namespace Hanabi { revert_action(); } else { unsigned sum_of_multiplicities = 0; - [[maybe_unused]] const auto pile = _draw_pile; for(size_t i = 0; i < _draw_pile.size(); i++) { const unsigned long multiplicity = do_action(); sum_of_multiplicities += multiplicity; diff --git a/src/game_state.cpp b/src/game_state.cpp index 4c5333f..c206cb2 100644 --- a/src/game_state.cpp +++ b/src/game_state.cpp @@ -4,7 +4,7 @@ namespace Hanabi { void Game::make_turn() { - assert(next_action < actions.size()); + ASSERT(next_action < actions.size()); Card const next_draw = deck[deck.size() - state->draw_pile_size()]; state->rotate_next_draw(next_draw); Action const & action = actions[next_action];