Slot Game On Tandy TRS-80 Pocket Computer PC-4

Slot Game On Tandy TRS-80 Pocket Computer PC-4
Photo by Hello I'm Nik / Unsplash

One of my first ever real programs was a blackjack game I made in BASIC on a Sharp 9300 calculator to impress my Adv. Algebra teacher. I have seen the handwritten copy of this somewhere around here recently, but I'll be darned if I can't find it now.

Slot Game on PC-4

Since it's #septandy (as if that were an actual thing), here's a slot machine on a "Tandy TRS-80" PC-4 ;-)

   1 REM SLOT GAME ON TANDY PC-4 
   5 G=0
   10 PRINT "SLOT GAME"
   20 INPUT "AMOUNT OF BET",A
   30 B=1
   40 FOR C=1 TO 12
   50 X=INT(RND(10))
   60 Y=INT(RND(10))
   70 Z=INT(RND(10))
   80 CLS
   85 PRINT X;":";Y;":";Z
   90 FOR D=1 TO C^2
  100 NEXT D
  110 NEXT C
  120 IF X=Y; B=B*4
  130 IF Y=Z;B=B*4
  140 IF X=Z;B=B*4
  150 IF B=1;B=-1
  160 G=G+B*A
  165 IF B>1 PRINT "WINNER ";
  167 IF B=-1 PRINT "LOSE ";
  170 PRINT B*A;"(YOUR PURSE:";G;")"
  180 GOTO 20

TRS-80/Coco

   1 REM SLOT GAME ON TRS-80/COCO
   5 G=0
   10 PRINT "SLOT GAME"
   20 INPUT "AMOUNT OF BET";A
   30 B=1
   40 FOR C=1 TO 12
   50 X=INT(RND(10))
   60 Y=INT(RND(10))
   70 Z=INT(RND(10))
   80 CLS
   85 PRINT X;":";Y;":";Z
   90 FOR D=1 TO C^2
  100 NEXT D
  110 NEXT C
  120 IF X=Y THEN B=B*4
  130 IF Y=Z THEN B=B*4
  140 IF X=Z THEN B=B*4
  150 IF B=1 THEN B=-1
  160 G=G+B*A
  165 IF B>1 PRINT "WINNER ";
  167 IF B=-1 PRINT "LOSE ";
  170 PRINT B*A;"(YOUR PURSE:";G;")"
  180 GOTO 20

Commodore

Tandy not your thing? Just a few tweaks for this to work on most Commodore machines.

  1 REM SLOT GAME ON COMMODORE
   5 G=0
   10 PRINT "SLOT GAME"
   20 INPUT "AMOUNT OF BET";A
   30 B=1
   40 FOR C=1 TO 12
   50 X=INT(RND(0)*9+1)
   60 Y=INT(RND(0)*9+1)
   70 Z=INT(RND(0)*9+1)
   80 PRINT CHR$(147)
   85 PRINT X;":";Y;":";Z
   90 FOR D=1 TO C^2
  100 NEXT D
  110 NEXT C
  120 IF X=Y THEN B=B*4
  130 IF Y=Z THEN B=B*4
  140 IF X=Z THEN B=B*4
  150 IF B=1 THEN B=-1
  160 G=G+B*A
  165 IF B>1 PRINT "WINNER ";
  167 IF B=-1 PRINT "LOSE ";
  170 PRINT B*A;"(YOUR PURSE:";G;")"
  180 GOTO 20

Extra credit

Rewrite it so that each "slot" shifts on its own and slows down on its own.