diff --git a/include/deck_generator.h b/include/deck_generator.h new file mode 100644 index 0000000..818679a --- /dev/null +++ b/include/deck_generator.h @@ -0,0 +1,8 @@ +// +// Created by maximilian on 3/12/24. +// + +#ifndef ENDGAME_ANALYZER_DECK_GENERATOR_H +#define ENDGAME_ANALYZER_DECK_GENERATOR_H + +#endif //ENDGAME_ANALYZER_DECK_GENERATOR_H diff --git a/include/game_state.h b/include/game_state.h index 7944110..2bfcaa3 100644 --- a/include/game_state.h +++ b/include/game_state.h @@ -199,7 +199,7 @@ namespace Hanabi unsigned long discard_and_potentially_update(hand_index_t index, bool cycle = false); - unsigned long play_and_potentially_update(hand_index_t index, bool cycle = false); + unsigned long play_and_potentially_update(hand_index_t index, bool cycle, bool allow_strikeout); unsigned draw(hand_index_t index, bool cycle = false, bool played = true); diff --git a/include/game_state.hpp b/include/game_state.hpp index 8c61b56..9b3c6b6 100644 --- a/include/game_state.hpp +++ b/include/game_state.hpp @@ -191,12 +191,12 @@ namespace Hanabi template void HanabiState::play(Hanabi::hand_index_t index) { - play_and_potentially_update(index); + play_and_potentially_update(index, false, true); } template unsigned long - HanabiState::play_and_potentially_update(hand_index_t index, bool cycle) + HanabiState::play_and_potentially_update(hand_index_t index, bool cycle, bool allow_strikeout) { CHECK_DRAW_PILE_INTEGRITY; ASSERT(index < _hands[_turn].size()); @@ -217,7 +217,7 @@ namespace Hanabi } } else { _num_strikes++; - assert(_num_strikes <= max_num_strikes); + ASSERT(_num_strikes <= max_num_strikes or allow_strikeout); _num_copies_left[played_card]--; } @@ -806,7 +806,7 @@ namespace Hanabi { std::vector>> actions{}; - if (_score == _score_goal or _pace < 0 or _endgame_turns_left == 0) + if (_score == _score_goal or _pace < 0 or _endgame_turns_left == 0 or _num_strikes > max_num_strikes) { return actions; } @@ -1029,7 +1029,7 @@ namespace Hanabi { return Factorial::factorial(_weighted_draw_pile_size); } - if (_pace < 0 || _endgame_turns_left == 0) + if (_pace < 0 || _endgame_turns_left == 0 || _num_strikes > max_num_strikes) { return 0; } @@ -1162,7 +1162,7 @@ namespace Hanabi auto do_action = [this, index, play]() { if (play) { - return play_and_potentially_update(index, true); + return play_and_potentially_update(index, true, false); } else { diff --git a/src/seed_search.cpp b/src/seed_search.cpp new file mode 100644 index 0000000..504ec30 --- /dev/null +++ b/src/seed_search.cpp @@ -0,0 +1,3 @@ +// +// Created by maximilian on 3/12/24. +//