Title: 3D-Maze Author: Lukas Schaffner schaffluk@sis.unibe.ch Size: 3022 bytes (Main program + 4 sub-programs) + 283 bytes (for a program that draws the map of the maze) + 360 bytes (for the maze itself) Description: A 3-dimensional labyrinth-program, where you can walk around stepwhise and make your own labyrinths. For: Casio CFX 9850 and better. But it could be converted for other calculators. Note: Look at the end of this text for a screenshot... Here is a short list of the good and bad points about my program: Good points: -Nice grafics (at least in my humble opinion) -You can create your own mazes -I programmed very carefully (no known bugs until now) -Uhm... I fear that's it... Bad points: -It's a bit slow (It takes 5-8 seconds to draw the picture...) -It's a bit huge (see above...) -It takes four slots (or five with the map-drawing program...) -It's my first program -It's a bit complicated to make your own levels -You can see the key only if it's ahead of you (only a prob- lem in "rooms", like the one in the example maze below) -The Exit looks like a normal Space; only if you try to step on it, you will see the difference... -There are no Monsters (No Cyberdemons, no Barons of Hell, not even Imps...) -My English isn't all to well (I'm from Switzerland) How to create your own Levels To create your own levels you have to understand how the mazes are stored: Each level is defined by 36 Numbers, which are stored in a list (I suggest you use list number 6, so you can use the first five for other things). Each number stands for a space in a 6x6 square and defines if there are walls in the west, north, east or south of the space or not. Y: nn.nn This is the Number like it appears in the List / Ý Ý \ W N E S These are the directions The Y stands for the number of the space in the list. The n stands for either a 1 or a 0. A 1 means, that there is a wall in the X of the space, a 0 means, that there is no wall in the X of the space (X is the direction indicated below each n). That means, that a space which is defined as "11.11" cannot be entered, because it has walls on all four sides. Here is an example of a maze The map (Title: "Circles") and the list file: +--+--+--+--+--+--+ 01: 10.00 13: 10.10 25: 10.10 Ý31 32 33 34 35 36Ý 02: 01.01 14: 10.10 26: 10.00 + + +--+--+--+ + 03: 01.01 15: 10.01 27: 01.01 Ý25Ý26 27 28 29Ý30Ý 04: 01.01 16: 00.01 28: 01.01 + + +--+--+ + + 05: 01.01 17: 10.10 29: 01.10 Ý19Ý20Ý21 22Ý23Ý24Ý 06: 00.11 18: 10.10 30: 10.10 + + + + + + + 07: 10.10 19: 10.10 31: 11.00 Ý13Ý14Ý15 16Ý17Ý18Ý 08: 10.01 20: 10.10 32: 01.00 + + +--+ + + + 09: 01.10 21: 11.00 33: 01.01 Ý07Ý08 09 10 11Ý12Ý 10: 00.01 22: 01.10 34: 01.01 + +--+--+--+--+ + 11: 00.11 23: 10.10 35: 01.01 Ý01 02 03 04 05 06Ý 12: 10.10 24: 10.10 36: 01.10 + +--+--+--+--+--+ The Exit is in the south of space nr. one... Notes: -The numbers won't appear like this in the list, of course (A "01.10" will become a "1.1", a "01.00" will become a "1",...) -The walls MUST be defined from two sides, otherwhise you will get "ghost walls", where you can see and pass trough from one side only. (on the other hand, that could be an effect you intend) -The Exit MUST be in the North of the spaces 31-36 or the south of the spaces 1-6, you MUST NOT make an exit on the western or eastern sides of the square. -You must not make parts, that no one can enter, because the key could be there. And now: The Program (finally...) "3D-MAZE" ViewWindow 1,127,0,1,63,0 Lbl S Int 36Ran#+1->P Sets the player's position to a random space. Int 4Ran#+1->R Sets the player's direction (also random) Int 36Ran#+1->S Sets the key to a (random) space. 0->U Deactivates the teleporter 11.11->Q Lbl 1 If the player's direction is WEST... 0->Z R=/=1=>Goto 2 List 6[P]->T Prog "S":X->A Prog "N":X->B Prog "W":X->D Q->T P-1>=1=>List 6[P-1]->T Prog "S":X->F Prog "N":X->G Prog "W":X->I Q->T P-2>=1=>List 6[P-2]->T Prog "S":X->K Prog "N":X->L Prog "W":X->N P-6>=1=>List 6[P-6]->T Prog "W":X->C P+6=<36=>List 6[P+6]->T Prog "W":X->E P-7>=1=>List 6[P-7]->T Prog "W":X->H P+5=<36=>List 6[P+5]->T Prog "W":X->J P-8>=1=>List 6[P-8]->T Prog "W":X->M P+4=<36=>List6[P+4]->T Prog "W":X->O P-1=S=>1->Z Determines if the key is one space ahead. P-2=S=>2->Z Determines if the key is two spaces ahead. Goto D Lbl2 If the player's direction is NORTH... 0->Z R=/=2=>Goto 3 List 6[P]->T Prog "W":X->A Prog "E":X->B Prog "N":X->D Q->T P+6=<36=>List 6[P+6]->T Prog "W":X->F Prog "E":X->G Prog "N":X->I Q->T P+12=<36=>List 6[P+12]->T Prog "W":X->K Prog "E":X->L Prog "N":X->N P-1>=1=>List 6[P-1]->T Prog "N":X->C P+1=<36=>List 6[P+1]->T Prog "N":X->E P+5=<1=>List 6[P+5]->T Prog "N":X->H P+7=<36=>List 6[P+7]->T Prog "N":X->J P+11=<36=>List 6[P+11]->T Prog "N":X->M P+13=<36=>List6[P+13]->T Prog "N":X->O P+6=S=>1->Z Determines if the key is one space ahead. P+12=S=>2->Z Determines if the key is two spaces ahead. Goto D Lbl 3 If the player's direction is EAST... 0->Z R=/=3=>Goto 4 List 6[P]->T Prog "N":X->A Prog "S":X->B Prog "E":X->D Q->T P+1=<36=>List 6[P+1]->T Prog "N":X->F Prog "S":X->G Prog "E":X->I Q->T P+2=<36=>List 6[P+2]->T Prog "N":X->K Prog "S":X->L Prog "E":X->N P+6=<36=>List 6[P+6]->T Prog "E":X->C P-6>=1=>List 6[P-6]->T Prog "E":X->E P+7=<36=>List 6[P+7]->T Prog "E":X->H P-5>=1=>List 6[P-5]->T Prog "E":X->J P+8=<36=>List 6[P+8]->T Prog "E":X->M P-4>=1=>List6[P-4]->T Prog "E":X->O P+1=S=>1->Z Determines if the key is one space ahead. P+2=S=>2->Z Determines if the key is two spaces ahead. Goto D Lbl 4 If the player's direction is SOUTH... 0->Z List 6[P]->T Prog "E":X->A Prog "W":X->B Prog "S":X->D Q->T P-6>=1=>List 6[P-6]->T Prog "E":X->F Prog "W":X->G Prog "S":X->I Q->T P-12>=1=>List 6[P-12]->T Prog "E":X->K Prog "W":X->L Prog "S":X->N P+1=<36=>List 6[P+1]->T Prog "S":X->C P-1>=1=>List 6[P-1]->T Prog "S":X->E P-5>=1=>List 6[P-5]->T Prog "S":X->H P-7>=1=>List 6[P-7]->T Prog "S":X->J P-11>=1=>List 6[P-11]->T Prog "S":X->M P-13>=1=>List6[P-13]->T Prog "S":X->O P-6=S=>1->Z Determines if the key is one space ahead. P-12=S=>2->Z Determines if the key is two spaces ahead. Lbl D The part of the program that actually DRAWS Cls the player's view... Plot 1,1 Plot 1,61 Line Plot 61,61 Line Plot 61,1 Line Plot 1,1 Line D=0=>Getkey=28=>Goto F These Lines enable a "quick mode", so you don't Getkey=38=>Goto L have to wait for the whole picture to be drawn. Getkey=27=>Goto R But be careful: It's quite confusing if you take Plot 6,6 more than two steps at a time (you can only see Line as far as two spaces...) Plot 56,6 Line Plot 61,1 Line Plot 1,61 Plot 6,56 Line Plot 56,56 Line Plot 61,61 Line A+C+D+F=/=0=>F-Line 6,56,6,6 B+D+E+G=/=0=>F-Line 56,56,56,6 D=1=>Goto 5 Plot 6,6 Plot 16,16 Line Plot 46,16 Line Plot 56,6 Line Plot 6,56 Plot 16,46 Line Plot 46,46 Line Plot 56,56 Line F+H+I+K=/=0=>F-Line 16,46,16,16 G+I+J+L=/=0=>F-Line 46,46,46,16 If F=0 Then F-Line 6,46,16,46 F-Line 6,16,16,16 IfEnd If G=0 Then F-Line 46,46,56,46 F-Line 46,16,56,16 IfEnd If F+H=0 Then F-Line 6,41,16,41 F-Line 6,21,16,21 IfEnd If G+J=0 Then F-Line 46,21,56,21 F-Line 46,41,56,41 IfEnd Z=1=>Text 50,25,"O-Pi" This draws the key if it's one space ahead. I=1=>Goto 5 The key is made by an O, a minus and Pi Plot 16,16 Plot 21,21 Line Plot 41,21 Line Plot 46,16 Line Plot 16,46 Plot 21,41 Line Plot 41,41 Line Plot 46,46 Line K+M+N=/=0=>F-Line 21,41,21,21 L+N+O=/=0=>F-Line 41,41,41,21 If K=0 Then F-Line 16,41,21,41 F-Line 16,21,21,21 IfEnd If L=0 Then F-Line 41,41,46,41 F-Line 41,21,46,21 IfEnd Z=2=>Text 41,25,"@-Pi" This draws the key if it's two spaces away. The key is made by Theta, a minus and Pi Lbl 5 A=1=>Goto 6 F-Line 1,6,6,6 F-Line 1,56,6,56 C=1=>Goto 6 F-Line 1,46,6,46 F-Line 1,16,6,16 H=1=>Goto 6 F-Line 1,41,6,41 F-Line 1,21,6,21 Lbl 6 B=1=>Goto K F-Line 56,56,61,56 F-Line 56,6,61,6 E=1=>Goto K F-Line 56,46,61,46 F-Line 56,21,61,21 J=1=>Goto K F-Line 56,41,61,41 F-Line 56,21,61,21 Lbl K Text 20,70,"DIRECTION:" Your "compass" R=1=>Text 20,110,"W" R=2=>Text 20,110,"N" R=3=>Text 20,110,"E" R=4=>Text 20,110,"S" Text 40,70,"POSITION:" Your position: from 1-1 to 6-6. The first number Int 6Frac (P/6)->V increases from west to east, the second from south V=/=0=>Text 40,106,V to north (so 1-1 is space number 1 and 6-6 is space V=0=>text 40,106,6 number 36) Text 40,109,"-" Text 40,114,Int (P/6-0.01)+1 TeText 50,99," " Lbl 7 Do Getkey=28=>Goto F The only interactive part of the whole program Getkey=38=>Goto L (besides the "quick mode" above): you can turn Getkey=27=>Goto R left or right or walk forward; that's it... LpWhile Getkey=/=0 Lbl F "F" like "forward" D=1=>Text 30,70,"OUCH" Have you ever tried to walk through a wall? D=1=>Text 30,70," " D=1=>Goto 7 R=1=>P-1->P R=2=>P+6->P R=3=>P+1->P R=4=>P-6->P P<1=>Goto E P>36=>Goto E P=S=>Goto O P=U=>Goto U Goto 1 Lbl L "L" like "left" 4 Frac ((R-1)/4)->R R=0=>4->R Goto 1 Lbl R "R" like "right" 4 Frac((R+1)/4)->R R=0=>4->R Goto 1 Lbl O If you step on the space where the key is, you will Text 30,70,"A KEY!" get it. A side effect is, that the teleporter will Text 30,70," " be activated. 0->S Ind 36Ran#+1->U Goto 1 Lbl U You can't see the teleporter (quite nasty, isn't Text 30,70,"TELEPORT" it?) which sets you to a random position if you Text 30,70," " step on it... Int 36Ran#+1->P Int 36Ran#+1->U Goto 1 Lbl E S=0=>Goto Z Text 30,70,"LOCKED!" You have to have found the key to leave... Text 30,70," " P>36=>P-6->P P<1=>P+6->P Goto 7 Lbl Z Text 31,11,"YOU DID IT!" Stop Following are the four essential sub-programs, called "W","N","E" and "S" "W" Int (T/10)->X Return "N" Int (10Frac (T/10))->X Return "E" 10Frac (Int (10T)/10)->X Return "S" 10Frac (10T)->X Return Some mazes made by myself (type them in in list number six, if you like) Title: "Mirror-Mirror" "Xing" "Classic Maze" "Strange..." 01 10.01 10.10 10.10 11.00 02 01.01 10.01 11.01 01.01 03 01.01 01.11 01.01 00.11 04 00.01 11.01 00.11 00.11 05 01.11 00.01 11.01 10.01 06 10.11 01.11 00.11 00.11 07 10.10 10.00 11.00 10.01 08 10.11 01.10 01.01 00.11 09 10.11 10.01 00.11 10.10 10 10.00 00.11 11.00 10.10 11 01.11 11.00 01.01 10.10 12 10.10 00.11 00.10 10.10 13 10.10 10.00 10.01 10.10 14 10.00 00.01 01.11 11.00 15 01.00 01.10 11.00 01.10 16 00.00 11.00 00.01 11.00 17 00.01 00.11 01.01 01.10 18 00.10 10.10 01.10 11.10 19 10.10 10.10 10.00 10.01 20 10.10 11.00 01.01 00.01 21 11.01 00.11 01.01 00.11 22 00.10 10.01 00.00 10.01 23 11.10 01.00 01.01 01.01 24 11.10 00.10 00.11 00.10 25 10.10 11.00 11.00 10.10 26 11.00 00.11 01.01 10.10 27 11.01 11.00 00.11 10.10 28 10.00 01.10 11.10 10.10 29 01.01 10.01 10.01 10.11 30 01.11 00.10 01.10 10.10 31 11.00 11.01 11.01 11.10 32 01.01 01.00 01.01 11.10 33 01.01 01.11 01.10 11.00 34 01.01 11.01 11.01 11.10 35 01.01 01.10 01.00 11.00 36 00.11 11.10 01.11 01.10 And last, but not least: the map-program. It is NOT necessary for the main program to run, but it can help you if you want to make your own mazes or if you want to have an overview over the actual maze... "MAP" View Window 1,127,0,1,63,0 For 1->I To 36 Int 6Frac (I/6)-1->P Int (I/6)->Q P=-1=>Q-1->Q P=-1=>5->P List 6[I]->T Prog "W" If X=1 Then Plot 1+10P,2+10Q Plot 1+10P,9+10Q Line IfEnd Prog "N" If X=1 Then Plot 2+10P,10+10Q Plot 9+10P,10+10Q Line IfEnd Prog "E" If X=1 Then Plot 10+10P,9+10Q Plot 10+10P,2+10Q Line IfEnd Prog "S" If X=1 Then Plot 2+10P,1+10Q Plot 9+10P,1+10Q Line IfEnd Next Note: You will have to press "G<>T" at the end of the drawing... What I Plan to include in the future: -The Exit should be marked -There should be some enemies -A easy-to-use Editor is surely interesting... -The wole thing should become quicker... Please inform me, if you think, that something isn't right. The program works well on my calculator, but it could be possible, that I made some errors while typing it in this file... Hope you enjoy it A "screenshot" from the game (It's a bit squished, due to the Letters) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XX X X X X X X X X X X X X X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X XX XX X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X XX XX X X X X X X X X X X X X X X X X X X X X X X X X X X X X XXXXXXXXXXXXXXXXXXXXXXXXX X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X XXXXXXXXXXXXXXXXXXXXXXXXX X X X X X X X X X X X X X X X X X X X X X X X X X X X X X XX XX X X X X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X XX XX X X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X X X X X X X X X X X XX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX