• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

egonSchiele/dominion: A Dominion simulator in Haskell

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

egonSchiele/dominion

开源软件地址(OpenSource Url):

https://github.com/egonSchiele/dominion

开源编程语言(OpenSource Language):

Haskell 99.8%

开源软件介绍(OpenSource Introduction):

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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap