Procedural Generated Mazes
Pages: 1 2
Greg (2474) 144 posts |
I have created a small program that generates a random maze. This was the result of some research into an unknown future project. Does or can anyone else make use of this for whatever purpose. It can save off the generated maze data to import or merge with your own projects. It is very basic so feel free to tamper with it. I would be interested in what it can be used for or how it can evolve. It uses an algorithm called a recursive backtracker and the algorithm is in a text file in the app and is also embedded in the code as comments. It is coded in BASIC and is reasonably fast. Eg. 10 × 10 is near instant 20 × 20 is a few secs 100 × 100 under a minuteThese are whilst it is drawing it. Anyhow there we have it. Let me know Greg |
nemo (145) 2546 posts |
Edited because Textile keeps lying to me
|
Paul Sprangers (346) 524 posts |
Amazing… |
David Thomas (43) 72 posts |
https://10print.org/ is relevant. |
nemo (145) 2546 posts |
<Guy writes book on one line of code> <looks at wasted life> |
Bryan (8467) 468 posts |
Missing Variable or, more helpfully, missing semicolon. |
nemo (145) 2546 posts |
They’re two separate lines mate, but feel free to concatenate them with a colon. |
Jean-Michel BRUCK (3009) 359 posts |
Nice , but is there a solution? :-) |
André Timmermans (100) 655 posts |
http://www.riscos-digitalcd.net/games/games.zip contains !Laby_Man a little BASIC game which generates mazes. I can’t remember where maze generator code came from though. |
Greg (2474) 144 posts |
Only one problem with the one liner, it doesn’t generate a maze. Looks nice though. |
nemo (145) 2546 posts |
Tough crowd! Perhaps you’d prefer this: |
Rick Murray (539) 13840 posts |
And that was how many lines? ;) |
Greg (2474) 144 posts |
@nemo |
Greg (2474) 144 posts |
@nemo On closer inspection the maze fails. Sorry for the bearer of such news :-) |
nemo (145) 2546 posts |
Rick requested
It was supposed to be one long line, but Greg noticed
Heisenbug! How did that happen? Not possible. I’m going to blame a cosmic ray, because every time I retry it and test with a flood fill it’s perfect. Seriously, how did that happen? |
nemo (145) 2546 posts |
The advantage of recording something as a GIF is you can play it back in slow motion. The bug was in the placement of The Very First Pixel. sigh. |
Bryan (8467) 468 posts |
Very Interesting. On a Pi 4 with Netsurf (which I was using), I see your post as one line. VDU23,128,1,2,4,8,16,32,64,128,23,129,128,64,32,16,8,4,2,1 REP.VDU127+RND(2):U.0 Iris shows only one line as well. What do you use to see it as two lines? For me, I only see two separate lines, if I view it on Windows. |
Steve Fryatt (216) 2105 posts |
They’re run into a single line in Firefox and Chromium on Linux. That’s why we have
|
Bryan (8467) 468 posts |
Being able to edit a post a day later has both pros and cons. The Iris screen is still open and it shows one line. |
Steve Fryatt (216) 2105 posts |
Being able to edit a post a day later has both pros and cons. I feel that’s fairly unlikely, given that it’s still displaying as one line on Linux long after you posted that. The original is wrapped in Mine, by virtue of the The moral of which is: if you want to post multiple lines of formatted code, use |
Bryan (8467) 468 posts |
I apologize. it just looks different depending on which browser you use. |
Steve Pampling (1551) 8170 posts |
Useful advice. It’s a shame the Formatting Help (below) doesn’t list that and the Textile reference linked to is past its use-by date and no longer available. |
nemo (145) 2546 posts |
Textile is rubbish, and was lying to me. Fixed the formatting of the two-liner for posterity.
It seems to be the width of the column (which can be adjusted by the draggable input box at the bottom) that is the greatest contributor – I typed two lines, it showed two lines, I had no reason to think it was not two lines. But it turns out that though Textile respects newlines in plain text, it removes them from <code>sections</code>… which is insane. These
I now understand why that’s happening. But it’s particularly rubbish in the <code> case.
The bug in the placement of the first pixel of the emergent-message maze was caused by unwarranted precision – a |
Alan Adams (2486) 1149 posts |
|
Rick Murray (539) 13840 posts |
Fixed that for you. I think a good 5% 1 of posts on this forum are about Textile not doing what it’s supposed to, or doing something completely gonzo when it does do what it is (mostly) supposed to. Like the double spaced lines issue.
It will convert anything that looks like a URL into an actual link, which in the case of pre/code sections, just comes out completely wrong. That’s why I sometimes have code snippets that say hxxp://, it’s not a fancy new protocol, it’s simply to stop Textile doing stupid things. As I’ve been adding bits to this post, I’ve been watching Alan’s post above get ever closer to what he wanted. But, really, one shouldn’t have to fight the parser… 1 Figure plucked out of my arse. |
Pages: 1 2