mike@drd.com (Mike Rovak) (05/15/91)
Here are two little programs, just for laughs. The first one is my backup program. It uses the date and the name of the last backup to decide what to name the new backup file so that the user does not have to deal with making YET another decision. Handles first time (no last backup) automatically. After that is a modified version of Kevin Jessup's recent AstroNUT 1.0, with: - suggested -19 CF; - CL\GS \GS+ replaced by a sequence which will not cause the statistics array variable \GSDAT to move around in front of PLAY in the directory; - DO UNTIL KEY END changed to 0 WAIT; - PICT STO changed to a sequence including REPL to cure the freaked display phenomenon (PVIEW in force). BACKUP... ================= snip snip ================== %%HP: T(3)A(D)F(.); \<< DATE 0 TSTR \-> t \<< "A" t 11 12 SUB + t 5 6 SUB + t 8 9 SUB + 't' STO IFERR 'LASTBU' RCL THEN IF -55 FC? THEN DROP END "A" ELSE DUP SIZE 1 - 1 SWAP SUB IF t == THEN LASTBU DUP SIZE DUP SUB NUM 1 + CHR ELSE "A" END END t SWAP + DUP OBJ\-> "IO" \->TAG IFERR ARCHIVE THEN IF -55 FC? THEN DROP END DROP ELSE 'LASTBU' STO END \>> \>> ================= snip snip ================== AstroNUT... ================= snip snip ================== %%HP: T(3)A(D)F(.); DIR PLAY \<< RCLF 3 FIX # 131d # 64d BLANK PICT STO 1 CF -19 CF 170 'ht' STO -20 'v' STO 5 IF RAND .5 < THEN NEG END 'hv' STO RAND 80 * IP 'x' STO 100 'fuel' STO 2 CF MAKBOTTOM { # 0d # 0d } PVIEW MAIN CRASHht 'ht' STO CRASHx 'x' STO CRASHv 'v' STO STATUS PICT NEWC SHIP GXOR PICT { # 5d # 5d } IF CRASHv -4 < CRASHsl ABS .084 > OR hv OR THEN "*CRASH*" ELSE PICT 7 'ht' STO+ 1 'x' STO+ NEWC aflag REPL "AstroNUT" END 3 \->GROB REPL 7 FREEZE 0 WAIT DROP STOF \>> MAIN \<< DO IF ht 56 > THEN IF 2 FS? THEN ERASE 2 CF END ELSE IF 2 FC? THEN DRAWBOTTOM 2 SF END END STATUS NEWC PICT OVER SHIP GXOR v 'ht' STO+ hv 'x' STO+ IF x 124 > x 0 < OR THEN x 125 MOD ABS 'x' STO END CHKBOTTOM GETKEY ag 'v' STO+ PICT SWAP SHIP GXOR UNTIL 1 FS? END \>> CHKBOTTOM \<< 1 botCOORDS SIZE 1 - FOR i botCOORDS i GETI 3 ROLLD GET DUP2 1 GET SWAP 1 GET IF x 3 + \<= SWAP x 3 + > AND THEN OVER C\->V2 { 1 2 } RDM '\GSDAT' STO C\->V2 \GS+ LR x DUP 'CRASHx' STO 3 + PREDY 'CRASHht' STO SWAP DROP DUP 'CRASHsl' STO SWAP C\->V2 { 1 2 } RDM '\GSDAT' STO x 3.001 + ht \->V2 \GS+ LR SWAP DROP IF \>= THEN 1 SF v 'CRASHv' STO 99 'i' STO END ELSE DROP2 END NEXT \>> MAKBOTTOM \<< { } 0 120 FOR a a RAND 25 * IP 6 + 2 \->LIST 1 \->LIST + 12 STEP 130 OVER 1 GET OBJ\-> DROP SWAP DROP 2 \->LIST 1 \->LIST + 9 RAND * IP 2 + GETI 2 GET 3 ROLLD GETI 2 5 ROLL PUT SWAP 1 - SWAP PUT 'botCOORDS' STO \>> DRAWBOTTOM \<< 1 botCOORDS SIZE 1 - FOR i botCOORDS i GETI OBJ\-> ROT R\->B ROT 63 SWAP - R\->B ROT \->LIST 3 ROLLD GET OBJ\-> ROT R\->B ROT 63 SWAP - R\->B ROT \->LIST LINE NEXT \>> STATUS \<< \<< + 1 \->GROB PICT 3 ROLLD REPL \>> \-> s \<< { # 84d # 0d } "Height: " ht s EVAL { # 84d # 6d } "VertV: " v s EVAL { # 84d # 12d } "HorizV: " hv s EVAL { # 84d # 18d } "Fuel: " fuel s EVAL \>> \>> GETKEY \<< WHILE KEY REPEAT IF fuel 0 > THEN CASE DUP 72 == THEN -1 'hv' STO+ -1 'fuel' STO+ END DUP 74 == THEN 1 'hv' STO+ -1 'fuel' STO+ END DUP 63 == THEN thrust DUP NEG 'fuel' STO+ 'v' STO+ END END END DROP END \>> NEWC \<< x R\->B 57 1 ht 57 MOD 57 / - * R\->B 2 \->LIST \>> C\->V2 \<< OBJ\-> DROP \->V2 \>> SHIP GROB 6 6 E13333E11212 aflag GROB 7 7 F7747414F71010 thrust 2 ag -4 \GSDAT [[ 108 26 ] [ 112.001 24 ]] CRASHv -8 CRASHsl .25 CRASHht 27 CRASHx 109 \GSPAR { 1 2 79.9865033742 -.499875031242 LINFIT } botCOORDS { { 0 13 } { 12 28 } { 24 14 } { 36 22 } { 48 19 } { 60 27 } { 72 9 } { 84 9 } { 96 29 } { 108 26 } { 120 29 } { 130 13 } } fuel 0 x 109 hv 15 v -8 ht 27 END ================= snip snip ==================
HCLIMER%UTCVM.BITNET@CUNYVM.CUNY.EDU (Harold Climer) (05/18/91)
Is there a way to cheat on your program? Add extra fuel or change the initial Z velocity: I reming the old Lunar Lander game on my old HP-25 and all one had to do was put different values in different registers. With fuel at 10,000 you could really pick your spots. Harold Climer Physics Department U. Tennessee at Chattanooga