magefree / mage

Magic Another Game Engine
http://xmage.today
MIT License
1.86k stars 761 forks source link

AI keeps spamming Basalt Monolith untap ability and other AI problems #10197

Open TakeHeedStruggler opened 1 year ago

TakeHeedStruggler commented 1 year ago

The Ai keeps spamming the untap ability of Basalt Monolith, resulting in stalled games

spjspj commented 1 year ago

This has been an issue for at least 7+ years :) The solution is to not give the AI complicated decks with cards like basalt monolith.

JayDi85 commented 1 year ago

Xmage has some logic to protect from AI repeated action. Maybe it can be improved.

jeffwadsworth commented 1 year ago

I had the GPT models look for alternative ways to validate repeat actions but nothing worthwhile came of it. So, my advice is to wait for a GPT or Open-Assistant AI player API, or just don't let the current AI have the card. GPT-4 can play a board state incredibly well. gpt4Analysis

JayDi85 commented 4 months ago

[[Basalt Monolith]]

github-actions[bot] commented 4 months ago

Basalt Monolith - (Gatherer) (Scryfall) (EDHREC)

{3} Artifact Basalt Monolith doesn't untap during your untap step. {T}: Add {C}{C}{C}. {3}: Untap Basalt Monolith.

JayDi85 commented 4 months ago

Added reproduceable AI test in e3de777bd564e7685bd1376641ad61ec86666d1c.

Manual test (AI will randomly activates an untap ability before creature cast):

[test Basalt Monolith]
battlefield:Computer:Basalt Monolith:2
hand:Computer:Aesthir Glider:1
JayDi85 commented 4 months ago

Basalt Monolith catches three different problems (combination of problems):

  1. [x] 1 - Wrong search for repeated actions in calculated actions chain - so it try to use it multiple times. Can be fixed. Can be related to 3 (see below);
  2. [x] 2 - AI randomly (50%) ignore actions chain result - it's randomly stop possible actions chain. It's look like "oh, I forget about that combo or target combination". Must be disabled on debug. I don't think it has bad effect on gameplay - but it helps to choose different targets/abilities on each activation;
  3. [x] 3 - AI don't have tools to find "do nothing" abilities (abilities that has same game score). Need more research. I think it can be related to stack usage -- cause it generates two actions (first activating with minus score to put card from hand to stack or tap, second pass/resolve with plus score to put card to other zone or untap). Possible solution: use stack zone to calculate game score.
JayDi85 commented 4 months ago
  1. [x] 4 - AI code uses weird best node (game simulation) searching with direct data replaces from one game to another (buggy optimization). So it lost all best chain actions if it was second+ (e.g. if it found best node second+ time then it lost all child nodes). Must clear childs after whole level finish.
  2. [x] 5 - AI must find better actions chain (combo of abilities to activate). But for some reason it doesn’t use it after calc. In many real games/tests AI will use only first calculated action (still from a better chain) and will ignore left actions (but must continue to execute it). Maybe related to wrong game hash, data lost from 4 (see above), or it’s made by design.
JayDi85 commented 4 months ago
JayDi85 commented 4 months ago

Example: shot_240602_111932

JayDi85 commented 4 months ago
JayDi85 commented 3 months ago