Revert "add more checks: same draw pile after reverting single moves (bug detected)"

This reverts commit a3972fe637.
This commit is contained in:
Maximilian Keßler 2023-11-11 13:32:18 +01:00
parent 6190040c25
commit 571011d7b5
Signed by: max
GPG Key ID: BCC5A619923C0BA5
3 changed files with 6 additions and 19 deletions

View File

@ -326,8 +326,7 @@ private:
ActionType action_type,
Card discarded_or_played = Cards::unknown,
hand_index_t index = 0,
bool was_on_8_clues = false,
std::list<CardMultiplicity> draw_pile = {}
bool was_on_8_clues = false
);
ActionType action_type{};
@ -339,8 +338,6 @@ private:
// Indicates whether before the action was taken, we had 8 clues.
// This is important so that we know if we go back to 7 or 8 clues when we revert playing a 5
bool was_on_8_clues {false};
std::list<CardMultiplicity> draw_pile;
};
// This keeps track of the representation of the gamestate relative to some starting state

View File

@ -103,12 +103,12 @@ namespace Hanabi {
template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
HanabiState<num_suits, num_players, hand_size>::BacktrackAction::BacktrackAction(
Hanabi::ActionType action_type, Hanabi::Card discarded_or_played, Hanabi::hand_index_t index,
bool was_on_8_clues, std::list<CardMultiplicity> draw_pile
bool was_on_8_clues
):
action_type(action_type),
discarded(discarded_or_played),
index(index),
was_on_8_clues(was_on_8_clues), draw_pile(std::move(draw_pile)) {
was_on_8_clues(was_on_8_clues) {
}
template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
@ -208,7 +208,6 @@ namespace Hanabi {
template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
unsigned long HanabiState<num_suits, num_players, hand_size>::play_and_potentially_update(hand_index_t index, bool cycle) {
check_draw_pile_integrity();
auto copy = _draw_pile;
ASSERT(index < _hands[_turn].size());
const Card played_card = _hands[_turn][index];
if (!is_playable(played_card)) {
@ -218,7 +217,7 @@ namespace Hanabi {
}
ASSERT(is_playable(played_card));
_actions_log.emplace(ActionType::play, played_card, index, _num_clues == 8, copy);
_actions_log.emplace(ActionType::play, played_card, index, _num_clues == 8);
--_stacks[played_card.suit];
_score++;
@ -243,7 +242,6 @@ namespace Hanabi {
template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
unsigned long HanabiState<num_suits, num_players, hand_size>::discard_and_potentially_update(hand_index_t index, bool cycle) {
check_draw_pile_integrity();
auto copy = _draw_pile;
ASSERT(index < _hands[_turn].size());
ASSERT(_num_clues != max_num_clues);
@ -252,7 +250,7 @@ namespace Hanabi {
_pace--;
unsigned long multiplicity = draw(index, cycle);
_actions_log.emplace(ActionType::discard, discarded_card, index, false, copy);
_actions_log.emplace(ActionType::discard, discarded_card, index);
incr_turn();
check_draw_pile_integrity();
@ -515,10 +513,6 @@ namespace Hanabi {
_stacks[last_action.discarded.suit]++;
}
_score--;
if (not cycle)
{
ASSERT(last_action.draw_pile.size() == _draw_pile.size());
}
check_draw_pile_integrity();
}
@ -537,10 +531,6 @@ namespace Hanabi {
_pace++;
revert_draw(last_action.index, last_action.discarded, cycle);
if (not cycle)
{
ASSERT(last_action.draw_pile.size() == _draw_pile.size());
}
check_draw_pile_integrity();
}

View File

@ -1,6 +1,6 @@
#ifndef DYNAMIC_PROGRAM_MYASSERT_H
#define DYNAMIC_PROGRAM_MYASSERT_H
#undef NDEBUG
#ifdef NDEBUG
#define ASSERT(x) do { (void)sizeof(x);} while (0)
#else