
Hi, I've just released version 1.1 of my game-probability library. It's intended to be an easy way to investigate the probability of various dice rolls and card draws (the latter is the new addition for the 1.1 release), using a Haskell library/EDSL. It has various examples in the documentation, plus a few blog posts on its design (all links below). Hackage: http://hackage.haskell.org/package/game-probability Docs (while waiting for Hackage to generate): http://twistedsquare.com/game-probability-1.1/ Blog posts: http://chplib.wordpress.com/2010/08/13/nice-dice-in-haskell/ http://chplib.wordpress.com/2010/08/23/sharp-cards-in-haskell-drawing-cards/ http://chplib.wordpress.com/2010/09/08/sharp-cards-in-haskell-the-odds/ As a quick taster, below are some examples of using the library. Showing the probabilities of a dice roll prints out a bar chart -- here is the sum of two six-sided dice:
show (2 * d6) 2 : # 3 : ## 4 : ### 5 : #### 6 : ##### 7 : ###### 8 : ##### 9 : #### 10: ### 11: ## 12: #
Querying probabilities of the outcomes of dice rolls:
chancePred (>= 16) (3*d6) 5 % 108
The chance of drawing different numbers of Copper cards in a starting hand of 5 drawn from 7 Copper and 3 Estate (this is from the card game Dominion):
chanceMap (makeCards $ replicate 7 "Copper" ++ replicate 3 "Estate") (drawCount (== "Copper") 5) fromList [(2,1 % 12),(3,5 % 12),(4,5 % 12),(5,1 % 12)]
Thanks, Neil.
participants (1)
-
Neil Brown