Course:CPSC312/DiceRoller
What is the problem?
Dice rolling is used in a variety of environments such as being supplemental to games and other forms of statistical and math research. Creating a program that can handle a variety of arbitrary dice rolls would be useful in that regard.
We handle a variety of roll types including Kst lowest and highest value, and all K highest or lowest rolls.
What is the something extra?
We implemented a small lottery game called Need Before Greed.
Need Before Greed is a lottery "game" inspired by the World of Warcraft loot distribution system of the same name. Players decide if a particular item is something they "Need" or it’s something they'd just like to sell (Greed). The option to pass is also included in case of future expansion to make this a timed event. Need Rolls will always take precedence over Greed Rolls.
What did we learn from doing this?
We learned how to separate the IO from the logic of the program as much as possible in order to keep the functions simple and concise. As they say: "What happens in IO stays in IO."
We learned how to use Maybe as a form of exception and error handling such that our program does not crash and stays functional even with invalid inputs.
We learned of the advantages and disadvantage of working with a functional language: because everything is a function you can easily pass most things as arguments which makes folding and mapping very effective solutions to problems which might require more overhead in other languages.
On the other hand, as a purely functional language manipulating variables is an impossibility so the usage of "states" which must be passed recursively becomes a necessity which depending on how you design your program can end up causing more overhead than it saves.
Links to code etc
https://github.com/Jcnator/CPSC312Project
Libraries used:
http://hackage.haskell.org/package/random-1.1/docs/System-Random.html