Dominion Strategy Forum

Dominion => Simulation => Topic started by: rspeer on August 08, 2012, 09:53:46 pm

Title: Simulating Dark Ages
Post by: rspeer on August 08, 2012, 09:53:46 pm
I've got Feodum, Sage, Poor House, and kind of Graverobber implemented in Dominiate (http://rspeer.github.com/dominiate). I say "kind of Graverobber" because the code is crappy -- it kind of lumps the two decisions on the card into one. I should do it better soon.

Today's cards are going to be a bit tricky, and I can't really do Looters and Ruins until we know what the Ruins are.

I haven't spent much time trying out strategies with these yet. The easy one I found is that Sage/Jack (or as I've named it, "Sajak") is slightly better than double Jack.

Chapel/Feodum with a custom trashPriority could be fun. Any other ideas for simulator strategies?
Title: Re: Simulating Dark Ages
Post by: blueblimp on August 08, 2012, 10:43:15 pm
Someone in one of the Dark Ages threads suggested Chapel/Poor House/Village. Chapel everything, get some combination of Poor Houses and Villages, and aim for double-PH Province turns. I implemented Poor House locally in Dominiate and my quick-and-dirty bot beats BMU at least:
Code: [Select]
# Chapel away Coppers and Estates to enable $4 Poor Houses,
# buy Villages, and aim for double-PH turns for Province.
{
  name: 'ChapelPoorHouseVillage'
  requires: ['Chapel', 'Poor House', 'Village']
  gainPriority: (state, my) -> [
    # Open Village/Chapel. We can afford Poor Houses easily later,
    # and opening Village helps ensure we trash 4 cards.
    "Village" if my.countInDeck("Village") == 0 and my.turnsTaken <= 2
    "Chapel" if my.countInDeck("Chapel") == 0 and my.turnsTaken <= 2

    "Province"
   
    "Village" if my.countInDeck("Poor House") > my.countInDeck("Village")
    "Poor House"
  ]

  actionPriority: (state, my) -> [
    # The default plays Poor House instead of Chapel, even when we want to
    # trash.
    "Chapel" if wantsToTrash
  ]
}
It would probably be stronger with Worker's Village.

(Actually this reminds me that Dominiate's play priority for "Chapel if wantsToTrash" might need a bump up, because it'll prefer to play a terminal-Silver rather than Chapel when they collide.)

Edit: This might do better if explicitly instructed to trash all its Coppers, not just 3 of them.

Edit 2: Also, it seems like actionPriority does not work anymore. It needs to be called "playPriority". Also "wantsToTrash" should be "this.wantsToTrash(state)". And this revealed a flaw, which is that Village should of course get played before Chapel. Fixed version, which is better:
Code: [Select]
# Chapel away Coppers and Estates to enable $4 Poor Houses,
# buy Villages, and aim for double-PH turns for Province.
{
  name: 'ChapelPoorHouseVillage'
  requires: ['Chapel', 'Poor House', 'Village']
  gainPriority: (state, my) -> [
    # Open Village/Chapel. We can afford Poor Houses easily later,
    # and opening Village helps ensure we trash 4 cards.
    "Village" if my.countInDeck("Village") == 0 and my.turnsTaken <= 2
    "Chapel" if my.countInDeck("Chapel") == 0 and my.turnsTaken <= 2

    "Province"
   
    "Village" if my.countInDeck("Poor House") > my.countInDeck("Village")
    "Poor House"
  ]

  playPriority: (state, my) -> [
    # The default plays Poor House instead of Chapel, even when we want to
    # trash.
    "Village"
    "Chapel" if this.wantsToTrash(state)
    "Poor House"
  ]

  trashPriority: (state, my) -> [
    "Curse"
    "Copper"
    "Estate"
  ]
}
Title: Re: Simulating Dark Ages
Post by: zahlman on August 08, 2012, 11:54:54 pm
I'd be interested in seeing how Chapel/PH/Village does against Remake/PH/Village (Remaking Copper->PH and Estate->Village). :)
Title: Re: Simulating Dark Ages
Post by: eHalcyon on August 09, 2012, 12:04:17 am
I still think TR would be a better enabler for a PH strategy.
Title: Re: Simulating Dark Ages
Post by: blueblimp on August 09, 2012, 01:31:56 am
I still think TR would be a better enabler for a PH strategy.
Trying this turns up what looks like a bug in Dominiate's Throne Room:
Code: [Select]
ChapelPoorHouseThroneRoom draws 5 cards: [Poor House, Throne Room, Throne Room, Poor House, Chapel].

...


== ChapelPoorHouseThroneRoom's turn 11 ==
ChapelPoorHouseThroneRoom plays Throne Room.
...playing Throne Room (1 of 2).
...playing Poor House (1 of 2).
ChapelPoorHouseThroneRoom reveals the hand ([Poor House, Chapel]).
...playing Poor House (2 of 2).
ChapelPoorHouseThroneRoom reveals the hand ([Poor House, Chapel]).
...playing Poor House (2 of 2).
ChapelPoorHouseThroneRoom reveals the hand ([Poor House, Chapel]).
Coins: 12, Potions: 0, Buys: 1
ChapelPoorHouseThroneRoom buys Province.
(ChapelPoorHouseThroneRoom shuffles.)
ChapelPoorHouseThroneRoom draws 5 cards: [Province, Poor House, Province, Chapel, Throne Room].
It should be impossible to have $12 on this turn (instead of $16 or $8), unless I goofed my Poor House coding somehow (possible!).

Edit: Seems to be a variable-shadowing issue. CoffeeScript interprets the code
Code: [Select]
action = state.current.ai.choose('multiplied', state, choices)
(in the King's Court implementation) as an assignment to the global variable "action" (which is supposed to be a base card type for cards to derive from), not as a declaration of a local variable.

Edit 2: I submitted an issue on GitHub.
Title: Re: Simulating Dark Ages
Post by: zahlman on August 09, 2012, 02:22:18 am
Edit: Seems to be a variable-shadowing issue. CoffeeScript interprets the code
Code: [Select]
action = state.current.ai.choose('multiplied', state, choices)
(in the King's Court implementation) as an assignment to the global variable "action" (which is supposed to be a base card type for cards to derive from), not as a declaration of a local variable.

In Javascript, you need the 'var' keyword to get a local variable. I suspect it's the same in CoffeeScript.
Title: Re: Simulating Dark Ages
Post by: blueblimp on August 09, 2012, 11:32:48 am
Edit: Seems to be a variable-shadowing issue. CoffeeScript interprets the code
Code: [Select]
action = state.current.ai.choose('multiplied', state, choices)
(in the King's Court implementation) as an assignment to the global variable "action" (which is supposed to be a base card type for cards to derive from), not as a declaration of a local variable.

In Javascript, you need the 'var' keyword to get a local variable. I suspect it's the same in CoffeeScript.
It's not the same in CoffeeScript (http://coffeescript.org/#lexical_scope):
Quote
Because you don't have direct access to the var keyword, it's impossible to shadow an outer variable on purpose, you may only refer to it. So be careful that you're not reusing the name of an external variable accidentally, if you're writing a deeply nested function.
So yes, they replaced JavaScript's misfeature of implicit globals with a (arguably worse) misfeature of implicit-local-unless-it's-global-already.
Title: Re: Simulating Dark Ages
Post by: Kelume on August 09, 2012, 01:26:55 pm
Whipped up a simple Remake/Poor House/FV bot that goes around 50/50 with the built in DoubleJack. Very cool and probably easily improvable. :)

Code: [Select]
{
    name: 'Remake Poor House FV'
    author: 'Kelume'
    requires: ["Remake", "Poor House", "Fishing Village"]
    gainPriority: (state, my) -> [
        "Province"
        "Duchy" if state.gainsToEndGame() <= 5
        "Estate" if state.gainsToEndGame() <= 2
        "Remake" if my.countInDeck("Remake") < 1
        "Poor House" if my.countInDeck("Fishing Village") > my.countInDeck ("Poor House")
        "Fishing Village"
    ]
}
Title: Re: Simulating Dark Ages
Post by: zahlman on August 09, 2012, 02:47:09 pm
Whipped up a simple Remake/Poor House/FV bot that goes around 50/50 with the built in DoubleJack.

:O

I think that's better than I expected. (Granted, DoubleJack doesn't really show its true strength against a non-Attack deck...)
Title: Re: Simulating Dark Ages
Post by: WanderingWinder on August 09, 2012, 03:16:18 pm
Well, FV+Jack beats double-jack......
Title: Re: Simulating Dark Ages
Post by: GendoIkari on August 10, 2012, 06:01:27 pm
Well, FV+Jack beats double-jack......

Really? I guess it's largely because Jack is "draw up to X"; but I thought as a general rules, FV was a trap if you aren't using a bunch of terminals.
Title: Re: Simulating Dark Ages
Post by: WanderingWinder on August 10, 2012, 08:06:09 pm
Well, FV+Jack beats double-jack......

Really? I guess it's largely because Jack is "draw up to X"; but I thought as a general rules, FV was a trap if you aren't using a bunch of terminals.
Yeah, it's the draw-up-to-X thing. And FV is not SO much weaker anyway, just a little bit.
Title: Re: Simulating Dark Ages
Post by: zahlman on August 11, 2012, 04:26:32 am
It's still kind of surprising, though. To get the full benefit from FV-Jack, you want them to collide, and this is a no-trashing BM deck. To get the full benefit from DoubleJack, you want them to not collide, and they are helping you out with that quite a bit by flooding you with Silver.
Title: Re: Simulating Dark Ages
Post by: qmech on August 11, 2012, 04:50:56 am
You can still by two Jacks: the idea is just to buy Fishing Villages instead of Silver.  The simulator likes DoubleJack/FV > SingleJack/FV > DoubleJack.
Title: Re: Simulating Dark Ages
Post by: Grujah on August 11, 2012, 06:26:02 am
Yeah, this is how I play FV/Double Jack -

Buy a Province
Buy a Gold
If #ofJacks < 2, Buy a Jack
Buy a Fishing Village


Always play all of your FVs, discard them with Jack only if you lack actions. Also you probably want to discard Jack with Jack most of the time, if that collision happens. Trash Estates, of course.
Title: Re: Simulating Dark Ages
Post by: Beyond Awesome on August 17, 2012, 01:27:51 am
How fast is Scavenger/Stash?

Should you pick up three Scavenger's or an extra Stash if need be? I think the answer is no, but I'm curious to see what the simulator says
Title: Re: Simulating Dark Ages
Post by: kn1tt3r on August 17, 2012, 02:16:49 am
How fast is Scavenger/Stash?

Should you pick up three Scavenger's or an extra Stash if need be? I think the answer is no, but I'm curious to see what the simulator says
I think a third Scavenger does no harm because once you have the thing running it won't hurt you anyway. The fourth Stash, however, should be rather a Duchy I think.
Title: Re: Simulating Dark Ages
Post by: rspeer on August 17, 2012, 02:33:01 am
I apologize, but I'm going to stop tweaking Dominiate for at least this week, even though all the new information is out. I'd rather have that time to enjoy Isotropic while it's still around, and to try out playing Dark Ages myself if I get the chance to. I'm sure you understand.

So unless some other cool person steps up to add cards like Scavenger, we can only speculate.

And of course things like Band of Misfits and Knights are going to be crazy to implement.