183Games · Turn-based games

Simplified Twenty-One

Simplified Twenty-One

A single game without betting: take two cards, choose hit or stand, then compare with the dealer. Aces count as 1 or 11.

  • 291 bytes
  • COMP mode
01

Worked examples

Example 1

Original game exercise. Assumed cards (player : dealer): (9,7) : (10,8). Input order: 0. Read the output sequence and explain the result. These examples assume the stated draws solely to explain a game. Ordinary play is random and will usually show different values; these inputs do not force the illustrated secret or cards.

Answer
9, 7, 16, 18, −1
Standard solution (without a calculator)
  1. Apply the stated rules in order.
  2. 9+7=16; 10+8=18
  3. 16<18≤21 ⇒ −1
  4. Output sequence: 9, 7, 16, 18, −1
Do it on the calculator

Example 2

Original game exercise. Assumed cards (player : dealer): (A,A,9) : (10,7). Input order: 1. Read the output sequence and explain the result. These examples assume the stated draws solely to explain a game. Ordinary play is random and will usually show different values; these inputs do not force the illustrated secret or cards.

Answer
1, 1, 12, 9, 21, 17, 1
Standard solution (without a calculator)
  1. Apply the stated rules in order.
  2. 11+1=12; 1+1+9+10=21
  3. 10+7=17; 21>17 ⇒ +1
  4. Output sequence: 1, 1, 12, 9, 21, 17, 1
Do it on the calculator

Example 3

Original game exercise. Assumed cards (player : dealer): (10,8,7). Input order: 1. Read the output sequence and explain the result. These examples assume the stated draws solely to explain a game. Ordinary play is random and will usually show different values; these inputs do not force the illustrated secret or cards.

Answer
10, 8, 18, 7, 25, −1
Standard solution (without a calculator)
  1. Apply the stated rules in order.
  2. 10+8=18; 18+7=25
  3. 25>21 ⇒ −1
  4. Output sequence: 10, 8, 18, 7, 25, −1
Do it on the calculator
02

When to use it

A single game without betting: take two cards, choose hit or stand, then compare with the dealer. Aces count as 1 or 11. These examples assume the stated draws solely to explain a game. Ordinary play is random and will usually show different values; these inputs do not force the illustrated secret or cards.

Input order

  • Y?: 1 hits; 0 or blank EXE stands. Other values give −9 without drawing.

Output order

  • Opening: each player card then the total. A hit shows the new card then the total. A player bust ends with −1 immediately; otherwise show the dealer total then 1=win, 0=tie, −1=loss.

Conditions and limitations

  • Draws are independent with replacement: 13 equally likely ranks, 10/J/Q/K all worth 10. The dealer takes at least two cards, hits below 17 and stands on soft 17. The player automatically stands on 21. All 21s tie; no natural-blackjack priority, split, double, insurance or stakes.
  • The program sets Fix 0, overwrites its registers and Ans, then returns to Norm 1 on normal completion. AC during play may leave Fix 0. Previous values and display settings are not restored. Registers can be inspected; there is no anti-cheating protection.
  • Equal-likelihood claims assume independent equally likely Ran# grid values; no cryptographic security is claimed. When used, rejection sampling has no fixed maximum number of draws.

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.

Checking access…

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.