Blackjack

From UBC Wiki

Authors: Clinton, Winston

What is the problem?

We will implement a functional version of Blackjack on Haskell.

More information about the game can be found here:

https://en.wikipedia.org/wiki/Blackjack

What is the something extra?

We will implement Card counting, an accumulator which will keep count of the value of cards currently played. This strategy is meant to give the user a probable advantage against the bank.

More information about this strategy can be found here:

https://en.wikipedia.org/wiki/Card_counting

What did we learn from doing this?

We used the class lecture games (most noticeably MagicSum.hs and Play.hs) as a basis for our data type constructors and IO type. We then implemented the game by following the procedures given to us by the Wikipedia page on Blackjack. Figuring out how to implement IO was the most challenging part, as we spend countless hours through trial and error to figure out which functions were required to return an IO type since we implemented the smaller functions first.

1) Rather than using a Card data type to build a deck, we used a list of Int with numbers 1 to 13 as a single suit, with 4 suits in a deck because the suit of a card does not matter in Blackjack. Each number from 1 to 13 was mapped to a card name, which was matched to a card value.

2) We did not implement card splitting or double-down due to the lack of time.

Links to code etc

Github repository: https://github.com/winstonl4m/Blackjack