The program draws two dice with their spots in graphic characters, waits about 16 seconds or until you press a key, and rolls again. Stop it with BREAK.
Two versions are printed: the first, and a second that replaces lines 5-60 with a more compact way of drawing the spots. The article also gives a two-line change to save memory in the second version. The download has both versions. In testing, the first version ran in 1K; the second stopped with report 4 at line 55 in 1K and ran in 2K.
Published in Syntax April 1982 (Dice Roll Program — 8K/1-2K).
Source Code
5 RAND
10 FOR M=31 TO 13 STEP -2.6
20 PLOT 7,M
30 PLOT 26,M
40 PLOT 33,M
50 PLOT 52,M
60 NEXT M
70 FOR B=0 TO 13 STEP 13
80 LET Y=INT (RND*6)+1
90 IF Y=1 OR Y=3 OR Y=5 THEN PRINT AT 10,8+B;CHR$ 128
100 IF Y<>1 THEN PRINT AT 7,5+B;CHR$ 128;AT 13,11+B;CHR$ 128
110 IF Y=6 THEN PRINT AT 10,5+B;CHR$ 128;AT 10,11+B;CHR$ 128
120 IF Y>=4 THEN PRINT AT 7,11+B;CHR$ 128;AT 13,5+B;CHR$ 128
130 NEXT B
140 PAUSE 1000
150 CLS
160 GOTO 10
5 RAND
10 FOR C=0 TO 1
20 FOR B=0 TO 1
30 FOR M=0 TO 19
35 LET Z=19*C
40 LET A=26*B+7
45 PLOT M+A,13+Z
50 PLOT Z+A,13+M
55 NEXT M
60 NEXT B
65 NEXT C
70 FOR B=0 TO 13 STEP 13
80 LET Y=INT (RND*6)+1
90 IF Y=1 OR Y=3 OR Y=5 THEN PRINT AT 10,8+B;CHR$ 128
100 IF Y<>1 THEN PRINT AT 7,5+B;CHR$ 128;AT 13,11+B;CHR$ 128
110 IF Y=6 THEN PRINT AT 10,5+B;CHR$ 128;AT 10,11+B;CHR$ 128
120 IF Y>=4 THEN PRINT AT 7,11+B;CHR$ 128;AT 13,5+B;CHR$ 128
130 NEXT B
140 PAUSE 1000
150 CLS
160 GOTO 10Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

