• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    Haskell
  • License
    Other
  • Created almost 11 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Dominion simulator in Haskell

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.

More Repositories

1

grokking_algorithms

Code for the book Grokking Algorithms (https://amzn.to/29rVyHf)
JavaScript
9,470
star
2

contracts.ruby

Contracts for Ruby.
Ruby
1,441
star
3

mdpress

[DEAD] Make impress.js presentations from markdown files.
CSS
339
star
4

chips

A clone of Chips Challenge in Haskell
Haskell
140
star
5

HandsomeSoup

Easy HTML parsing for Haskell
Haskell
125
star
6

actionkid

A video game framework for haskell
Haskell
46
star
7

salty

Language that transpiles to PHP, JavaScript, and JSX.
Haskell
43
star
8

chisel

Open source writing app
TypeScript
19
star
9

Django-EditArea

Syntax highlighting for the Django admin. This is a Django application that contains a widget to render a form field as an EditArea editor.
JavaScript
15
star
10

groupme-cli

A command-line client for GroupMe.
Haskell
15
star
11

GrabYourWallet

Chrome extension that lets you know if a site you are browsing supports Trump.
JavaScript
14
star
12

rdioh

Rdio API wrapper in Haskell
Haskell
13
star
13

Linear-C--

Linear Algebra for C++.
C++
11
star
14

OpenCV

*NOT* the original! This is my branch of OpenCV.
C++
8
star
15

salmon

A preprocessor for Ruby that adds some Haskell-like syntax
Haskell
8
star
16

Clutter

A quick-to-play language game for Android
Java
7
star
17

console_renderer

A console renderer for Redcarpet
Ruby
5
star
18

luacv

My own fork of luacv (http://sourceforge.net/projects/luacv/)
C++
5
star
19

beeline

Beeline extension for Google Chrome
JavaScript
5
star
20

twss.hs

twss.js to Haskell
Haskell
4
star
21

Schala

Scheme interpreter in Scala.
Scala
4
star
22

Github-Repo-Search

Find the clone url of a repo from the command line.
Ruby
4
star
23

Moon-Curry

Functional programming for Moonscript.
3
star
24

quickpin

Chrome extension to quickly pin things on Pinterest.
JavaScript
3
star
25

fast_struct

A fast implementation of OpenStruct
Ruby
3
star
26

radiobread

A script to generate band name + food puns
Ruby
3
star
27

obvious

A svbtle clone in Haskell.
JavaScript
3
star
28

light_server

Basic Sinatra clone for when you don't want to include a gem.
Ruby
3
star
29

ones

A 2048 clone in Haskell
Haskell
3
star
30

chorewheel

Easy chore scheduling in Ruby
Ruby
2
star
31

reval

Use codepad from the command line.
Ruby
2
star
32

server

http 2.0 experimentation
Ruby
2
star
33

reapply

An experiment with diffs.
Haskell
2
star
34

egonschiele.github.com

JavaScript
2
star
35

makegem

Base template for Ruby gems.
Ruby
2
star
36

smartcheck

Faux static-duck-type-checking for Ruby.
Ruby
1
star
37

Graphable

graph algorithms for Haskell
Haskell
1
star
38

Curry

Better functional programming in Ruby.
Ruby
1
star
39

image_captioner

Describe an image using the MS cognitive sciences API
Ruby
1
star
40

fuzzy_search

Local fuzzy search
Ruby
1
star
41

ritual

Information tracker
Ruby
1
star
42

luaquant

lua bindings for imagequant
C
1
star
43

salt-vim

Adds syntax highlighting and indent support for Salty in vim.
Vim Script
1
star
44

Crypto

My flash game in coffeescript.
JavaScript
1
star
45

nginx

My fork of nginx
C
1
star
46

utils

Utilities for various languages.
Haskell
1
star
47

defundthepolice

HTML
1
star
48

dist

Distributed Hadoop-type thing in Ruby
Ruby
1
star