nickembrey / dominion

A Dominion simulator in Haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dominion

Build Status

An easy to use Dominion simulator! It allows you to test competing strategies and see what works best.

Screencast

Screenshot

Usage:

import Dominion
import Dominion.Strategies

main = dominion ["adit" `uses` bigMoney, "maggie" `uses` bigMoneySmithy]

Or you can pass in options:

players = ["adit" `uses` bigMoney, "maggie" `uses` bigMoneySmithy]
main = dominionWithOpts [Log True, Iterations 1] players

Strategies

Here's a simple strategy, the "big money" strategy:

bigMoney playerId = playerId `buysByPreference` [province,
                                                 gold,
                                                 duchy,
                                                 silver,
                                                 copper]

The big money strategy is simple: buy the most expensive victory or treasure card you can, and repeat.

bigMoneySmithy playerId = do
    playerId `plays` smithy
    playerId `buysByPreference` [province,
                                 gold,
                                 duchy,
                                 smithy,
                                 silver,
                                 copper]

It's just like big money, except now the player buys up smithys too. And the player plays a smithy whenever possible. So now we can compare Big Money vs Big Money + Smithy. And the results are:

Out of 5000 games:

player adit won 1867 times using "big money"
player maggie won 3133 times using "big money + smithy"

Just as a control, lets use the same strategy with both players:

player adit won 2444 times
player maggie won 2556 times

So clearly, adding the smithy to big money makes a big difference!

Followup actions

Some action cards have a followup action. For example, if you use throne room, you can pick another card and play it twice. Here's how that looks:

throneRoom playerId = do
    playerId `plays` throneRoom `with` (ThroneRoom market)

And of course you can play throne room on throne room:

multiThroneRoom playerId = do
    playerId `plays` throneRoom `with` (ThroneRoom throneRoom) `withMulti` [ThroneRoom market,
                                                                            ThroneRoom market]

Documentation

See the full documentation on Hackage.

About

A Dominion simulator in Haskell

License:Other


Languages

Language:Haskell 99.8%Language:Makefile 0.2%