Dominion > Simulation

Dominiate: a Dominion simulator that runs on the Web

(1/63) > >>

rspeer:
Hey all. I've got a new Dominion simulator, and it's made of JavaScript so you can run it right now on the Web (unless your browser sucks)! Here it is: http://rspeer.github.com/dominiate/play.html

Now, this is nowhere near a substitute for Geronimoo's simulator at this point. For one thing, I've only implemented 37-ish Kingdom cards so far (although now that OMG IT WORKS, I can probably get to defining a lot more of them quickly.) It'd also be nice if it had more pre-defined strategies than the few that appear in the dropdown box.

But running on the Web will hopefully make simulation accessible to many more people. Some other interesting differences are:

* AIs can set their own priorities not just for gaining cards, but also actions, trashing, discarding, and so on. Every decision an AI is asked to make can actually be decided by the AI, except for really lame ones like which cards to clean up in which order. Or the decision can be left to the BasicAI, where I hope I've put some reasonable play rules.
* There's a "play until one player dominates" button. It pits two AIs against each other repeatedly until it's 99.7% sure which AI is better. This could take 10 iterations, or it could take 10,000, or it might never stop if the AIs are functionally identical.
* Strategies are designed in a concise form based on CoffeeScript. I don't think you'll need any prior familiarity with CoffeeScript -- you have a bunch of lines that look like this: "Colony" if state.current.countInDeck("Platinum") > 0Notable deficiencies:

* It probably has some terrible/hilarious bugs in it. Sometime around last week I found that the Witch was giving other players Witches instead of Curses, for example. I wonder what I haven't caught yet.
* The Web page only has an interface for 2-player games, even though the command line supports more.
* It doesn't yet do smart things like avoiding suicidal buys, or buying out piles when it's ahead.
* It's unfortunately incompatible with Geronimoo's XML strategies. I code this for fun, and XML is the opposite of fun, but I totally wouldn't mind if someone could help make a translator.
This project is open source, and I really would appreciate help finishing it, because Dominion is a game with a lot of parts to it. Heck, I made all the JavaScript and CSS and stuff work, so implementing more cards and strategies is the fun part. Places to start with that include:

* copious documentation about how the cards are defined
* documentation about how to query / mess with the game state

* The code on GitHub

Davio:
Nice work and good documentation.

I was looking through the card definitions and saw you've forgotten about Princess for the "real" cost calculation:


--- Code: ---getCost: (state) ->
    coins = this.costInCoins(state)
    coins -= state.bridges

// Some of my pseudocode here
if state.princesses > 0 then coins -= 2
// Don't know if it counts TR'd or KC'd cards as multiple played "copies"
// End pseudocode

    if this.isAction
      coins -= state.quarries * 2
    if coins < 0
      coins = 0
    return [coins, this.costInPotions(state)]

--- End code ---

Geronimoo:
OOOhh jealous of your documentation. No way you're a professional IT, they don't make docs  ;)

So do the bots learn to play better while they're playing?

rspeer:

--- Quote from: Davio on September 11, 2011, 07:48:01 am ---Nice work and good documentation.

I was looking through the card definitions and saw you've forgotten about Princess for the "real" cost calculation:


--- Code: ---getCost: (state) ->
    coins = this.costInCoins(state)
    coins -= state.bridges

// Some of my pseudocode here
if state.princesses > 0 then coins -= 2
// Don't know if it counts TR'd or KC'd cards as multiple played "copies"
// End pseudocode

    if this.isAction
      coins -= state.quarries * 2
    if coins < 0
      coins = 0
    return [coins, this.costInPotions(state)]

--- End code ---

--- End quote ---

A bit confusing, I admit. This isn't counting copies of the card (that would be state.current.countInPlay('Bridge'), and it would fail on Throne Rooms and King's Courts).

Instead, there is a value in the state that applies a discount to every card cost, and I call it "bridges". The effect of playing a bridge is to increase the "bridges" value by 1, and the effect of playing a Princess (not that you can get a Princess at the moment...) is to increase it by 2.

rspeer:

--- Quote from: Geronimoo on September 11, 2011, 09:15:43 am ---OOOhh jealous of your documentation. No way you're a professional IT, they don't make docs  ;)

So do the bots learn to play better while they're playing?

--- End quote ---

Not at the moment.

I have two things I want to try with that. One is to define strategies with parameters, and then the bots can learn which parameters win the most.

The other approach is Golem,  a separate project I've got which uses machine learning over all the games in dominionstats to learn which cards are good to buy when. It's definitely a goal I have to hook this up to Golem. But it'll require calls to a separate server, the interface code will be pretty messy, and it'll slow the simulation way down.

Navigation

[0] Message Index

[#] Next page

Go to full version