Building a Streak
Carry the winning card forward, count the run, and loop until a wrong guess ends it — a loop that stops on a condition, not a count.
One round is a coin toss. A game is a run of them, each riskier than the last. Two small changes turn the single guess into that run: keep score with a streak counter, and loop back for another round — passing the card you just revealed forward as the next card to beat.
10 BORDER 0: PAPER 0: INK 7: CLS
20 RANDOMIZE
110 LET a = INT (RND * 13) + 1
120 LET streak = 0
130 CLS
150 PRINT "Number: "; a
160 PRINT "Streak: "; streak
190 INPUT "Higher or lower (H/L)? "; g$
200 LET b = INT (RND * 13) + 1
210 PRINT "Next: "; b
220 LET ok = 0
230 IF g$ = "H" AND b > a THEN LET ok = 1
240 IF g$ = "L" AND b < a THEN LET ok = 1
250 IF b = a THEN LET ok = 1
260 IF ok = 0 THEN PRINT "Wrong!": STOP
270 LET streak = streak + 1
290 PRINT "Correct!"
330 LET a = b
340 GO TO 130
A loop that ends on a condition
FOR/NEXT loops a known number of times. This loop is different: it runs until something
happens — a wrong guess. Line 260 is the exit: IF ok = 0 THEN ... STOP ends the game the
moment a call is wrong. If the guess was right, line 270 adds one to streak, and line 340 —
GO TO 130 — jumps back to play another round. There is no counter deciding when to stop; the
player's luck does. That is a loop-until-condition, and it is the natural shape for any game
that runs "until you lose".
Passing the card forward
Line 330 is the quiet hinge: LET a = b. The card the player just saw revealed becomes the new
card to beat. Without it, every round would compare against the same first number; with it, the
game flows like a real deck — each card sets up the next guess. The streak counter (line 120,
shown on line 160) just counts how many times round the loop you have survived.
The longer the streak, the more a single wrong call costs — that mounting risk is the game. Next: stop dealing numbers and start dealing real cards.