Course:CPSC312-2023/Random Uno
Authors: Nicholas, Usman, Arden
What is the problem?
We are creating an implemention on Haskell of Random Uno. Uno is a card game in which cards are played from a players hand by laying them face up on a pile. The players goal is to empty their hand of cards. The game ends when any player has an empty hand, therefore they win! Usually, Uno is played with a deck of 112 preset cards, however Random Uno is played with an infinite amount of randomly generated cards, so you have the possibility of drawing all +2's!
If the more traditional style of Uno is more your style, we also created a simple Uno game using the preset cards. Try out both for the most fun!
What is the something extra?
We are planning on also implementing an AI, which in this case, would be able to play a non-zero sum (not predictable) game.
What did we learn from doing this?
Through the trials and tribulations of creating our project, we have had some learning goals that stand out from the rest, they are listed here:
- As a result of the randomness in our game, we learned the drawbacks of Haskell being a pure language. The randomness in our game forced us to use much more IO than we initially intended to.
- We got a lot of experience threading because of our game's inherent structure, and since functional programming promises that no unexpected side effects can occur while the state is being threaded, it creates a secure way to update the game's world.
- The strict type checking of Haskell allowed us to easily debug and parameterize our data structures.
Overall, we feel as though Haskell is partially suitable for the task. In this implementation of Random Uno, we found it very difficult to introduce the random components of the game without instilling IO into the core of the game state, which is a drawback to the pure nature of Haskell. On the other hand, Haskell's pure nature allowed us to template/use MagicSum.h and Play.hs to abstract out the core foundation for Random Uno. For these reasons, we feel that Haskell is suitable for making the interface for user interaction, as we only had to make some changes to Play.hs for it to work with Random Uno, but not for making a logically complex game that would take away from Haskell's fundamental principles.
Getting graphics working we another difficult part of our task. Our implementation used Haskell bindings to a C graphics library, which ended up working well and demonstrating that Haskell can work together with other languages.