[Haskell-beginners] Request for Code Review: Dice Game Distribution

Jan Brusch jan.brusch at gmail.com
Sat Nov 12 21:43:13 UTC 2016


Hi,

I'm currently learning Haskell and as a first project I wrote a little
helper for a dice game. It's very short. Nonetheless I would really
appreciate a little Code Review or any other input.

The Game: Each player writes down the numbers from 1 to 42. Each turn you
roll 3 dice (6-sided). The rolling player can cross of any one number that
he can construct from the three dice using the math operators +, -, *, /.
First player to cross off all numbers wins.

The Helper: Calculates the reachable numbers for each dice roll. It the
aggregates a count for each number, from how many dice rolls it can be
reached. E.g.: There are 216 possible dice rolls (6^3), the number 2 can be
reached form 171 of them. The helper gives out the data in JSON format that
can be read by NVD3 to be displayed in a browser. The graph helps you to
make a decision on which number you should prefer to cross off with your
current roll.

The Code: http://lpaste.net/338358

The Graph: http://imgur.com/a/NSDT8


Looking forward to any feedback and thanks in advance
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20161112/d9ab4cbe/attachment-0001.html>


More information about the Beginners mailing list