fix assertions

This commit is contained in:
Maximilian Keßler 2023-11-11 13:29:55 +01:00
parent ab31588dbb
commit 6190040c25
Signed by: max
GPG key ID: BCC5A619923C0BA5
2 changed files with 6 additions and 7 deletions

View file

@ -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<suit_t num_suits, player_t num_players, hand_index_t hand_size>
void HanabiState<num_suits, num_players, hand_size>::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<suit_t num_suits, player_t num_players, hand_index_t hand_size>
ActionType HanabiState<num_suits, num_players, hand_size>::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;

View file

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