This program is a text-based airplane landing simulation where the player flies from London, England to one of ten international destinations. Each turn the player inputs thrust (–75 to +75), flap angle (–50 to +50), and rudder deflection (–45 to +45) to manage speed, altitude, and bearing. An instrument panel is drawn using PLOT and DRAW commands along the left side of the screen, displaying nine flight parameters including fuel, altitude, range, speed, rudder, runway remaining, drop rate, relative bearing, and flap angle. Destination data—distance, fuel load, runway length, and initial bearing—is stored in subroutines accessed via a computed GO TO (line 9520: `GO TO 9580+ap*20`), a common BASIC memory optimization. The SOUND commands in the crash sequence (lines 5200–5210) drive a multi-channel noise effect, and scoring is based on remaining fuel and runway usage.
Program Analysis
Program Structure
The program is organized into clearly separated functional blocks:
- Initialization (lines 1–15): Variables zeroed; subroutines called for intro and destination selection.
- Screen/Instrument Setup (lines 20–390): Draws the instrument panel border, gauge axes, and labels using PLOT/DRAW.
- Main Flight Loop (lines 500–1000): Collects thrust, flap, and rudder inputs; updates flight state; checks crash/landing conditions; loops via
GO TO 500(which falls through from line 1000 — note line 500 does not exist; control arrives at line 520). - Intro/Music Subroutine (lines 1020–1120): Draws title, plays a short melody, and waits for a keypress.
- Crash/Failure Handlers (lines 5000–5100): Each failure mode prints a specific message and jumps to the common crash sound sequence.
- Crash Sound Sequence (lines 5200–5290): Plays SOUND effects, pauses, then restarts the program.
- Landing/Win Handler (lines 6000–6100): Calculates score and prints the result.
- Destination Selection Subroutine (lines 9500–9760): Presents a menu and sets per-destination parameters via computed GO TO.
Computed GO TO for Destination Data
Line 9520 uses GO TO 9580+ap*20 to branch directly to one of ten destination blocks, each spaced exactly 20 line numbers apart (9580, 9600, 9620, …, 9760). Each block sets l (distance in km), e (fuel load), w (runway length), and pe (initial bearing offset), then RETURNs. This is a classic BASIC dispatch table technique that avoids a chain of IF statements.
Destination Parameters
| Code | Destination | Distance (l) | Fuel (e) | Runway (w) | Bearing (pe) |
|---|---|---|---|---|---|
| 0 | Istanbul | 1562 | 9 | 480 | 35 |
| 1 | Chicago | 4235 | 15 | 700 | 170 |
| 2 | Milan | 581 | 4 | 700 | 35 |
| 3 | Moscow | 1549 | 9 | 640 | -10 |
| 4 | New York | 3500 | 13 | 750 | 170 |
| 5 | Port Stanley | 7406 | 24 | 440 | 110 |
| 6 | Oslo | 722 | 5 | 500 | -30 |
| 7 | Tel Aviv | 2230 | 11 | 650 | 40 |
| 8 | Delhi | 5203 | 18 | 510 | 34 |
| 9 | Toronto | 3728 | 14 | 550 | -150 |
Flight Physics Model
The simulation uses simplified integer arithmetic to model flight dynamics each turn:
- Speed (
s): Modified by thrust inputx, clamped to 0–600, then reduced by a fixed drag of 5 (s=s+x-5). - Distance (
l): Decremented byINT(1.25*(s*(1-d/100))), coupling speed and rudder deflectiondto ground coverage. - Altitude (
a): Changed byINT(3.06*n)wherenis cumulative flap angle; clamped to 500 maximum and forced to 0 if below 4 and distance remains. - Fuel (
f): Decremented byINT((n/10+s/20)/(e/2)), making fuel consumption depend on flap setting, speed, and the destination’s fuel efficiency factore. - Bearing (
pe): Adjusted each turn by rudder inputd; wraps at ±179 degrees.
Instrument Panel Drawing
The left portion of the screen (columns 0–10) serves as a fixed instrument panel drawn entirely with PLOT and DRAW statements using OVER 1 mode (line 200) to avoid erasing existing content. Horizontal gauge lines are drawn at fixed pixel intervals using FOR loops (lines 340, 810). The panel displays nine variables updated each turn by the subroutine at line 700. A destination progress indicator is plotted at line 900 using PLOT INK 0;INT((m-l)/50)+89, INT a/18+146, mapping remaining distance and altitude to a pixel position.
Warning System
Lines 935–960 implement a flashing warning system: if altitude, speed, range, bearing, or runway remaining fall below threshold values, the corresponding label is printed with FLASH 1 and INK 2. A short BEEP loop (FOR q=1 TO 100: BEEP .007,-22) provides an audible alarm. All warnings are then cleared in a single multi-AT PRINT statement at line 960, and FLASH is reset.
Scoring
The score is computed at lines 6000–6092. Variable k is set to INT f/3 (remaining fuel contribution), and sc is INT(110*(w/tr)) where tr is the initial runway length and w is remaining runway — rewarding landing closer to the runway threshold. The final score is (2*k)+sc, nominally out of 100, though values above 100 are arithmetically possible.
Successful Landing Conditions
Line 920 checks all landing conditions simultaneously: a<=0 (on ground), w>=0 (on runway), f>0 (fuel remaining), pe=0 (correct bearing), l<0 (destination reached), s<=0 AND s>=-1 (stopped). The speed condition s>=-1 is redundant since speed is clamped to 0 at line 572, but it does not cause a bug.
Notable Bugs and Anomalies
- Line 1000 reads
GO TO 500but line 500 does not exist; execution falls through to line 520. This is intentional — it skips the instrument panel redraw on loop-back, jumping directly to the stall check. - Line 610 checks
IF pe>179 THEN LET pe=-179before updatingpewith the rudder input on the same line, meaning the wrap check applies to the previous turn’s bearing. The complementary check at line 612 (IF pe<-179 THEN LET pe=179) is evaluated after line 610’s INPUT and assignment, so wrapping is one turn delayed. - Variable
zxis used as a flag to skip the first PLOT of the flight path indicator (lines 605, 892, 900, 905), preventing a spurious dot at the origin on the first turn. - Line 4000 contains a bare
RETURNthat is never called; it appears to be a leftover stub. - The
SOUNDcommands in lines 5200–5210 implement a multi-channel crash noise sequence, with channels configured for envelope and noise parameters.
Content
Source Code
1 LET zx=0: LET x=0: LET y=0: LET z=0
10 GO SUB 1020
11 GO SUB 9500
15 LET m=l: LET tr=w: BORDER 7: PAPER 7: INK 2
20 PLOT 89,145: DRAW INK 3;7,0: PLOT (89+INT l/50),145: DRAW INK 3;INT w/50,0
30 PRINT AT 17,15;"DESTINATION:"
100 LET a=0: LET s=0: LET d=0: LET r=0: LET c=0: LET f=29: LET n=0
200 OVER 1: INK 2: PLOT 0,0: DRAW 255,0: DRAW 0,175: DRAW -255,0: DRAW 0,-175
210 PLOT 0,16: DRAW 255,0: PRINT AT 20,0; INK 0;"FUEL"
220 PLOT 32,0: DRAW 0,16: PLOT 32,8: DRAW 223,0
230 PRINT AT 20,4; INK 3;"0 50 100 150 200 250 300"
240 PLOT 88,16: DRAW 0,159: PLOT 0,144: DRAW 255,0
250 INK 0: PRINT AT 14,0;"ALTITUDE"
251 PRINT AT 10,0;"RANGE"
252 PRINT AT 2,0;"SPEED"
253 PRINT AT 6,0;"RUDDER"
254 PRINT AT 0,0; INK 3;"INSTRUMENTS"
255 PRINT AT 12,0;"RUNWAY LEFT"
256 PRINT AT 18,0;"FLAP ANGLE"
257 PRINT AT 8,0;"R/BEARING"
258 PRINT AT 4,0;"ACCELERATE"
259 PRINT AT 16,0;"DROP RATE"
310 PLOT 89,95: DRAW 166,0: PLOT 0,160: DRAW 88,0: PLOT 89,112: DRAW 166,0
340 FOR t=32 TO 128 STEP 16: PLOT 0,t: DRAW 86,0: NEXT t
390 PRINT AT 21,4;" ": OVER 0: GO SUB 700
520 IF s<150 AND a>0 THEN GO TO 5000
540 PRINT AT 5,13;"SELECT THRUST";AT 6,13;"(-75 to +75)"
560 INPUT x: IF x>75 THEN LET x=75
565 IF x<-75 THEN LET x=-75
570 LET s=s+x: LET c=x: LET x=0: IF s>600 THEN LET s=600
572 LET s=s-5: IF s<0 THEN LET s=0
573 LET l=l-INT (1.25*(s*(1-d/100)))
575 GO SUB 700
578 IF s<150 AND a>0 THEN GO TO 5000
580 LET x=0: PRINT AT 5,13;"CHANGE FLAPS? ";AT 6,13;"(-50 to +50)": INPUT y: LET n=n+y: IF n>50 THEN LET n=50
581 IF n<-50 THEN LET n=-50
582 LET a=a+INT (3.06*n): IF a<-5 THEN GO TO 5020
583 IF a>=500 THEN LET a=500
585 IF a<4 AND l>100 THEN LET a=0
590 LET r=INT (3.06*n): LET s=s-n
595 IF a<0 AND a>=-5 THEN LET a=0
600 GO SUB 700
605 LET zx=1
610 PRINT AT 5,13;"CHANGE RUDDER? ";AT 6,13;"(-45 to +45)": INPUT z: LET d=d+z: IF pe>179 THEN LET pe=-179
612 IF pe<-179 THEN LET pe=179
620 LET pe=pe-d
630 IF l<=0 THEN LET w=w-s
635 IF f<0 THEN GO TO 5040
640 IF a<0 AND l>0 THEN GO TO 5080
645 IF a<=0 AND pe<>0 AND l<=250 THEN GO TO 5100
660 LET f=f-INT ((n/10+s/20)/(e/2)): IF f<=0 THEN GO TO 5040
670 IF l>400 AND l<500 AND a>5 AND a<50 THEN LET a=100
675 IF s>230 AND a<=0 THEN LET a=50
680 IF w<=0 THEN GO TO 5060
700 PRINT AT 3,1; INK 0;s;" ";AT 15,1;a;" ";AT 11,1;l;" ";AT 7,1;d;" ";AT 19,1;n;" ";AT 5,1;c;" ";AT 17,1;r;" ";AT 9,1;pe;" ";AT 13,1;w;" "
810 FOR t=16 TO 144 STEP 16: PLOT 0,t: DRAW 86,0: NEXT t
860 PRINT AT 8,12; INK 4;" - R/BEARING +"
880 PRINT AT 9,12;" "
890 PRINT AT 9,21;"o": PRINT AT 9,21-INT (pe/20);"^"
892 IF zx<>0 THEN GO TO 900
895 RETURN
900 PLOT INK 0;INT ((m-l)/50)+89,INT a/18+146
905 LET zx=0
910 PRINT AT 21,f;" "
920 IF a<=0 AND w>=0 AND f>0 AND pe=0 AND l<0 AND s<=0 AND s>=-1 THEN GO TO 6000
935 IF a<=40 THEN PRINT AT 16,15; INK 2; PAPER 7; FLASH 1;"ALTITUDE"
940 IF s<165 THEN PRINT AT 14,15; INK 2; PAPER 7; FLASH 1;"SPEED"
945 IF l<100 THEN PRINT AT 12,15; INK 2; PAPER 7; FLASH 1;"RANGE"
950 IF l<300 AND pe<>0 THEN PRINT AT 13,15; INK 2; PAPER 7; FLASH 1;"R/BEARING"
955 IF w<200 THEN PRINT AT 12,15; INK 2; PAPER 7; FLASH 1;"RUNWAY LEFT"
960 FOR q=1 TO 100: BEEP .007,-22: NEXT q: FLASH 0: PRINT AT 12,15;" ";AT 13,15;" ";AT 14,15;" ";AT 15,15;" ";AT 16,15;" "
1000 GO TO 500
1020 PAPER 0: INK 7: BORDER 7: CLS
1037 PRINT TAB 12; FLASH 1;"AIRPLANE"
1040 BEEP .3,0: BEEP .3,0: BEEP .3,0: BEEP .8,-5
1050 BEEP .3,3: BEEP .3,3: BEEP .3,3: BEEP .8,-2
1060 FOR m=-7 TO 5: BEEP .1,m: NEXT m: PAUSE 20: BEEP .17,15: PAUSE 15: BEEP .4,-25
1070 PRINT AT 0,12;"AIRPLANE"''"* Fly to ONE of TEN destinations"''"* Stall speed is 150 Km/h"
1080 PRINT '"* Flaps change your altitude"''"* Rudder changes your bearing"
1090 PRINT '"* o is the destination"''"* ^ is your position"
1100 PRINT '"* FOR A SUCCESSFUL LANDING:";TAB 6;"Speed must be 0, altitude";TAB 6;"must be 0, AND you must";TAB 6;"be on the runway."
1110 PRINT AT 20,8;"ANY KEY TO START": IF INKEY$="" THEN GO TO 1110
1120 RETURN
4000 RETURN
5000 PAUSE 40: CLS : PRINT "You stalled at ";s;"KM/H"''"Fall down / go BOOM!": GO TO 5200
5020 PAUSE 40: CLS : PRINT "Your altitude is ";a;" meters"''"Can't keep it up, eh?": GO TO 5200
5040 PAUSE 40: CLS : PRINT "You ran out of fuel, FOOL!": GO TO 5200
5060 PAUSE 40: CLS : PRINT "You overshot the runway"'"by ";ABS w;" meters"''"Choose a farther destination!": GO TO 5200
5080 PAUSE 40: CLS : PRINT "You landed ";l; "miles short"'"of the runway"''"Choose a closer destination!": GO TO 5200
5100 PAUSE 40: CLS : PRINT "You missed the runway"'"by ";pe;" degrees"''"Please give up!": GO TO 5200
5200 SOUND 7,62;8,15: FOR q=50 TO 100: SOUND 0,q: PAUSE 3: NEXT q
5210 SOUND 6,6;7,7;8,16;9,16;10,16;12,56;13,8: PAUSE 90: SOUND 8,0;9,0;10,0
5290 PAUSE 250: CLS : GO TO 1
6000 LET k=INT f/3
6092 LET sc=INT (110*(w/tr)): LET k=(2*k)+sc
6100 PAUSE 100: CLS : PRINT "Well done! You scored ";INT k;" points out of a possible 100": STOP
8100 STOP
9500 INK 7: BORDER 7: PAPER 0: CLS : PRINT AT 1,1;"YOU WILL FLY"'" FROM: LONDON, ENGLAND"'" TO:"
9502 PRINT : PRINT "0) Istanbul"'"1) Chicago"'"2) Milan"'"3) Moscow"'"4) New York"'"5) Port Stanley"'"6) Oslo"'"7) Tel Aviv"'"8) Delhi"'"9) Toronto"
9505 INK 2: PAPER 7
9510 INPUT "Choose by NUMBER : ";ap
9515 IF ap>9 THEN GO TO 9510
9520 GO TO 9580+ap*20
9580 CLS : LET l=1562: LET e=9: LET w=480: LET pe=35: PRINT AT 18,16;"Istanbul": RETURN
9600 CLS : LET l=4235: LET e=15: LET w=700: LET pe=170: PRINT AT 18,16;"Chicago": RETURN
9620 CLS : LET l=581: LET e=4: LET w=700: LET pe=35: PRINT AT 18,16;"Milan": RETURN
9640 CLS : LET l=1549: LET e=9: LET w=640: LET pe=-10: PRINT AT 18,16;"Moscow": RETURN
9660 CLS : LET l=3500: LET e=13: LET w=750: LET pe=170: PRINT AT 18,16;"New York": RETURN
9680 CLS : LET l=7406: LET e=24: LET w=440: LET pe=110: PRINT AT 18,16;"Port Stanley": RETURN
9700 CLS : LET l=722: LET e=5: LET w=500: LET pe=-30: PRINT AT 18,16;"Oslo": RETURN
9720 CLS : LET l=2230: LET e=11: LET w=650: LET pe=40: PRINT AT 18,16;"Tel Aviv": RETURN
9740 CLS : LET l=5203: LET e=18: LET w=510: LET pe=34: PRINT AT 18,16;"Delhi": RETURN
9760 CLS : LET l=3728: LET e=14: LET w=550: LET pe=-150: PRINT AT 18,16;"Toronto": RETURN
9998 SAVE "PLANE" LINE 1: REM PRINT FLASH 1;"VERIFY...": VERIFY "": STOP
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
