Penny Gambler

Author(s): R. W. Landesman
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v4 n7 (Volume 4, Issue 7)
Date: July 1983
Pages: 9-10

Have some fun playing poker with your computer-naive neighbor. Don’t worry about losing–the computer cheats. If you know its tricks, this game keeps track of both honest and dishonest winnings.

Type in the program, then RUN and ENTER. Gamble as instructed. After each round, the computer dishonestly states “You owe me (total amount bet by both players).” But remember two secrets your opponent does not know. 1) When the period is missing at the end of “Sorry you lost your bet.” (which appears after every round), your opponent actually won, no matter what the computer says. Of course, you pocket the computer’s winnings.

If you answer no to “wanna try again”, press 2 as indicated to end the round. A number then appears in the bottom right corner. Secret #2: This number represents the actual amount won or lost. It equals CW minus (OWx5) where CW = the computer’s winnings and OW = the opponent’s winnings. (You multiply OW by five because the opponent wins an amount five times what he bet.) A negative number means the computer owes your opponent that amount (e.g. -20 means the computer pays 20 cents.) A positive number means your opponent owes the computer that amount. (e.g. 20 means the opponent pays 20 cents.)

So start gambling–and let your conscience be your guide.

  10 REM "PENNY GAMBLER"
15 PRINT TAB 9;"PENNY GAMBLER"
20 PRINT AT 1,9;"▀▀▀▀▀▀▀▀▀▀▀▀▀"
25 PRINT
30 LET P=0
35 LET M=0
40 PRINT "WANNA TRY YOUR LUCK."
45 PRINT TAB 5;"YES -- TYPE ""1"" AND ""ENTER"""
50 PRINT TAB 5;"NO --- TYPE ""2"" AND ""ENTER"""
55 INPUT A
60 CLS
65 IF A=1 THEN GOTO 95
70 IF A=2 THEN PRINT AT 7,11;"CHEAPSKATE"
75 PRINT AT 8,11;"▀▀▀▀▀▀▀▀▀▀"
80 IF A>2 THEN PRINT AT 7,13;"DUMMY"
85 PRINT AT 16,0;"TO TRY AGAIN -- TYPE ""RUN"" AND ""ENTER"""
90 STOP
95 PRINT TAB 9;"PENNY GAMBLER"
100 PRINT AT 5,0;"YOU MAY BET A PENNY, A NICKEL, OR A DIME. I▝LL PICK A RANDOM NUMBER FROM 1 TO 5. GUESS IT AND YOU WIN FIVE TIMES YOUR BET."
105 PRINT
110 PRINT
115 PRINT "HOW MUCH DO YOU WANT TO BET?"
120 PRINT TAB 3;"PENNY -- TYPE ""1"" AND ""ENTER"""
125 PRINT TAB 3;"NICKEL - TYPE ""5"" AND ""ENTER"""
130 PRINT TAB 3;"DIME --- TYPE ""10"" AND ""ENTER"""
135 INPUT B
140 IF B=1 OR B=5 OR B=10 THEN GOTO 160
145 IF B<>1 AND B<>5 AND B<>10 THEN CLS
150 GOTO 95
155 STOP
160 CLS
165 PRINT TAB 9;"PENNY GAMBLER"
170 PRINT AT 5,0;"OK - WHAT▝S YOUR GUESS 1, 2, 3, 4, OR 5?"
175 LET X=INT (RND*4)+1
180 INPUT Z
185 CLS
190 PRINT TAB 9;"PENNY GAMBLER"
195 IF X<>Z THEN PRINT AT 7,0;"SORRY YOU LOST YOUR BET."
200 IF X=Z AND B=1 THEN LET M=M+6
205 IF X=Z AND B=5 THEN LET M=M+30
210 IF X=Z AND B=10 THEN LET M=M+60
215 IF X=Z THEN LET X=Z+1
220 PRINT AT 7,0;"SORRY YOU LOST YOUR BET"
225 PRINT "YOU PICKED NUMBER ";Z
230 PRINT "THE COMPUTER PICKED ";X
235 IF B=1 THEN LET P=P+1
240 IF B=5 THEN LET P=P+5
245 IF B=10 THEN LET P=P+10
250 PRINT AT 15,0;"WANNA TRY AGAIN"
255 PRINT TAB 5;"YES -- TYPE ""1"" AND ""ENTER"""
260 PRINT TAB 5;"NO --- TYPE ""2"" AND ""ENTER"""
265 INPUT C
270 CLS
275 IF C=1 THEN GOTO 95
280 IF C=2 THEN PRINT AT 7,12;"QUITTER"
285 IF C>2 THEN PRINT AT 7,12;"DUMMY"
290 PRINT AT 9,0;"YOU OWE ME ";P;" CENTS."
295 PRINT "PAY UP NOW. DADDY NEEDS SOFTWARE."
300 PRINT AT 11,0;"▀▀▀▀▀▀▀▀▀▀"
305 PRINT AT 20,0;"TO START OVER - TYPE ""RUN"" AND ""ENTER""."
310 PRINT AT 21,28;P-M
315 STOP
SYNTACTIC SUM: 44018, 8K ROM

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.