It is currently 10 May 2025, 08:31
   
Text Size

Dual/Multi Land AI Colour Selection Algorithm

Moderator: CCGHQ Admins

Dual/Multi Land AI Colour Selection Algorithm

Postby 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 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.
User avatar
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

Postby 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).
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

Postby 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.
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.
User avatar
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

Postby BlindWillow » 07 Sep 2012, 21:54

pcastellazzi wrote:There is a trigger for when a permanent is tapped for mana
There is and...it doesn't work. :x I found this out trying to code Elves of Deep Shadow.
pcastellazzi wrote:About the when, your idea is good, but it does not take into account paying for activated abilities.
There is also the consideration of how much AI contemplation one should allow, as it can slow the game down.
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

Postby thefiremind » 08 Sep 2012, 10:06

BlindWillow wrote:
pcastellazzi wrote:There is a trigger for when a permanent is tapped for mana
There is and...it doesn't work. :x I found this out trying to code Elves of Deep Shadow.
That trigger only works for lands: the other kinds of permanents don't fire it.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 722 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 6 guests


Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 6 guests

Login Form