From UBC Wiki


Authors: Adrian Pikor, Victor Cheng, Janice Wu

What is the problem?

Blackjack is a card game that is also commonly called Twenty-One. The goal of each player is to have the highest score up to 21 points without going over. The game also involves betting money, as it is played in many casinos.

What is the something extra?

What is the in-depth aspect you will do? If the problem is related to some other group's project, tell us how they fit together. If in doubt, include the information.

We implemented an AI inspired by a previous project (https://wiki.ubc.ca/Course:CPSC312-2019/BlackjackSimulator), modifying it to behave in a more general way, as opposed to hard-coding many cases the other group did. We also used a random number generator module (System.Random) to generate random numbers in order to facilitate the random drawing of cards from the deck. Because RNG's are not functional in nature, it had to be used monadically - in our case, inside of the I/O code.

What did we learn from doing this?

What is the bottom-line? Is functional programming suitable for (part-of) the task? Make sure you include the evidence for your claims.

We learned that it is difficult to implement programs that cycle through repetitive stages with many variables to keep track of without the ability to define global variables. We were able to work around this issue by returning a data type that had all the necessary variables for a game of Blackjack to work, however this may be more efficient in a procedural or object-oriented language. Nevertheless, Haskell was suitable for the task of implementing our version of Blackjack.

Links to code etc