Want this course?
Course: Data Modeling in Clojure
This lesson demonstrates and evaluates many different representations of playing cards. The lesson includes a video screencast, a git repository with all code, and some exercises. The video is 14 minutes long.
I bring you part 2 of the Solitaire series. This time, we’re doing some explorations of different ways to represent cards in Clojure. We’re dealing with just card identities–the suit and value.
Code is available. The git tag to checkout is
solitaire-2. Just execute the following at the command line:
git checkout solitaire-2
Solitaire does not use the Joker cards, but some games do. How would you represent the “big” and “little” Jokers (also known as the “red” and “black” Jokers, respectively) in each of the representations?
Which representation would you use? Write a justification.
Before continuing to the next lesson, come up with a way to make the choice of representation less important.