Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: [1]

Author Topic: Penultimate province rule - anyone have the code for rspeer's Dominate?  (Read 2850 times)

0 Members and 1 Guest are viewing this topic.

ancientcampus

  • Navigator
  • ****
  • Offline Offline
  • Posts: 76
  • Respect: +52
    • View Profile
0

Hey, does anyone have the code to implement the penultimate province rule on rspeer's Dominate simulator? Thanks!

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
+2

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.
Logged

ancientcampus

  • Navigator
  • ****
  • Offline Offline
  • Posts: 76
  • Respect: +52
    • View Profile
0

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.

DG

  • Governor
  • *****
  • Offline Offline
  • Posts: 4074
  • Respect: +2624
    • View Profile
+2

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.
Logged

ephesos

  • Explorer
  • *****
  • Offline Offline
  • Posts: 347
  • Shuffle iT Username: Ephesos
  • Respect: +290
    • View Profile
0

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.
« Last Edit: July 28, 2015, 10:55:53 am by ephesos »
Logged
Pages: [1]
 

Page created in 0.039 seconds with 20 queries.