Program 1: Midnight Spy Mission
77 linesBreak into an embassy, crack the safe, escape by dawn.
Beginner · INPUT, IF...THEN, RND
10 REM MIDNIGHT SPY MISSION 20 BORDER 0: PAPER 0: INK 5: CLS 30 RANDOMIZE 40 LET h=5 50 LET d=0.4 60 PRINT "MIDNIGHT SPY MISSION" 70 PRINT "--------------------" 80 PRINT 90 LET p$="zebra" 100 PRINT "Agent 7, it is midnight." 110 PRINT "Steal the microfilm from" 120 PRINT "the embassy safe. Escape" 130 PRINT "alive. Health: ";h 140 PRINT 150 PRINT "1 Climb the drainpipe" 160 PRINT "2 Bribe the gate guard" 170 INPUT "Choose 1 or 2: ";c$ 180 IF c$="1" THEN GO TO 300 190 IF c$="2" THEN GO TO 400 200 GO TO 170 300 CLS 310 PRINT "You climb the drainpipe..." 320 IF RND<d THEN LET h=h-1: PRINT "You slip! Health: ";h 330 IF h<1 THEN GO TO 960 340 PRINT "You reach the study window." 350 GO TO 495 400 CLS 410 PRINT "You slip the guard some cash." 420 LET r=INT (RND*3)+1 430 IF r=1 THEN PRINT "He takes it and nods you in.": GO TO 495 440 IF r=2 THEN PRINT "He wants more. You run!": LET h=h-1: GO TO 495 450 PRINT "ALARM! He calls the police!": LET h=h-2 460 IF h<1 THEN GO TO 960 470 PRINT "You dive through a window." 495 IF h<1 THEN GO TO 960 500 PRINT 510 PRINT "A steel safe, with a keypad." 520 PRINT "It wants a secret password." 530 INPUT "Type the password: ";a$ 540 IF a$=p$ THEN GO TO 700 550 LET h=h-1 560 PRINT "WRONG! Alarm bell. Health: ";h 570 IF h<1 THEN GO TO 960 580 PRINT "Hint: a striped African animal" 590 GO TO 530 700 CLS 710 PRINT "CLICK! The safe opens." 720 PRINT "You grab the microfilm!" 730 PRINT 740 PRINT "Footsteps in the hall!" 750 PRINT "1 Hide behind the curtain" 760 PRINT "2 Run for the roof" 770 INPUT "Choose 1 or 2: ";c$ 780 IF c$="1" THEN GO TO 820 790 IF c$="2" THEN GO TO 860 800 GO TO 770 820 PRINT "The guard walks past..." 830 IF RND<0.5 THEN GO TO 920 840 PRINT "...then spots your shoes!" 850 LET h=h-2: GO TO 890 860 PRINT "You sprint for the roof." 870 IF RND<0.7 THEN GO TO 920 880 PRINT "A guard dog bites your leg!": LET h=h-2 890 IF h<1 THEN GO TO 960 900 PRINT "Wounded, you still escape!" 910 GO TO 930 920 PRINT "You slip away clean!" 930 PRINT "Helicopter at dawn. Health: ";h 940 PRINT "MISSION COMPLETE, AGENT 7!" 950 GO TO 990 960 CLS 970 PRINT "You were captured. The film" 980 PRINT "is lost. MISSION FAILED." 990 PRINT 1000 INPUT "Play again? (y/n) ";y$ 1010 IF y$="y" THEN RUN 1020 PRINT "Goodbye, Agent."
★ HACK THE RULES
- Line 40More health. Change LET h=5 to LET h=9. Nine lives, almost a cat!
- Line 50Slippery drainpipe. d is the chance of slipping (0 to 1). Use LET d=0 for a safe climb or LET d=0.9 for pure chaos.
- Line 90Secret password. Change "zebra" to any lowercase word, then rewrite the hint on line 580 to match.
- Line 420Friendlier guard. Change INT (RND*3)+1 to INT (RND*2)+1 and the guard can never call the police.
- Line 830 / 870Escape odds. The numbers 0.5 and 0.7 are your chances of a clean getaway. Raise them to make the finale easier.