An Unknown Wait
A fixed beat can be learnt, and a reaction test you can predict is no test. Make the wait a different length every run with RND — now the flash always catches you off guard.
There's a flaw in the last version: the wait is always the same. Run it a few times and your finger learns the rhythm — you're hitting the key on a count, not on the flash. A real reaction test has to catch you off guard. So make the wait a different length every single run.
10 PRINT CHR$(147)
20 POKE 53281,0
30 PRINT "WATCH THE SCREEN..."
40 W=INT(RND(1)*120)+60
50 FOR T=1 TO W*8:NEXT T
60 POKE 53281,1
Line 40 is the new part: W=INT(RND(1)*120)+60. RND(1) hands back a fraction between 0 and
1; multiply by 120 and you have a number from 0 up to 120; INT throws the decimals away to
leave a whole number; +60 shifts the range so it never drops below 60. So W lands somewhere
between 60 and 180, fresh each run.
Then line 50 uses it: FOR T=1 TO W*8:NEXT T. The loop's length now depends on W, so the
wait stretches and shrinks from one run to the next. You can't count it out any more — you can
only watch, and react. That uncertainty is tension, and RND is where it comes from.
Try this
- Widen the odds. Change
120to240and the wait can run much longer — the tension stretches with it. - Never too quick. The
+60sets the shortest possible wait. Raise it to+120and even the fastest flash gives you a moment to settle.
What's next
The flash now comes when you least expect it — but the program still doesn't know how fast you
answered it. In Unit 3 you meet the C64's clock, TI, and start measuring the gap
between the flash and your key.