summaryrefslogtreecommitdiff
path: root/Userland/Games
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-01 00:06:16 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-01 08:52:08 +0200
commit4a8d8da46c6e7d1dd6077eae75e8f2e056687f97 (patch)
tree309f10939aaeaf92f0053f8ab72b38f2d088104f /Userland/Games
parent2b2d992946f52357b9023ed78870f176019ce808 (diff)
downloadserenity-4a8d8da46c6e7d1dd6077eae75e8f2e056687f97.zip
Hearts: Make debugging AI suggestions easier
When building Hearts with HEARTS_DEBUG we highlight the card the AI would have picked. This makes comparing AI and human decisions easier.
Diffstat (limited to 'Userland/Games')
-rw-r--r--Userland/Games/Hearts/Game.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp
index 8952ec2e3b..fd19ade0bc 100644
--- a/Userland/Games/Hearts/Game.cpp
+++ b/Userland/Games/Hearts/Game.cpp
@@ -397,6 +397,11 @@ void Game::let_player_play_card()
if (player.is_human) {
m_human_can_play = true;
+ if constexpr (HEARTS_DEBUG) {
+ auto card_index = pick_card(player);
+ auto& card = player.hand[card_index];
+ card->set_inverted(true);
+ }
update();
return;
}