Improve AI decisions using simulator#10559
Improve AI decisions using simulator#10559Madwand99 wants to merge 1 commit intoCard-Forge:masterfrom
Conversation
|
smells like AI with all these tests you've pumped out...? 🤔 anyway this is a bit too much all at once, some noteworthy points:
|
|
Yes, I use AI to create tests. Its very helpful for determining current failure cases that can be handled better. For the rest: thanks, that makes sense. I agree this became too broad for one PR. The intent was not to replace existing heuristics with simulation, but I can see that the current patch blurs that line. The try/catch was added to avoid game-breaking failures during investigation, not as a satisfying long-term answer for unstable simulation. I’m going to split this up. First I’ll pull out the lower-risk simulation/controller and deterministic sacrifice-choice fixes, since those seem useful independently. Then I’ll make the original draw-punisher fix a much narrower heuristic PR, with tests for Wheel/Mindmoil/Puzzle Box style cases. I’ll leave the broader one-play safety checker, swingy score evaluator, and threat-memory cache out for now unless we agree on a smaller experimental shape. I also agree that board-state scoring can imply the wrong answer when simulation is shallow. I’ll avoid using it to override existing superior heuristics in the narrower PRs. |
Summary
This PR improves Forge AI decision-making around plays that look locally reasonable but become disastrous because of triggered/replacement/static effects on the board.
The motivating examples were draw-punisher interactions like casting Wheel of Fortune / Timetwister / Echo of Eons / Mindmoil into Xyris, Nekusar, Kederekt Parasite, or Impact Tremors. The implementation is broader than those specific cards: it adds a one-play safety check, score-delta evaluation hooks, and lightweight threat memory so the AI can avoid more classes of self-destructive plays and better prioritize removal against permanents involved in unsafe outcomes.
Main Changes
Added
OnePlaySafetyCheckerAdded
SwingyPlaySimulationEvaluatorAdded
SafetyThreatMemoryImproved simulation reliability
Improved AI behavior around:
Tests
Added or expanded regression coverage for:
Draw-punisher safety:
Command-zone edge cases:
Simulation-only score validation:
Sacrifice decision behavior:
Board wipes:
Notes / Limitations
This does not fully unify AI decision-making into a single generic “how good is this play?” evaluator. Forge AI still uses a mix of card-specific AI logic, heuristic play selection, and simulation scoring. This PR moves more decisions toward simulation-based evaluation while keeping performance safeguards in place.
The expensive one-play simulation is intentionally gated during normal spell selection. It is only used for actions likely to expose dangerous hidden consequences, such as removal, mass effects, draw under active draw-punishers, sacrifice, token creation, zone changes, and similar reactive effects. This avoids broad performance regressions from simulating every harmless candidate spell.