Dice Roll

Author(s): Robert Masters
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v3 n8 (Volume 3, Issue 8)
Date: August 1982
Pages: 21

This program turns your 4K ZX80 into a totally fair dice roller. It’s a lot quieter than standard dice and saves disagreements about what was actually rolled.

Enter Dice, then RUN (graphics & spaces are described in PRINT lines). Hit NL for each roll. To exit, enter any character.

Lines 40 and 50 roll the dice. Subroutine 700 arranges the “dots” on the face of each die. Subroutine 800 prints the die on the screen. Who says a 1K ZX80 can’t help you play Monopoly!

   5 LET A$="7space shiftQ 7space"
10 LET B$=CHR$(130)
15 LET X$="7space shiftQ"
30 RANDOMISE
40 LET X=RND(6)
50 LET Y=RND(6)
60 LET Z=X
70 GO SUB 700
80 GO SUB 800
90 PRINT
100 LET Z=Y
110 GO SUB 700
120 GO SUB 800
130 INPUT Q$
135 CLS
140 IF Q$="" THEN GO TO 40
150 STOP
700 LET C$="shiftA 3space shiftA"
701 LET D$=C$
702 LET E$=C$
705 IF Z=1 THEN LET C$="5space"
706 IF Z=1 THEN LET E$=C$
710 IF Z=1 OR Z=3 OR Z=5 THEN LET D$="2space shiftA 2space"
720 IF Z=2 OR Z=3 THEN GO SUB 750
730 IF Z=2 OR Z=4 THEN LET D$="5space"
740 RETURN
750 LET C$="shiftA 4space"
760 LET E$="4space shiftA"
770 RETURN
800 LET Z$="shiftW"
805 GO SUB 900
810 PRINT A$;B$
820 PRINT X$;C$;"space";B$
830 PRINT A$;B$
840 PRINT X$;D$;"space";B$
850 PRINT A$;B$
860 PRINT X$;E$;"space";B$
870 PRINT A$;B$
875 LET Z$=CHR$(131)
880 GO SUB 900
890 RETURN
900 PRINT "7space";
910 FOR I=1 TO 10
920 PRINT Z$;
930 NEXT I
940 PRINT
950 RETURN
SYNTACTIC SUM: -22490, 4K

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