Dominion Strategy Forum

Dominion => Simulation => Topic started by: NolanA on August 15, 2016, 01:42:15 am

Title: Is Geronimoo's Simulator Open Source?
Post by: NolanA on August 15, 2016, 01:42:15 am
I saw Geronimoo's simulator on GitHub, but the project hasn't been updated in 5 years, so I am assuming it is not the current version.  Is there a more recent open source version?  Or is the simulator private?

I ask because I am interested in making some minor updates to support modifying the default rules for how a few cards are played, ideally making them user configurable.  For example, consider a Festival/Library/Chapel/... engine where the sim draws a hand of Throne Room, Festival, Festival, Library, Chapel. It's my understanding that the sim's 1st choice is to Throne Room the Chapel (even though there is nothing in hand to trash), 2nd choice is to Throne Room the Library, and last choice is to Throne Room the Festival.  This type of Throne Room play strategy can have a tremendous influence on sim results, often making Throne Room appear to be a weak card in situations where it could be quite valuable with a different play strategy.
Title: Re: Is Geronimoo's Simulator Open Source?
Post by: ephesos on August 15, 2016, 03:06:07 am
If you want configurable play rules, rspeer's Dominate is still up. It's not completely up to date with the latest expansion, but it definitely has all the Base cards.

The way to change the Throne Room order is like this(from a bot I did a while ago to do the KC/Goons/Masq pin)
Code: [Select]
multipliedPriority: (state, card, my) -> [
    "King's Court"
    "Goons"
    "Masquerade"
    "Chapel"
  ]
where priority is top to bottom
Title: Re: Is Geronimoo's Simulator Open Source?
Post by: DG on August 18, 2016, 06:31:16 pm
I'm guessing you seen this and there's nothing more I can say about the source https://dominionsimulator.wordpress.com/category/uncategorized/ (https://dominionsimulator.wordpress.com/category/uncategorized/).

The changes you are suggesting to the card play rules are not minor. It is far easier to make a direct decision, such as play the cards in a set priority order, than make a subjective decision based on an 'if I play this then this other card will do that'. You would potentially need to go through a lot of evaluation to evaluate hands of {throne room, smithy, festival, smithy, smithy}, {throne room, spy, smithy, festival, conspirator}, {throne room, throne room, spy, smithy, festival}, and so on. My advice would be to look for improvements, sure, but try to keep the decisions rules simple using basic evaluations of the current game state.
Title: Re: Is Geronimoo's Simulator Open Source?
Post by: NolanA on August 19, 2016, 03:03:33 am
Yes, that is the code I was referring to .  The GitHub page says it hasn't been updated in 5 years, so I assume it is not the most recent version.  I think a setup with a configurable Throne Room priority, like is supported the Dominiate simulator would be a great addition, however, I agree that it would not be a minor change.  Skimming through the code, an alternative that I would consider to be a more minor change, would be to display a selection of strategy options to choose from for Throne Room (and/or King's Court), like occurs with many of the other cards.   Those strategies option could be a simple, complex, broad, or general as desired. A broad strategy might have a few general rules that can override priorities like favoring + actions when you need extra actions to play other cards in hand, only throne rooming trashing when there are num times things you want to trash, etc.  It wouldn't be perfect, but it would be enough for Throne Room to shine in many situations where it does not with the existing sim.  Another broad strategy could be selected from the piulldown for other cases where these rules and the existing default both don't work well.   I'd be interested in adding similar strategy options for a couple other cards.   For example, it would be interesting to see whether Chancellor could become more useful in sims, with an option to avoid discarding your deck when a powerful card is ready to be drawn or when you've added a lot of green to your deck, instead of always discarding.

Another Throne Room / King's Court alternative that I think would not be that complex would be to add a MultiplicationCardPriority number for each card instead of using the general play priorities that aren't ideal for Throne Room / King's Court, such as ranking Chapel and Libaray ranking higher priority than Festival, in my earlier example.   Sure, there are a few cases where you want to Throne Room a Chapel, but the vast majority of times both Library and Chapel would be lower priority than Festival, and could be ranked that way in the MultiplicationCardPriority numbers.  However, this type of update would be a pain because of the large number of cards, rather than the complexity.  There may also be other issues that I am not aware of.

That said, I am really impressed by Geronmioo's simulator, and do not intend to come off as criticizing.  It is an outstanding piece of code that is very well written and well documented.  I think it's superior to the vast majority of professional code I've seen at tech companies.  This relates to why I'm interested in updating Geronimoo's sim instead of just using the existing Dominiate sim that already supports this.  I prefer the additional features, ease of building complex sims,  and faster run time with Geronmioo's sim.
Title: Re: Is Geronimoo's Simulator Open Source?
Post by: Geronimoo on August 23, 2016, 12:13:53 pm
Thanks for the kind words NolanA. I put a lot of time and thinking into my simulator. I decided to clear the github repo and started from scratch. Here's the new github:

https://github.com/Geronimoo/DominionSim

So the code is up to date and I plan to keep it up to date on github. There's maven support (a pom file).
Title: Re: Is Geronimoo's Simulator Open Source?
Post by: NolanA on August 31, 2016, 02:04:36 am
Thanks, I really appreciate putting the updated sim online, and the Maven support file helped gets things started.  It's exactly what I was looking for and opens the door to simulating some kinds of alternative strategies, like I was looking for. 

By the way, I initially wasn't able to compile because of the line below in the Segway card file.  As I understand the code, I believe gain() is looking for a DomCardName type input, while placePlusOneBuyToken() is returning a type void; which caused problems with the compiler I am using in Net Beans IDE. 
I'm not planning to do anything with Segway, so this is not a big deal for me, but it might cause issues for others who download the code.

owner.gain(owner.placePlusOneBuyToken());