It is currently 06 May 2024, 21:19
   
Text Size

Teaching the AI to use mana abilities

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Teaching the AI to use mana abilities

Postby zerker2000 » 12 Oct 2009, 01:43

I remember receiving an AI mana pool idea, can someone who knows how the AI works tell me where a mana counting method should be put?
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Teaching the AI to use mana abilities

Postby DennisBergkamp » 12 Oct 2009, 03:08

Ah, this is very funky code, it can be found in ComputerUtil.canPayCost() and also check out ComputerUtil.getAvailableMana().
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Teaching the AI to use mana abilities

Postby zerker2000 » 12 Oct 2009, 03:30

Well, all the mana code I've found so far is quite funky, if it was up to me I'd just store mana costs as strings in oracle format and have manaCost.addMana subtract colored, then split, then colorless mana from the string in that order(and for an AI that uses only basic land abilities, I'd first subtract all colorless mana I can, then all n choice mana in increasing order). Also, I just looked at the code and found a mistype I planted when going through it: ComputerUtil.getAvailableMana should use getBasicMana instead of getManaAbility, and CardUtil.isMana should be exiled(removed from source) along with all auras("if (!CardUtil.isMana(c)) return false;") attached to it.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Teaching the AI to use mana abilities

Postby DennisBergkamp » 12 Oct 2009, 06:06

Ok cool, I've just made these changes.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 19 guests


Who is online

In total there are 19 users online :: 0 registered, 0 hidden and 19 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 19 guests

Login Form