cli: treat currently played card as trash in draw selection

This commit is contained in:
Maximilian Keßler 2023-09-22 15:25:44 +02:00
parent fdd59216f6
commit f300c61c81
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -93,7 +93,8 @@ namespace Hanabi {
unsigned num_trash = 0; unsigned num_trash = 0;
std::optional<probability_t> trash_discard_prob = 0; std::optional<probability_t> trash_discard_prob = 0;
for(const auto &[card_multiplicity, probability]: next_states) { for(const auto &[card_multiplicity, probability]: next_states) {
if (game->is_trash(card_multiplicity.card)) { // If the card is played, we can treat it as a trash draw as well
if (game->is_trash(card_multiplicity.card) or (play and game->cur_hand()[index] == card_multiplicity.card)) {
num_trash += card_multiplicity.multiplicity; num_trash += card_multiplicity.multiplicity;
trash_discard_prob = probability; trash_discard_prob = probability;
} else { } else {