Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



Dual/Multi Land AI Colour Selection Algorithm
Moderator: CCGHQ Admins
Dual/Multi Land AI Colour Selection Algorithm
by pcastellazzi » 07 Sep 2012, 06:03
For a while i was experimenting with dual lands for DOTP2013. At this moment the current implementation works well.
The implementation is very simple, it presents the user with an ability with a prompt for a colour selection, then it enables the corresponding mana ability.
For humans this works well. But the AI sometimes make bad choices, or do not use them at all.
My question for you guys is what algorithm should be used to make the AI's choice?, and when this algorithm should be applied?
The most simple algorithm should be to do a "chroma count" (the number of mana symbols in all permanentes) in the player's hand minus the number of basic lands in play producing that colour, and the smaller value is the one we generate mana for. Do the check at the end of every step while the land is no tapped.
Any ideas?
The implementation is very simple, it presents the user with an ability with a prompt for a colour selection, then it enables the corresponding mana ability.
For humans this works well. But the AI sometimes make bad choices, or do not use them at all.
My question for you guys is what algorithm should be used to make the AI's choice?, and when this algorithm should be applied?
The most simple algorithm should be to do a "chroma count" (the number of mana symbols in all permanentes) in the player's hand minus the number of basic lands in play producing that colour, and the smaller value is the one we generate mana for. Do the check at the end of every step while the land is no tapped.
Any ideas?
The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen.
— Ben Kuchera, Mordern Warfare 3 review.
— Ben Kuchera, Mordern Warfare 3 review.
-
pcastellazzi - Posts: 184
- Joined: 25 Apr 2012, 00:40
- Location: Montevideo, Uruguay
- Has thanked: 11 times
- Been thanked: 30 times
Re: Dual/Multi Land AI Colour Selection Algorithm
by BlindWillow » 07 Sep 2012, 17:45
thefiremind posted some functions a while back that would automatically assign the mana ability for both human and AI players. I don't see why those couldn't be adapted to AI-only use.
As for when the algorithm should be applied, I would suggest anytime there is a change in the number of cards the AI has in hand (draw, discard, spell played).
As for when the algorithm should be applied, I would suggest anytime there is a change in the number of cards the AI has in hand (draw, discard, spell played).
- BlindWillow
- Posts: 213
- Joined: 19 Jul 2012, 00:26
- Has thanked: 11 times
- Been thanked: 46 times
Re: Dual/Multi Land AI Colour Selection Algorithm
by pcastellazzi » 07 Sep 2012, 18:34
thefiremind's functions gave you the first mana type you can not produce. What i need for this is something that give me the best choice using what you can produce, and what you need as input.
About the when, your idea is good, but it does not take into account paying for activated abilities.
There is a trigger for when a permanent is tapped for mana, i think recalculating when mana is used should give us the best results.
About the when, your idea is good, but it does not take into account paying for activated abilities.
There is a trigger for when a permanent is tapped for mana, i think recalculating when mana is used should give us the best results.
The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen.
— Ben Kuchera, Mordern Warfare 3 review.
— Ben Kuchera, Mordern Warfare 3 review.
-
pcastellazzi - Posts: 184
- Joined: 25 Apr 2012, 00:40
- Location: Montevideo, Uruguay
- Has thanked: 11 times
- Been thanked: 30 times
Re: Dual/Multi Land AI Colour Selection Algorithm
by BlindWillow » 07 Sep 2012, 21:54
There is and...it doesn't work.pcastellazzi wrote:There is a trigger for when a permanent is tapped for mana

There is also the consideration of how much AI contemplation one should allow, as it can slow the game down.pcastellazzi wrote:About the when, your idea is good, but it does not take into account paying for activated abilities.
- BlindWillow
- Posts: 213
- Joined: 19 Jul 2012, 00:26
- Has thanked: 11 times
- Been thanked: 46 times
Re: Dual/Multi Land AI Colour Selection Algorithm
by thefiremind » 08 Sep 2012, 10:06
That trigger only works for lands: the other kinds of permanents don't fire it.BlindWillow wrote:There is and...it doesn't work.pcastellazzi wrote:There is a trigger for when a permanent is tapped for manaI found this out trying to code Elves of Deep Shadow.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests