Card-Forge / forge

An unofficial rules engine for the world's greatest card game.
https://card-forge.github.io/forge/
GNU General Public License v3.0
1.01k stars 569 forks source link

AI would rather kill a Sakura-Tribe Elder than a more valid target #4025

Open MorihiroS opened 1 year ago

MorihiroS commented 1 year ago

Describe the bug AI would rather kill Sakura-Tribe Elder than Noble Hierarch, for example, which makes no sense.

To Reproduce Steps to reproduce the behavior:

  1. Player casts Sakura-Tribe Elder and Noble Hierarch.
  2. AI casts Lightning Bolt and targets Sakura-Tribe Elder.

Expected behavior Sakura-Tribe Elder and similar should be at the bottom of AI's priority for destruction or exile.

Desktop OS: Windows 10 Java Version: 1.8.0_202-b08 Forge Version: 1.6.59-SNAPSHOT-10.28

Screenshots

sakura

Agetian commented 1 year ago

The priority system in the current AI is pretty tough to get right, it doesn't prioritize individual cards for the most part (e.g. a Sakura-Tribe Elder as a unique card), but rather tries to "weigh" each card's properties relevant to each other. I tested this in the debugger and their evaluation is pretty similar, though granted, Noble Hierarch evaluates higher (Noble Hierarch evaluates to a score of 151 and Sakura-Tribe Elder to 146). In my experiment, just asking the AI to bolt one of these two cards will result in the AI bolting the Hierarch (which is correct), but in this case, perhaps, it was done in response to the Human activating the ability on the Elder, which may have tipped the AI that the effect is of some potential value to the player, thus adding some extra score to the evaluation, which was what brought about this result. I'll see if I can tweak this in some way in the future, but basically, there will always be evaluation corner cases where contextually the AI will make a stupid choice like that, and usually tweaking things one way or the other will simply change the corner cases (thus, e.g., the AI will make the right decision in this case, but then do something very stupid elsewhere, haha)

MorihiroS commented 1 year ago

@Agetian,

but in this case, perhaps, it was done in response to the Human activating the ability on the Elder, which may have tipped the AI that the effect is of some potential value to the player, thus adding some extra score to the evaluation, which was what brought about this result.

No, I activated Sakura-Tribe Elder's ability in response to Lightning Bolt already

The priority system in the current AI is pretty tough to get right, it doesn't prioritize individual cards for the most part (e.g. a Sakura-Tribe Elder as a unique card), but rather tries to "weigh" each card's properties relevant to each other. I tested this in the debugger and their evaluation is pretty similar, though granted, Noble Hierarch evaluates higher (Noble Hierarch evaluates to a score of 151 and Sakura-Tribe Elder to 146). In my experiment, just asking the AI to bolt one of these two cards will result in the AI bolting the Hierarch (which is correct)

I double-checked. Indeed, AI casts Rift Bolt on Noble Hierarch, not on Sakura-Tribe Elder.

sakura3

But after Noble Hierarch dies, Sakura-Tribe Elder and Birds of Paradise remain on the battlefield and AI casts its next Lightning Bolt on Sakura-Tribe Elder. It doesn't bolt the bird!!!

sakura4

And that's the problem. A creature that has the ability to sacrifice itself at no additional cost (Sakura-Tribe Elder, Alchemist's Apprentice, Bile Urchin, Bottle Gnomes, etc.) should be much lower in priority, not a nominal 146, but a nominal 46 score. It's more profitable to cast Lightning Bolt on a player than on such a creature.

The issue remains that this creature could be a one-time blocker, but spending 3 damage to attack with a creature with 2-3 power is impractical. Or, for example, player can save Sakura-Tribe Elder for additional landfall trigger.

Agetian commented 1 year ago

Ah, true, agreed! I'll tweak the priority system to account for self-sacrifice costs :+1:

MorihiroS commented 11 months ago

AI is also trying to cast Path of Exile on Sakura-Tribe Elder....

sakura

github-actions[bot] commented 10 months ago

This issue has not been updated in a while and has now been marked as stale. Stale messages will be auto closed.

MorihiroS commented 10 months ago

@Hanmac, need keep label and assign Agetian, pls

MorihiroS commented 2 months ago

Ah, true, agreed! I'll tweak the priority system to account for self-sacrifice costs 👍

@Agetian, I want to clarify, before the spoilers of the new set begin and your forces aren't directed towards them. This issue of priority is very relevant for me, because AI ​​spends its removal, essentially, for nothing. Is it possible to correct this?