Continue with Make another attempt. Keep the same gravity, thrust strength and landing test. Change one thing: a burn now spends fuel.
Add line 90. Replace lines 70, 130, 150, 270, 370.
70 PRINT AT 8,2;"Thrust uses fuel."
90 PRINT AT 12,2;"Empty tank? You still coast."
130 LET x=24: LET y=400: LET v=0: LET fuel=45: LET r=4: LET burn=0
150 PRINT AT 0,1;"FUEL SPEED MAX 12"
270 IF k$=" " AND fuel>0 THEN LET burn=1: LET fuel=fuel-1
370 PRINT AT 0,6;fuel;" ";AT 0,19;v;" "Decide whether the engine actually fires
Line 130 adds fuel=45 to the starting assignments. The engine condition now needs both a Space reading and a positive reserve. As in the menu filters, AND combines those conditions: both must be true for the rest of that line to execute.
burn still starts at zero. An accepted burn sets it to 1 and subtracts one fuel unit. Velocity and the provisional flame both use that same flag. We do not read the keyboard again to decide what picture to show.
Consider one fuel unit remaining. The condition succeeds, sets burn=1, and changes fuel to zero. That last paid-for burn still changes velocity and shows the engine. On the following update, the fuel condition fails, so burn remains zero even if Space is held.
Why should the flame use burn rather than checking whether fuel is still greater than zero?
Show the explanation
The last valid burn spends the final unit. Fuel is then zero, but the engine fired during this update. The stored burn decision keeps movement, the counter and the picture in agreement.
Show the decision, not just the key
For a paper trace, start an update with y=1000, v=10, fuel=1, r=10
and a Space reading. These are prepared values, not a claim about a flight we
have played. Predict burn, fuel, velocity, position and the printed character
after this update and the next one, with Space still read. Neither update reaches
the ground or the upper limit.
Hint: spending the last unit does not cancel the burn
Line 270 tests the reserve before subtracting one. Line 280 uses the stored
burn decision: v+2-6*burn. Position changes by that new velocity, and
INT (ny/100) chooses the character row.
Compare two updates on the last fuel unit
| Value after update | Last fuel unit | Next update |
|---|---|---|
| Burn | 1 | 0 |
| Fuel | 0 | 0 |
| Velocity | 6 | 8 |
| Position | 1006 | 1014 |
| Screen row | 10 | 10 |
| Character | * |
A |
Line 200 samples the key once. Lines 260–270 decide whether that request becomes
a burn; 280–350 update motion and resolve limits. Lines 370–380 print the instruments
and craft, then 390 commits the new position and row. The character is drawn from
nr, so it can show the candidate row before r is updated.
The simulated position changes on both passes, but both positions map to row 10.
A stationary screen character does not prove that the simulation stopped. The flame
and speed display still communicate the changed engine decision. This checkpoint
has no sound cue. BASIC printing and PAUSE take time; the table describes source
order, not a measured input-to-display delay.
Repeat the prediction with fuel=0 at the start. Which values in the first update
change, and which input reading stays the same? If the conversion to a screen row
needs refreshing, revisit Make another attempt
and its complete listing before altering the calculation.
Would a warning that looks like a crash be a clear way to report an empty tank?
Show the explanation
No. Empty means thrust is unavailable; it does not mean the attempt has failed. The fuel number and absent flame describe that state while the craft continues to coast. A future sound should communicate the same distinction. Repeating a loud warning on every update while Space is held could hide other information without making the rule clearer.
The fuel number gives information beyond the flame’s colour. Ask someone to explain what happened before telling them the rule: can they distinguish an accepted burn, an unavailable burn and a finished attempt? A correct counter alone does not tell us whether the feedback is understandable.
Empty does not mean finished
Nothing here treats an empty tank as a collision. Gravity still changes velocity, position still changes, and contact still decides the outcome. A slow enough approach can coast onto the ground safely after its last burn.
The instrument row now reserves separate fields for fuel and velocity. The trailing spaces clear leftover digits when a value becomes shorter. The title explains that an empty tank still permits coasting. These changes give the player information about the rule rather than adding another penalty.
Hold Space for a whole attempt. Fuel should reach zero without becoming negative; after that the engine indicator must stop even though you keep holding the key. The craft eventually falls. Retry should restore all 45 units as well as position and velocity.
For a short boundary experiment, save your ordinary version, then change the starting values in line 130 to position 1899, velocity 0, fuel 0 and row 18. Run without thrust. Gravity changes velocity to 2 and proposes position 1901; contact clamps it to 1900, producing a safe coast. This is a deliberately prepared test, not a claimed successful approach from the normal start. Restore the original line afterwards.
Keep practising with the normal start. Using less fuel is useful only if the approach remains controllable. We have not added a fuel-efficiency score or changed the safe-speed limit.
Complete program for this step
10 BORDER 0: PAPER 0: INK 7: BRIGHT 1: CLS
50 PRINT AT 3,9;"TOUCHDOWN"
60 PRINT AT 6,2;"SPACE: brake your fall"
70 PRINT AT 8,2;"Thrust uses fuel."
80 PRINT AT 10,2;"Safe speed: 0 to 12"
90 PRINT AT 12,2;"Empty tank? You still coast."
100 PRINT AT 15,2;"S launches. Q quits."
110 GO SUB 800: IF k$="q" THEN GO TO 850
120 CLS : GO SUB 600
130 LET x=24: LET y=400: LET v=0: LET fuel=45: LET r=4: LET burn=0
140 PRINT AT r,x;"A"
150 PRINT AT 0,1;"FUEL SPEED MAX 12"
160 PRINT AT 1,1;"SPACE THRUST Q QUIT"
200 LET k$=INKEY$: IF k$="q" THEN GO TO 850
260 LET burn=0
270 IF k$=" " AND fuel>0 THEN LET burn=1: LET fuel=fuel-1
280 LET v=v+2-6*burn
290 IF v>60 THEN LET v=60
300 IF v<-30 THEN LET v=-30
310 LET ny=y+v: LET contact=0: LET limit=1900
330 IF ny>=limit THEN LET contact=1
340 IF contact=1 THEN LET ny=limit
350 IF ny<300 THEN LET ny=300: LET v=0
360 LET nr=INT (ny/100)
370 PRINT AT 0,6;fuel;" ";AT 0,19;v;" "
375 LET a$="A": IF burn=1 THEN LET a$="*"
380 PRINT AT r,x;" ";AT nr,x;a$
390 LET y=ny: LET r=nr
400 IF contact=1 THEN GO TO 700
410 PAUSE 2: GO TO 200
600 FOR c=0 TO 31
610 FOR j=20 TO 21: PRINT PAPER 4; INK 0;AT j,c;" ";: NEXT j
620 PRINT PAPER 4; INK 0;AT 20,c;"#"
630 NEXT c
650 RETURN
700 PRINT AT r,x;"A"
710 LET m$="Too fast!"
720 IF v>=0 THEN IF v<=12 THEN LET m$="Safe landing!"
740 PRINT AT 2,1;m$;" "
770 PRINT AT 1,1;"R retries. Q quits. "
780 IF INKEY$<>"" THEN GO TO 780
790 LET k$=INKEY$: IF k$<>"r" AND k$<>"q" THEN GO TO 790
795 IF INKEY$<>"" THEN GO TO 795
796 IF k$="q" THEN GO TO 850
797 GO TO 120
800 IF INKEY$<>"" THEN GO TO 800
810 LET k$=INKEY$: IF k$<>"s" AND k$<>"q" THEN GO TO 810
820 IF INKEY$<>"" THEN GO TO 820
830 RETURN
850 IF INKEY$<>"" THEN GO TO 850
860 PAPER 0: INK 7: CLS : PRINT "Finished.": STOPSources
Steven Vickers, edited by Robin Bradbeer, ZX Spectrum BASIC Programming, second edition (Sinclair Research, 1983), chapters 3 and 13 (conditions and AND), and chapter 18 (input).
Run it here
This unit's program, built for you.
- Program
- step-01.tap
- Machine
- ZX Spectrum 48K (PAL)