maze game help
Author |
Message |
TRESSPASS
|
Posted: Sat Apr 02, 2005 9:14 pm Post subject: maze game help |
|
|
I need to do an assignment for my class that will create a random maze every time the program is run. The maze must have an entrance and exit just like a regualr maze. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Drakain Zeil
|
Posted: Sat Apr 02, 2005 9:59 pm Post subject: (No subject) |
|
|
Let's see... you can make random mazes in a few ways... one, draw a random path untill you reach one point (you can make probability and random at once, depending on the result you get a direction).
Another is to develop a maping grid of several numbers, each number is a differnt "block" so lets say 1 is an opening left, 2 is up, 3 is down... 5 can be left and right, etc etc. Then just keep generating randomly until you can get a path to the end (use of some clever IF statements).
Other then that I can't think of anything the pre-made mazes. |
|
|
|
|
|
TRESSPASS
|
Posted: Sat Apr 02, 2005 10:33 pm Post subject: (No subject) |
|
|
the way my teacher told me how was to draw random lines, then use a draw fill drawfill command to know when the maze is complete, im not sure how to do it that way, if someone can write some code to help me out with this project I'll greatly appreciate it. |
|
|
|
|
|
Drakain Zeil
|
Posted: Sun Apr 03, 2005 9:00 am Post subject: (No subject) |
|
|
You could use whatdotcolour on the enterance/exit, after filling on a pixel that is one offset from either side. |
|
|
|
|
|
rose1997
|
Posted: Tue May 26, 2009 4:47 pm Post subject: RE:maze game help |
|
|
how to make a maping grid????
can be very specific |
|
|
|
|
|
A.J
|
Posted: Tue May 26, 2009 6:12 pm Post subject: RE:maze game help |
|
|
Well, one way of creating random mazes is to fill up a 2D array (that will store your maze) with either walls or empty 'spaces' (or 'not walls', if you will). Then, representing this 2D array graphically is just a matter of drawing colored in squares for the walls and blank squares for the empty 'spaces'. If you want to get real fancy, you could use a pathfinding algorithm (e.g DFS/BFS/A*) to graphically represent the shortest path from the entrance to the exit.
I may have misunderstood your question, so I hope this helps. |
|
|
|
|
|
|
|