Dominion Strategy Forum

Dominion => Simulation => Topic started by: ancientcampus on July 23, 2015, 03:25:02 pm

Title: Penultimate province rule - anyone have the code for rspeer's Dominate?
Post by: ancientcampus on July 23, 2015, 03:25:02 pm
Hey, does anyone have the code to implement the penultimate province rule on rspeer's Dominate simulator? Thanks!
Title: Re: Penultimate province rule - anyone have the code for rspeer's Dominate?
Post by: SCSN on July 23, 2015, 04:24:10 pm
I've never been quite sure what people mean by PPR and I strongly recommend against using whatever you think it means over actually thinking the endgame through because in many cases buying the PP is what maximizes your win % even if it "seems risky", but I guess it would be something like this:

Code: [Select]
gainPriority: (state, my) -> [
    "Province" if my.ai.buyProvince(state, my)
[...]

getScore: (state, my) ->
    for status in state.getFinalStatus()
        [name, score, turns] = status
        if name == my.ai.toString()
            myScore = score
        else
            opponentScore = score
    return myScore - opponentScore

buyProvince: (state, my) ->
    scoreDiff = my.ai.getScore(state, my)
    boolDiff = (scoreDiff < 0 and scoreDiff > -3)
    boolPP = (state.countInSupply("Province") == 2)
    return not (boolDiff * boolPP)

The "> -3" part is there because if a Duchy doesn't even put you ahead, your best shot is almost certainly (in a silly BM mirror at least) to buy both Provinces, something that's impossible without buying the penultimate one.

Some brief testing on 40k games of JourneymanBM showed including this PPR rule made no significant difference, which is about what I'd expect because it's so highly situational.
Title: Re: Penultimate province rule - anyone have the code for rspeer's Dominate?
Post by: ancientcampus on July 25, 2015, 03:12:20 pm
I've never been quite sure what people mean by PPR and I strongly recommend against using whatever you think it means over actually thinking the endgame through because in many cases buying the PP is what maximizes your win % even if it "seems risky"

Very good advice. Thanks for the code! Interesting to hear it made no difference in Journeyman BM.
Title: Re: Penultimate province rule - anyone have the code for rspeer's Dominate?
Post by: DG on July 25, 2015, 03:30:08 pm
Journeymen are good at hitting 8 coins in the endgame so the PPR is less relevant. Generally the PPR will add 1-2% to the win rate in a big money game. That not might seem much but remember that the PPR can only be applied in a small percentage of games anyway. The PPR is likely to provide a reasonable advantage in the games where it can be applied.
Title: Re: Penultimate province rule - anyone have the code for rspeer's Dominate?
Post by: ephesos on July 28, 2015, 10:54:12 am
If anywhere, it would be here.

http://rspeer.github.io/dominiate/docs/basicAI.html

Ctrl-F doesn't seem to find any mentions of Province that mention PPR, so odds are it's just not in there.

EDIT: Unless you mean code to implement it for a new strategy that isn't already coded in. Then just go with what SCSN said.