Page 2 of 2

Re: Scry

PostPosted: 29 Jan 2010, 07:01
by Marek14
Rob Cashwalker wrote:Making these abilities function is one thing.... Coming up with some logical rules to make educated plays is insanity.
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.

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

PostPosted: 29 Jan 2010, 07:39
by zerker2000
This "value" would probably be quite useful in many other cases, the most obvious being AI currently picking all discards at random.

Re: Scry

PostPosted: 29 Jan 2010, 09:50
by Marek14
zerker2000 wrote:This "value" would probably be quite useful in many other cases, the most obvious being AI currently picking all discards at random.
Yes, the problem is that card values are all conditional - and I am not very good player so I really can't determine them.

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

PostPosted: 29 Jan 2010, 16:41
by Rob Cashwalker
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$.

Re: Scry

PostPosted: 21 Feb 2010, 01:15
by Chris H.
I finally got around to making a commit with the 4 new scry cards. They look good except for:


The spell description looks like:

Destroy target artifact.Scry 2 (To scry X, look at the top X cards of your library, then put any number of them on the bottom of your library and the rest on top in any order.)
`
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?

Re: Scry

PostPosted: 21 Feb 2010, 04:35
by Rob Cashwalker
The new line thing needs to be in Card.getText, I think.