Improve multiplayer and phasing evaluation in AI simulation - #11462
Improve multiplayer and phasing evaluation in AI simulation#11462Madwand99 wants to merge 8 commits into
Conversation
| int summonSickScore = score; | ||
| PhaseType gamePhase = game.getPhaseHandler().getPhase(); | ||
| for (Card c : game.getCardsIn(ZoneType.Battlefield)) { | ||
| for (Card c : game.getCardsIncludePhasingIn(ZoneType.Battlefield)) { |
There was a problem hiding this comment.
you can't just leave these at the same score though
and even if you would half it AI might still thinking using Oubliette to save own creature would be a good play so I'm not sure this part really works out...
There was a problem hiding this comment.
Agreed that phased-out permanents should not simply receive the same immediate score as active permanents, especially for effects such as Oubliette. An arbitrary partial value would have the opposite problem, though: normal phasing effects such as Clever Concealment would appear to permanently lose the protected cards.
I changed the existing secondary score into a more general availableValue:
value is the strategic score and includes permanents guaranteed to phase in normally.
availableValue excludes phased-out permanents because they cannot currently provide mana, activate abilities, or participate in combat.
Permanents marked WontPhaseInNormal, as with Oubliette, are excluded from both scores.
SpellAbilityPicker uses the available score for its existing “hold this play for later” check, while simulation comparison retains the strategic score. The effect cache is only used when both score deltas agree, avoiding reuse of a result whose immediate and strategic consequences differ.
The tests now prove both sides: Clever Concealment remains acceptable, while using Oubliette on the AI’s own creature is rejected.
There was a problem hiding this comment.
yea this is almost too much together again...though I can understand how one thing can lead to another 😬
will do some manual checks in a bit
Summary
This improves
GameStateEvaluatorfidelity for multiplayer teams, phasing, and eliminated players.Previously, the evaluator assumed every player other than the AI was an opponent. This caused allied cards, life, and permanents to reduce the AI's score. The evaluator now classifies resources using
isOpponentOf()while preserving the existing weighting in normal one-on-one games.Phased-out permanents are also included in long-term board and mana-base evaluation. Since they will phase back in, temporarily phasing a valuable permanent should not be scored as permanently losing it.
Finally, an AI player that has already lost now receives the terminal minimum score even when a multiplayer game continues.
Tests
Added focused coverage confirming that:
Thanks to Codex for help with code and tests!