Fix: Allow user to strikeout
This commit is contained in:
parent
60c405fa20
commit
b966475045
4 changed files with 18 additions and 7 deletions
8
include/deck_generator.h
Normal file
8
include/deck_generator.h
Normal file
|
@ -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
|
|
@ -199,7 +199,7 @@ namespace Hanabi
|
||||||
|
|
||||||
unsigned long discard_and_potentially_update(hand_index_t index, bool cycle = false);
|
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);
|
unsigned draw(hand_index_t index, bool cycle = false, bool played = true);
|
||||||
|
|
||||||
|
|
|
@ -191,12 +191,12 @@ namespace Hanabi
|
||||||
template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
|
template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
|
||||||
void HanabiState<num_suits, num_players, hand_size>::play(Hanabi::hand_index_t index)
|
void HanabiState<num_suits, num_players, hand_size>::play(Hanabi::hand_index_t index)
|
||||||
{
|
{
|
||||||
play_and_potentially_update(index);
|
play_and_potentially_update(index, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
|
template<suit_t num_suits, player_t num_players, hand_index_t hand_size>
|
||||||
unsigned long
|
unsigned long
|
||||||
HanabiState<num_suits, num_players, hand_size>::play_and_potentially_update(hand_index_t index, bool cycle)
|
HanabiState<num_suits, num_players, hand_size>::play_and_potentially_update(hand_index_t index, bool cycle, bool allow_strikeout)
|
||||||
{
|
{
|
||||||
CHECK_DRAW_PILE_INTEGRITY;
|
CHECK_DRAW_PILE_INTEGRITY;
|
||||||
ASSERT(index < _hands[_turn].size());
|
ASSERT(index < _hands[_turn].size());
|
||||||
|
@ -217,7 +217,7 @@ namespace Hanabi
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_num_strikes++;
|
_num_strikes++;
|
||||||
assert(_num_strikes <= max_num_strikes);
|
ASSERT(_num_strikes <= max_num_strikes or allow_strikeout);
|
||||||
_num_copies_left[played_card]--;
|
_num_copies_left[played_card]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,7 +806,7 @@ namespace Hanabi
|
||||||
{
|
{
|
||||||
std::vector<std::pair<Action, std::optional<probability_t>>> actions{};
|
std::vector<std::pair<Action, std::optional<probability_t>>> 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;
|
return actions;
|
||||||
}
|
}
|
||||||
|
@ -1029,7 +1029,7 @@ namespace Hanabi
|
||||||
{
|
{
|
||||||
return Factorial::factorial(_weighted_draw_pile_size);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1162,7 +1162,7 @@ namespace Hanabi
|
||||||
auto do_action = [this, index, play]() {
|
auto do_action = [this, index, play]() {
|
||||||
if (play)
|
if (play)
|
||||||
{
|
{
|
||||||
return play_and_potentially_update(index, true);
|
return play_and_potentially_update(index, true, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
3
src/seed_search.cpp
Normal file
3
src/seed_search.cpp
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
//
|
||||||
|
// Created by maximilian on 3/12/24.
|
||||||
|
//
|
Loading…
Reference in a new issue