Don Hopkins recently posted his clever Logo Adventure for C64 Terrapin Logo, a skeleton of an adventure game that uses Logo’s own parser as the parser for the game, by defining commands as procedures and using a few neat tricks to manage objects. I wondered if the listing could be ported to Apple Logo (and if it would still work) and after some poking and prodding, I found out it does!
You can download a disk image containing Apple Logo and Logo Adventure from here: https://paleotronic.com/logo_adventure.dsk and use it in your favourite Apple II emulator.
Check out Don Hopkins article on Medium for an explanation of how the program works…
TO START
ADVENTURE
END
TO ADVENTURE
PR [WELCOME TO LOGO ADVENTURE]
PR [WRITTEN BY DON HOPKINS 1983]
PR [MODIFIED FOR APPLE LOGO BY]
PR [MELODY AYRES-GRIFFITHS 2018]
PR []
PR [TYPE ? FOR HELP]
PR []
INIT
LOOK
END
TO ?
PR [TO MOVE, TYPE]
PR [N , S , E , W]
PR [FOR NORTH, SOUTH, EAST, WEST]
PR []
PR [TYPE LOOK TO SEE WHAT ROOM YOU]
PR [ARE IN. YOU CAN GET AND DROP ITEMS.]
PR [INVENT SHOWS YOUR INVENTORY.]
PR [THE WORD ‘IT’ MEANS THE LAST THING YOU]
PR [REFERRED TO.]
PR []
PR [THERE ARE SOME SPECIAL THINGS YOU CAN]
PR [DO, LIKE SAYING EXAMINE SOMETHING.]
PR []
PR [TYPE SCORE TO SEE YOUR SCORE, AND]
PR [DONE TO QUIT.]
PR [GOOD LUCK!]
CMD
END
TO INIT
MAKE “ITEM1 [1 0 SWORD]
MAKE “ITEM2 [1 0 HATCHET]
MAKE “ITEM3 [1 0 SHIELD]
MAKE “ITEM4 [2 100 GOLD]
MAKE “ITEM5 [2 100 DIAMOND]
MAKE “ITEM6 [2 50 AMULET]
MAKE “ITEM7 [3 0 SCREWDRIVER]
MAKE “ITEM8 [4 0 MACHINE]
MAKE “ITEM9 [0 100 WAND]
MAKE “ITEM0 [5 200 CROWN]
MAKE “ITEMS (LIST :ITEM1 :ITEM2 :ITEM3 :ITEM4 :ITEM5 :ITEM6 :ITEM7 :ITEM8 :ITEM9 :ITEM0)
MAKE “MOVE1 [0 2 3 0]
MAKE “MOVE2 [0 0 4 1]
MAKE “MOVE3 [1 4 0 0]
MAKE “MOVE4 [2 0 0 3]
MAKE “MOVE5 [0 0 0 0]
MAKE “RMOVES (LIST :MOVE1 :MOVE2 :MOVE3 :MOVE4 :MOVE5)
MAKE “ROOM1 [YOU ARE IN THE WEAPON SHOP.]
MAKE “ROOM2 [THIS IS THE VAULT.]
MAKE “ROOM3 [THIS ROOM IS THE TOOLSHED.]
MAKE “ROOM4 [THIS IS THE ALTAR ROOM.]
MAKE “ROOM5 [YOU ARE IN A SECRET INCANTING ROOM.]
MAKE “RNAMES (LIST :ROOM1 :ROOM2 :ROOM3 :ROOM4 :ROOM5)
MAKE “RNUM 1
INITITEMS :ITEMS 1
END
TO INITITEMS :I :F
IF :I = [] [STOP]
TEST :F = 1
IFTRUE [DEFINE LAST FIRST :I LPUT LPUT WORD “” LAST FIRST :I [OP SETIT] [[]]]
IFFALSE [DEFINE LAST FIRST :I []]
INITITEMS BUTFIRST :I :F
END
TO CMD
PR []
PR “COMMAND
THROW “TOPLEVEL
END
TO MOVEDIR :DIR
MAKE “TRYMOVE ITEM :DIR ITEM :RNUM :RMOVES
TEST :TRYMOVE = 0
IFTRUE [PR [YOU CAN’T GO THAT WAY.]]
IFTRUE [CMD]
PR “OK.
MAKE “RNUM :TRYMOVE
LOOK
END
TO N
MOVEDIR 1
END
TO E
MOVEDIR 2
END
TO W
MOVEDIR 4
END
TO S
MOVEDIR 3
END
TO LOOK
PR ITEM :RNUM :RNAMES
PITEMS :RNUM
CMD
END
TO EXAMINE :ITEM
IF NOT HERE? :ITEM [( PR [I SEE NO] :ITEM [HERE!] ) CMD]
IF :ITEM = “WAND [PR [IT BEARS A FADED INSCRIPTION :] PR [“WAVE ME AND YOU’LL BE GLAD. “] CMD]
IF NOT :ITEM = “MACHINE [PR SE [I SEE NOTHING SPECIAL ABOUT THE] PERIOD :ITEM CMD]
IF NOT 0 = ITEMLOC “WAND [PR [IT SEEMS TO BEAR THE MARKS OF A HASTY] PR [REPAIR JOB.] CMD]
PR [IT IS BROKEN! YOU COULD FIX IT WITH]
PR [THE RIGHT TOOL.]
CMD
END
TO GET :ITEM
TEST :ITEM = “EVERYTHING
IFTRUE [GETALLITEMS :ITEMS]
IF IHAVE? :ITEM [( PR [YOU ALREADY HAVE] PERIOD :ITEM ) CMD]
IF NOT HERE? :ITEM [SEENO :ITEM]
PUTITEM :ITEM ( – 1 )
PR SE :ITEM “TAKEN.
CMD
END
TO GETALL
GETALLITEMS :ITEMS
END
TO GETALLITEMS :I
IF :I = [] [CMD]
TEST :RNUM = ITEMLOC LAST FIRST :I
IFTRUE [PUTITEM LAST FIRST :I ( – 1 )]
IFTRUE [PR SE LAST FIRST :I “TAKEN.]
GETALLITEMS BUTFIRST :I
END
TO TAKE :THING
GET :THING
END
TO DROP :ITEM
TEST :ITEM = “EVERYTHING
IFTRUE [DROPALLITEMS :ITEMS]
IF NOT IHAVE? :ITEM [PR SE [YOU’RE NOT CARRYING THE] WORD :ITEM “! CMD]
PUTITEM :ITEM :RNUM PR SE :ITEM “DROPPED.
CMD
END
TO DROPALL
DROPALLITEMS :ITEMS
END
TO DROPALLITEMS :I
IF :I = [] [CMD]
LOCAL “HAVEITEM?
MAKE “HAVEITEM? ITEMLOC LAST FIRST :I
TEST :HAVEITEM? = -1
IFTRUE [PUTITEM LAST FIRST :I :RNUM]
IFTRUE [PR SE LAST FIRST :I “DROPPED.]
DROPALLITEMS BUTFIRST :I
END
TO FIX :ITEM
IF IHAVE? :ITEM [PR [YOU HAVE TO DROP IT TO FIX IT!] CMD]
IF NOT HERE? :ITEM [SEENO :ITEM]
IF NOT :ITEM = “MACHINE [PR [YOU CAN’T FIX THAT!] CMD]
LOCAL “WANDHERE?
MAKE “WANDHERE? ITEMLOC “WAND
IF NOT :WANDHERE? = 0 [PR [THE MACHINE IS NOT BROKEN!] CMD]
IF NOT IHAVE? “SCREWDRIVER [PR [YOU DON’T HAVE THE PROPER TOOLS TO] PR [FIX IT] CMD]
PR [YOU FIX THE MACHINE WITH YOUR TRUSTY]
PR [SCREWDRIVER. UPON BEING FIXED, THE]
PR [MACHINE STARTS UP AND PRODUCES A WAND!]
PUTITEM “WAND 4
CMD
END
TO WAVE :ITEM
IF NOT IHAVE? :ITEM [PR SE [YOU ARE HOLDING NO] PERIOD :ITEM CMD]
IF NOT :ITEM = “WAND [NOTHING]
IF AND NOT :RNUM = 4 NOT :RNUM = 5 [PR [NOTHING HAPPENS.] CMD ]
PR [POOF! THE SCENE CHANGES!]
IF :RNUM = 4 [MAKE “RNUM 5] [MAKE “RNUM 4]
LOOK
END
TO INVENT
PITEMS – 1
CMD
END
TO SETIT :THING
MAKE “IT :THING
OP :THING
END
TO IHAVE? :ITEM
OP – 1 = ITEMLOC :ITEM
END
TO HERE? :ITEM
LOCAL “LOC
MAKE “LOC ITEMLOC :ITEM
OP OR -1 = :LOC :RNUM = :LOC
END
TO ITEMLOC :ITEM
OP ITEMLOC2 :ITEM :ITEMS
END
TO ITEMLOC2 :ITEM :I
IF :I = [] [OP 0]
IF (LAST FIRST :I) = :ITEM [OP FIRST FIRST :I]
OP ITEMLOC2 :ITEM BUTFIRST :I
END
TO PUTITEM :ITEM :LOC
MAKE “ITEMS PUTITEM2 :ITEM :LOC :ITEMS
END
TO PUTITEM2 :ITEM :LOC :LIST
IF :LIST = [] [OP []]
IF (LAST FIRST :LIST) = :ITEM [OP FPUT FPUT :LOC BUTFIRST FIRST :LIST BUTFIRST :LIST]
OP FPUT FIRST :LIST PUTITEM2 :ITEM :LOC BUTFIRST :LIST
END
TO PITEMS :LOC
PITEMS2 :LOC :ITEMS
END
TO PITEMS2 :LOC :I
IF :I = [] [STOP]
IF (FIRST FIRST :I) = :LOC [PRINT LAST FIRST :I]
PITEMS2 :LOC BUTFIRST :I
END
TO IT
OP :IT
END
TO PERIOD :WORD
OP WORD :WORD “.
END
TO SEENO :I
PR SE [I SEE NO] SE :I “HERE!
CMD
END
TO NOTHING
PR [NOTHING HAPPENS.]
CMD
END
TO EVERYTHING
OP “EVERYTHING
END
TO SCORE
PR ( SE [YOUR SCORE IS] SCORE2 :ITEMS [POINTS.] )
CMD
END
TO SCORE2 :LIST
IF :LIST = [] [OP 0]
IF NOT (FIRST FIRST :LIST) = -1 [OP SCORE2 BUTFIRST :LIST]
OP ( ITEM 2 FIRST :LIST ) + SCORE2 BUTFIRST :LIST
END
TO DONE
IF NOT :RNUM = 5 [NOTHING]
LOCAL “SCORE MAKE “SCORE SCORE2 :ITEMS
IF :SCORE = 0 [NOTHING]
PR SE [YOUR SCORE IS] :SCORE
IF :SCORE = 550 [PR [PERFECT!]] [PRINT [THERE’S MORE TREASURE , THOUGH.]]
END
Be the first to comment