Slay the Spire

Slay the Spire

Slay-I
Aphid Jul 13, 2020 @ 3:02pm
Optimize win% instead of damage?
Thinking about this in detail though; maybe we're optimizing the wrong thing. How much damage you take isn't relevant that much: what's relevant is: is this run a win, or a loss? What's my current estimated winrate%? This would require the AI to actually play the game though, not just look at logs. Right now, your scoring function is:

1 point for every point of damage not taken.

When it should have something like this:
1 point for every floor. 1000 points if the Heart is beaten.

I.e. similar to a chess position evaluation (where for AI say pawn is 1, rook is 5, but king is worth 100). Ideally the AI should train itself to play the fights out. See what the win% is for each of the fights in the whole dataset (given the current deck) to be able to say what win% is for an arbitrary deck for all remaining fights. Damage taken would only come in to estimate player health pool in each successive fight*. Add and multiply.

But the current evaluation/estimation of damage taken can be useful in this way:

By modelling HP as a statistical distribution, e.g. a histogram with 200 bins from 0hp to 200hp each being one bin. From an evaluated position one bin has a value of 1, the rest of 0. Then after a fight it becomes a distribution with multiple possible values. The sum total of all the bins of 1hp or more is the cumulative win%.

Once hp hits zero, it remains at zero.

So then the eval function would become something like (with n remaning fights):

Sum of i from 0 to n
f(i) * delta(cumulative WIN%(fight_i(current_situation)))

Where f(i) = i for i in 0...n-1, and f(i)=1000 when i=n (winning the game).

In order to disambiguate cases where Win% is zero for the next fight, bring in the damage taken estimate (i.e. the overkill of the player).

This model would require the result of campfires and events to be included. (When is heal or upgrade chosen?)
Last edited by Aphid; Jul 13, 2020 @ 3:04pm
< >
Showing 1-1 of 1 comments
aldriedger  [developer] Jul 13, 2020 @ 10:27pm 
I'm all for trying out different models and different evaluation functions! All of the code is on GitHub if you're interested in messing around with the model and data to see what it's like when you optimise for win rate instead of damage taken. You could try something like cards, relics, current hp, max hp, ascension, floor => win. Then you would have an active "Chance of winning" score
< >
Showing 1-1 of 1 comments
Per page: 1530 50