Scry
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
21 posts
• Page 2 of 2 • 1, 2
Re: Scry
by Marek14 » 29 Jan 2010, 07:01
Without look-ahead, it's hard... the best I can come up with would be to give each card a function to determine its worth based on the actual game state (simple things, like Goblin King adds points for Goblins on your side, and substracts points for opponent's ones, etc.). I could come up with some plausible ones. Even static numbers would be ok for start.Rob Cashwalker wrote:Making these abilities function is one thing.... Coming up with some logical rules to make educated plays is insanity.
With scry, the algorithm would go like this:
Compute the average value of a card in your library (based on deck contents and cards that are already in other zones).
Every card seen with scry whose value is LOWER than average goes on the bottom.
Cards with HIGHER than average values are left on top, with the highest-valued card first.
Re: Scry
by zerker2000 » 29 Jan 2010, 07:39
This "value" would probably be quite useful in many other cases, the most obvious being AI currently picking all discards at random.
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
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: Scry
by Marek14 » 29 Jan 2010, 09:50
Yes, the problem is that card values are all conditional - and I am not very good player so I really can't determine them.zerker2000 wrote:This "value" would probably be quite useful in many other cases, the most obvious being AI currently picking all discards at random.
But let's say, for example, that a value of land depends on how many lands you already have on the battlefield (i.e. first land has value 10, each other value equal to previous times 0.9). That would give an useful rule when to wish for more lands and when not.
The basic value of a creature could take into account the sum of its power and toughness, since those can change (and frequently do).
Re: Scry
by Rob Cashwalker » 29 Jan 2010, 16:41
The AI doesn't have to discard at random. I wrote an AI routine to discard cards based on certain elements of the game state. Just some basic logic based on lands in play and the ability to play spells in hand. If it seems too dumb, then the great thing is, it only needs to be changed in one place.
The problem with a general value is that it does need to be constantly recalculated anyway, and the value would be different in different scenarios. The value on a 8/8 monster is different when deciding to discard on turn 3 or deciding to attack with it, or deciding on using it for a sacrifice effect.
A number of these types of decisions are too card-specific, so the AI for those decisions is localized. Some of the situations can be generalized into a central method, so we at least have consistency and a bit of code reduction. Like I did with discard... however, I did not change any of the existing spells that involve discard decisions, and I don't know of any new code that has made use of it other than when discard is used as a Drawback$.
The problem with a general value is that it does need to be constantly recalculated anyway, and the value would be different in different scenarios. The value on a 8/8 monster is different when deciding to discard on turn 3 or deciding to attack with it, or deciding on using it for a sacrifice effect.
A number of these types of decisions are too card-specific, so the AI for those decisions is localized. Some of the situations can be generalized into a central method, so we at least have consistency and a bit of code reduction. Like I did with discard... however, I did not change any of the existing spells that involve discard decisions, and I don't know of any new code that has made use of it other than when discard is used as a Drawback$.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Scry
by Chris H. » 21 Feb 2010, 01:15
I finally got around to making a commit with the 4 new scry cards. They look good except for:
The spell description looks like:
I am assuming that the spell description builder code needs to add a new line to the end and that this will take care of this merging of the two text strings. Is that a good idea or am I missing something?
- Tel-Jilad Justice
1 G
Instant
Destroy target artifact.
spDestroyTgt:Artifact
Scry 2
The spell description looks like:
`
I am assuming that the spell description builder code needs to add a new line to the end and that this will take care of this merging of the two text strings. Is that a good idea or am I missing something?
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Scry
by Rob Cashwalker » 21 Feb 2010, 04:35
The new line thing needs to be in Card.getText, I think.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
21 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 29 guests