Escape the Maze - a TRS-80 BASIC one-line game

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
630 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on May 16, 2010

Following on from Missile Dodge (see my other videos), I decided to write a new one-line game from scratch.

One thing that always bothered me about my original one line games was the lack of playing area - there wasn't enough space in one line to draw anything useful. I really wanted to make a Pacman type game, but couldn't find a way.

I wondered if I could draw a Pacman-style maze using a pseudo random number algorithm.

I haven't found that yet, but I did discover the Binary Maze algorithm (see http://en.wikipedia.org/wiki/Maze_generation_algorithm#Simple_algorithms and http://www.astrolog.org/labyrnth/algrithm.htm ).

So here's a game which draw a maze, and then lets you try to escape out the bottom or right edges (the binary maze is always guaranteed to have a route to an exit on the bottom or right edges).

Use the arrow keys to move. NB. If the emulator you use has an option to map the Windows keyboard to the TRS-80 keyboard you may need to turn it off to get the arrow keys to work properly.

0 IFC=0THENCLS:FORC=1TO480:R=RND(2):PRINTCHR$(320-144*R);CHR$(161+15*R);:NEXT:GOTO­ELSEK=PEEK(14400):P=X+(K=32ANDX>0)-(K=64):Q=Y+(K=8ANDY>0)-(K=16):IFPOINT(P­,Q)THENGOTOELSERESET(X,Y):X=P:Y=Q:SET(X,Y):IFX>126ORY>44THENPRINT"WELL DONE"ELSEGOTO

A couple of explanatory notes:

(1) The shenanigans with CHR$() on the convoluted expression is to select one of two graphics characters without using an IF THEN clause. For details of the graphics characters see http://www.trs-80.com/wordpress/zaps-patches-pokes-tips/graphics/ The first is selecting between a space (ASCII 32) and a horizontal line (176). The second is selecting between a full block (191) and the horizontal line (176).

(2) PEEK(14400) is looking at the keyboard memory map, and picks up the arrow keys. See my Missile Dodge video for details and links.

Category:

Gaming

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (2)

Sign In or Sign Up now to post a comment!
  • maybe easy to play, but not easy to write. well done indeed.

  • That looks really easy to do.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more