Microcode Maze Maker (Source Included)
BlitzMax Forums/BlitzMax Programming/Microcode Maze Maker (Source Included)
| ||
Updated 03-12-16 12:34pm This is in wrong area, please place in programming, thanks ! Mazes really are fascinating things. And there are so many different kinds that are out there. What I had put on the back burner and was curious about was how to make a perfect maze maker in as tiny space of coding as possible. Basically a mental challenge for myself. Now there are many ways of writing a maze generating program, some can be quite huge, but none I think as small as this for BlitzMAX: What I am doing is choosing a random location and just chiseling outward until I cannot, and only then choose a new random position. And by doing so it really does create a workable, playable, and perfectly diabolical maze. Enjoi ! |
| ||
excellent code :) didn't like the formatting :0 here's a slightly modified version that plays nicely with superstrict and appexit I've also tinkered slightly with the code to give a better (shorter) run of corridor lengths |
| ||
Hi Adam. Sorry to take so long to get back to this. I still posted this in the wrong area so I wasn't looking in this Forum. I'm glad you have an interest in this. Reading your code ... I see you are creating some variables for Map Width and Map Height, but they cannot be displayed properly because Function Update is still drawing them at a size of 32x32 pixels. Additionally you have variables X and Y being set to random variables that do not match Map Width or Height. As for a simple maze, if you don't like the intelligent worm design, you can change my code HERE: If n>99 Then x=Rand(15)*2-1 ; y=Rand(10)*2-1 ' pick a random position to THIS: x=Rand(15)*2-1 y=Rand(10)*2-1 ' pick a random position The code you wrote crashes sometimes if run in DEBUG mode, it overwrites some of the walls too, so there is a problem in it. As for adding spaces between commands, functions, and variables. This is an auto feature of GFA and sorely missed in BlitzMAX. if a=5 then b=6+c IF a = 5 THEN b = 6 + c GFA would correctly space and CAPS and COLOR commands once you pressed ENTER on a line. |
| ||
Agreed. there are some crashes - my Bad ;[ some error checking for out of bounds x/y positions is needed The overwriting of some walls I did for a different type of maze with more routes through it Yep. I wish there were a lot of things that max does which could be better :( |
| ||
As for adding spaces between commands, functions, and variables. This is an auto feature of GFA and sorely missed in BlitzMAX. This is not a language feature, but IDE feature. For instance, IndevIDE automatically formats lines by adding spaces were needed. Munch is currently developing MaxIDE fork <as seen in this thread> ,so if this feature is desired you could try asking. -Henri |
| ||
Hi Adam: Until such time I will keep my code tight and small with no spaces. I never had to type them in GFA, ultimately when a good new (not WIP) IDE comes out, loading the code should automatically put spaces in them. Henri, I am looking at this MaxIDE but it certainly does seem to be a WIP, still with bugs. I will continue to use my current IDE until it's an official and error free release. Also, I tried out some other MaxIDE forks and was disappointed to see many of the features I like in current MaxIDE not to be present. Two come to mind. [1] You must click in the window every time you ALT-TAB to it. Current MaxIDE automatically focuses the window, not requiring you to use the mouse to click in it. [2] You cannot use CTRL-LEFT and CTRL-RIGHT arrow keys to navigate code, you must use CTRL-TAB and SHIFT-CTRL-TAB which I do not like. |