Jokers Wild
Suppose we want a deck of cards which the player can shuffle and draw from. Our first (rather tedious) task is merely to set up the deck as a table:
suit | value |
diamonds | 1 |
diamonds | 2 |
diamonds | 3 |
diamonds | 4 |
diamonds | 5 |
diamonds | 6 |
diamonds | 7 |
diamonds | 8 |
diamonds | 9 |
diamonds | 10 |
diamonds | 11 |
diamonds | 12 |
diamonds | 13 |
spades | 1 |
spades | 2 |
spades | 3 |
spades | 4 |
spades | 5 |
spades | 6 |
spades | 7 |
spades | 8 |
spades | 9 |
spades | 10 |
spades | 11 |
spades | 12 |
spades | 13 |
hearts | 1 |
hearts | 2 |
hearts | 3 |
hearts | 4 |
hearts | 5 |
hearts | 6 |
hearts | 7 |
hearts | 8 |
hearts | 9 |
hearts | 10 |
hearts | 11 |
hearts | 12 |
hearts | 13 |
clubs | 1 |
clubs | 2 |
clubs | 3 |
clubs | 4 |
clubs | 5 |
clubs | 6 |
clubs | 7 |
clubs | 8 |
clubs | 9 |
clubs | 10 |
clubs | 11 |
clubs | 12 |
clubs | 13 |
We're going to describe the higher numbers as face cards, so it helps to write a new "to say" phrase.
value | term |
1 | "ace" |
2 | "deuce" |
3 | "three" |
4 | "four" |
5 | "five" |
6 | "six" |
7 | "seven" |
8 | "eight" |
9 | "nine" |
10 | "ten" |
11 | "jack" |
12 | "queen" |
13 | "king" |
Now we get the shuffling of the deck from "sort in random order", so:
This will continue to work properly even as the deck is partially depleted. Speaking of which, suppose we want the player to be able to toss the cards one-by-one into a hat. They are going to need to be removed from the deck, so:
If we wanted to simulate a slightly more stimulating game, we could instead have a second table to represent the player's hand of cards and record each card drawn. That would get long for the purposes of example, however, so instead we will just admit that the player's life is an empty husk of existence:
Test me with "toss / again / again / again / again / again / again / again".
It has come to this: sitting on the bare floor of Lulu's apartment with nothing to amuse you but a deck of cards and the top hat from last year's act. You reckon fifty-two cardtosses are all that stand between you and the utter pointlessness of existence.
Once again you curse Lulu for running off with that joker.
>(Testing.)
>[1] toss
You throw the deuce of clubs at the top hat, and hit.
>[2] again
You throw the seven of hearts at the top hat, and miss.
>[3] again
You throw the deuce of spades at the top hat, and miss.
>[4] again
You throw the eight of hearts at the top hat, and miss.
>[5] again
You throw the three of clubs at the top hat, and hit.
>[6] again
You throw the five of clubs at the top hat, and hit.
>[7] again
You throw the nine of clubs at the top hat, and hit.
>[8] again
You throw the three of spades at the top hat, and hit.