Skip to content
Game 4 Unit 6 of 6 1 hr learning time

You Set the Rolls

Hand the run count to the player. One INPUT, one FOR loop driven by it, and the same chart — but now you can roll 10 and see a ragged guess, or 1000 and see a clean bell. Watching randomness become a picture is the whole design lesson. Your finished Tally.

100% of Tally

The chart is finished but fixed — always a thousand rolls. The real lesson of Tally isn't the bell; it's watching the bell form as the rolls pile up. So put the run count in the player's hands. One INPUT, and the same program becomes an experiment you can run again and again.

10 POKE 53281,0
20 PRINT CHR$(147)
30 INPUT "HOW MANY ROLLS";N
40 PRINT CHR$(147)
50 DIM T(12)
60 FOR I=1 TO N
70 D=INT(RND(1)*6)+1+INT(RND(1)*6)+1
80 T(D)=T(D)+1
90 NEXT I
100 MX=0
110 FOR F=2 TO 12:IF T(F)>MX THEN MX=T(F)
120 NEXT F
130 FOR F=2 TO 12
140 H=INT(T(F)*18/MX)
150 C=(F-2)*3+3
160 FOR Y=0 TO H-1
170 POKE 1024+(23-Y)*40+C,160:POKE 55296+(23-Y)*40+C,3
180 POKE 1024+(23-Y)*40+C+1,160:POKE 55296+(23-Y)*40+C+1,3
190 NEXT Y
200 NEXT F
210 FOR F=2 TO 12
220 C=(F-2)*3+3
230 IF F<10 THEN POKE 1024+24*40+C,F+48:POKE 55296+24*40+C,1:GOTO 260
240 POKE 1024+24*40+C,49:POKE 55296+24*40+C,1
250 POKE 1024+24*40+C+1,(F-10)+48:POKE 55296+24*40+C+1,1
260 NEXT F
A C64 screen, black background: a clean bell of eleven cyan bars peaked at 7, the result of the player choosing 1000 rolls.
A thousand rolls, chosen by the player: a clean, symmetric bell. Run it again with 10 and the bars come up ragged — the same program, the shape sharpening with every extra roll.

The change is small and you've met every piece. Line 30, INPUT "HOW MANY ROLLS";N, asks the player for a number and stores it in N. Line 60, FOR I = 1 TO N, runs the rolls that many times. Everything else — the array, the tally, the scaling, the bars — is exactly as it was. By scaling the bars to the largest count instead of a fixed height, the chart fills the screen whether you roll 10 or 10,000.

That one INPUT turns a fixed demonstration into a tool for seeing. Roll 10 and the bell is a rumour — ragged, lopsided, barely there. Roll 100 and it steadies. Roll 1000 and it's clean and symmetric. Same dice, same fairness, every time — only the number of trials changes, and with it how plainly the pattern shows. That is emergence you can dial in by hand.

That's Tally. Two dice, an array of counters indexed by their total, a thousand rolls, and a bell POKEd to the screen that no single roll could predict. You've made the machine hold many numbers at once and turn them into a picture — and shown that randomness, given enough trials, has a shape.

Try this

  • Watch it sharpen. Run it with 10, then 50, then 1000, and keep the screen in mind each time. You're watching the law of large numbers happen.
  • Two dice or three? Three dice total 3 to 18 and make a steeper bell. Change the roll, the DIM, the label loop, and the column spacing — a proper extension once you're ready.

What's next

You've held many numbers in an array and drawn them. Next in Volume 1 comes Bleeper — the SID chip plays a sequence into an array, and you have to play it back from memory.