[AI] Determining if valid targets are available.
Posted: 01 Jul 2016, 05:36
I'm working on building a MonteCarlo AI for X-Mage and I'm having decent amount of success so far.
one of the main issues I am having at the moment is finding a way to restrict spells and abilities that do not have valid targets. I know the code for this exists somewhere (because it's what is used to highlight the card on the player's side) but I cannot seem to find it.
I've determined how to restrict them if you can't pay costs or if there is a timing restriction (non-instants/flash), but a failure to target eludes me.
Currently my AI hits my arbitrarily defined limit of 2000 nodes because it keeps trying to activate Anointer of Champions over and over again outside of combat. It also tries to cast Auras when there are no valid targets, but that's less of an issue since it doesn't try to do that outside of the main phase. The Anointer of Champions being an activated ability can literally be played every phase.
The other issue I'm having is trying to come up with a good way to have the AI test for all combinations of attackers/blockers. I came up with a way that works, but it's quite slow (Although I'm currently not sure if the slowness is mostly because of the Anointer of Champions issue exceeding my depth limits.)
one of the main issues I am having at the moment is finding a way to restrict spells and abilities that do not have valid targets. I know the code for this exists somewhere (because it's what is used to highlight the card on the player's side) but I cannot seem to find it.
I've determined how to restrict them if you can't pay costs or if there is a timing restriction (non-instants/flash), but a failure to target eludes me.
Currently my AI hits my arbitrarily defined limit of 2000 nodes because it keeps trying to activate Anointer of Champions over and over again outside of combat. It also tries to cast Auras when there are no valid targets, but that's less of an issue since it doesn't try to do that outside of the main phase. The Anointer of Champions being an activated ability can literally be played every phase.
The other issue I'm having is trying to come up with a good way to have the AI test for all combinations of attackers/blockers. I came up with a way that works, but it's quite slow (Although I'm currently not sure if the slowness is mostly because of the Anointer of Champions issue exceeding my depth limits.)