Section A - Cards
A suit is a kind of value. The suits are hearts, diamonds, clubs, and spades.
Understand "heart" as hearts. Understand "diamond" as diamonds.
Understand "club" as clubs. Understand "spade" as spades.
A card is a kind of object. A card has a number called the face value. A card has a suit.
Rule for printing the name of a card: say "[face value as card value] of [suit]".
To say (N - number) as a/-- card value:
if N is:
-- 1: say "ace";
-- 2: say "deuce";
-- 11: say "jack";
-- 12: say "queen";
-- 13: say "king";
-- otherwise: say N.
Understand "ace" or "a" as a card when the face value of the item described is 1 and the item described is face-up.
Understand "deuce" as a card when the face value of the item described is 2 and the item described is face-up.
Understand "jack" or "knave" or "prince" or "j" as a card when the face value of the item described is 11 and the item described is face-up.
Understand "queen" or "q" as a card when the face value of the item described is 12 and the item described is face-up.
Understand "king" or "k" as a card when the face value of the item described is 13 and the item described is face-up.
Understand the face value property as describing a card when the item described is face-up.
Understand the suit property as describing a card when the item described is face-up.
Understand "of" as a card. Understand "card" as a card.
Definition: a card is unallocated if its face value is 0.
A card can be played or unplayed. A card is usually unplayed.
A card can be face-up or face-down. A card is usually face-down.
To say abbreviation of (N - number):
if N is:
-- 1: say "A";
-- 10: say "Ю"; [Cyrillic yu looks a lot like "10" in the monospaced font]
-- 11: say "J";
-- 12: say "Q";
-- 13: say "K";
-- otherwise: say N.
To say abbreviation of (S - suit):
if S is:
-- hearts: say "♥";
-- diamonds: say "♦";
-- clubs: say "♣";
-- spades: say "♠".
To say abbreviation of (C - card):
say "[abbreviation of the face value of C][abbreviation of the suit of C]".
To say inverse abbreviation of (C - card):
say "[abbreviation of the suit of C][abbreviation of the face value of C]".
Definition: a card (called the item) is heart-suited if the suit of the item is hearts.
Definition: a card (called the item) is diamond-suited if the suit of the item is diamonds.
Definition: a card (called the item) is club-suited if the suit of the item is clubs.
Definition: a card (called the item) is spade-suited if the suit of the item is spades.
There are 52 cards.
When play begins:
seed the random-number generator with 1; [With seed 1 the generator always returns zero, so this numbers all the cards in order. Not strictly necessary but nice for organization.]
repeat with the color running through suits:
repeat with the new value running from 1 to 13:
let the item be a random unallocated card;
now the suit of the item is the color;
now the face value of the item is the new value;
seed the random-number generator with 0.