: VOORBEREIDING ( - )
0 \ Voor langste weg
#MOTOREN \ Per motor:
0 DO I DAAR @ I HIER @
2DUP <
DUP 2* 1+ I STAPJE ! \ 1 of -1, richting
IF SWAP THEN -
DUP I VERBRUIK ! \ Afstand
MAX \ Grootste afstand?
LOOP
DUP TO #ETAPPES
2/ #MOTOREN
0 DO DUP I TANK ! \ Tanks halfvol
LOOP DROP ;
\ Voor de scherm-versie zonder de hard-ware
: >MOTOR ( nieuwe-stand motor# - ) 2DROP ;
\ Om de motorstanden op 't scherm te zetten
: .HIER ( - ) CR #MOTOREN 0 DO I HIER @ 4 .R LOOP SPACE ;
: ETAPPE ( - )
#MOTOREN
0 DO I TANK @ I VERBRUIK @
2DUP < \ Brandstof tekort?
IF #ETAPPES - \ Dan bijtanken
I STAPJE @ I HIER +! \ Nieuwe motorstand
I HIER @ I >MOTOR \ P-L-O-P
THEN
- I TANK !
LOOP ;
: BEWEEG ( - ) \ Het doel moet al vastgelegd zijn.
VOORBEREIDING
#ETAPPES
0 ?DO .HIER ETAPPE
KEY? IF KEY DROP LEAVE THEN
WACHT MS
LOOP .HIER ;
: GA ( doelposities - ) DOEL BEWEEG ;