1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:47:35 +00:00

Hearts: Pick better lead cards

Previously the AI would prefer playing a lead card for which no other
player had a card with a higher value even though it also had a card
for which a higher value card was still in play.
This commit is contained in:
Gunnar Beutner 2021-05-31 23:56:13 +02:00 committed by Andreas Kling
parent 40ddb734ee
commit 38f8a6aabb
3 changed files with 4 additions and 18 deletions

View file

@ -327,10 +327,7 @@ size_t Game::pick_card(Player& player)
auto prefer_card = [this, &player](Card& card) {
return !other_player_has_lower_value_card(player, card) && other_player_has_higher_value_card(player, card);
};
auto lower_value_card_in_play = [this, &player](Card& card) {
return other_player_has_lower_value_card(player, card);
};
return player.pick_lead_card(move(valid_card), move(prefer_card), move(lower_value_card_in_play));
return player.pick_lead_card(move(valid_card), move(prefer_card));
}
}
auto* high_card = &m_trick[0];