Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Random maze generator

Author
Message
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 17th Aug 2003 00:33
The idea:
To generate a maze randomly using a single seed, with the element of only wall and floor.

The situation:
See my source code for details


The hopeful outcome:
An algorithm from one of you guys which will somehow point me in the right direction.


Cheers in advance
"We are getting aggravated"
"Yes, we are"
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Aug 2003 05:43
Try this:

There seems to be a problem with randomize. If you give it same seed you should get same maze each time, but you don't. You get a slection of 2 or 3. Most odd.

Code generates a maze. press key to generate another.

The programmer formerly known as sonic
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Aug 2003 13:23
Ignore code in last post. Use this version.

The randomize problem is fixed now. It was because I did not reinit the direction array.

The programmer formerly known as sonic
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Aug 2003 13:55
For those that are interested, here's what it gernerates:



It will generate a maze of any size, instantly, with only ONE path from start to end. The end has to be specified (I have chose top left corner). The start is then the furthest distance away.

The programmer formerly known as sonic
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 17th Aug 2003 16:29
Cheers for that, but its not quite what i was looking for, i really wanted an algorithm to tell me how to program it, not just the code itself, it would take me ages to actually decipher that code and work out what it does. Nice generater though, it works a charm.

"We are getting aggravated"
"Yes, we are"
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Aug 2003 17:01
Here is a brief explanation of how it works. Trust me, it is not that difficult!



The programmer formerly known as sonic
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Aug 2003 17:44
Right, here's another version of the code that shows you the maze being generated which should explain the logic a lot easier.

The programmer formerly known as sonic
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 17th Aug 2003 17:53
Ok now im confuzzled

"We are getting aggravated"
"Yes, we are"
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Aug 2003 18:04
Sorry to hear that, maybe you should see a doctor. Judging by your sig you are also looking a bit pale!

Give it time to sink in and all will become clear. Best thing to do is get a bit of graph paper and follow program through. I can't see what else I can do to help you.

The programmer formerly known as sonic
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 17th Aug 2003 18:19
Ok i think im getting it a bit now. It follows the maze going in random directions and seeing if it can take the next step and if it cant it backtracks until it can and then goes the next direction, am i on the right lines

"We are getting aggravated"
"Yes, we are"
ifman1
21
Years of Service
User Offline
Joined: 3rd Jul 2003
Location:
Posted: 17th Aug 2003 23:59
Oh, that's nice... so so sweet! May I use this... PLEASE?????


Sex Junky... Looking for a Dealer!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 18th Aug 2003 00:34
Of course you can!

The programmer formerly known as sonic

Login to post a reply

Server time is: 2024-11-25 04:22:02
Your offset time is: 2024-11-25 04:22:02