This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-05 18:02:36

skippito
Scratcher
Registered: 2012-03-17
Posts: 100+

Random Maze Generator

I am thinking of making a project that randomly creates mazes that you have to solve. To do this, I need a script (or scripts) that generates a maze randomly. Please post your ideas.

Offline

 

#2 2012-04-05 19:17:46

SOScratch
Scratcher
Registered: 2010-02-01
Posts: 100+

Re: Random Maze Generator

While I do not have time to create a whole script, I can tell you that you will have to use a sprite which is basically just one line. Then you need for it to move around to random locations and stamp it there while something says Loading Maze...

Then create all your other scripts.

Although without experimenting, I have no idea how a script like that would be built...
Try looking at other projects like the one you're trying to make. You should find some useful info there.


-SOScratch
Scratch On!

Offline

 

#3 2012-04-06 19:56:35

silvershine
Scratcher
Registered: 2010-11-21
Posts: 500+

Re: Random Maze Generator

This is an interesting idea, and will definately be a challenge to program, but it is possible.  smile

One way you could go about doing this is by first randomly generating the winning path, and then creating random paths that branch off if the winning one that don't end up going anywhere. I would first have the program save the coordinates of all the lines of the maze in various lists, and then have a sprite create the lines with the pen at those coordinates.

SOScratch was correct in that to print out the final maze the best idea is probably to have a single sprite that draws a pen line that creates the maze.

Good luck with this project! Let us know if you need any more help along the way.

Offline

 

#4 2012-04-14 15:04:58

drakefire
Scratcher
Registered: 2011-12-21
Posts: 3

Re: Random Maze Generator

I did one of these a long time ago.  The method I used first covered most of the screen with solid blocks, pits, or lava, then it went back and added in a path by finding it's way to the top of the screen.  I still have it up if you want to see it.

Offline

 

#5 2012-05-04 11:06:11

kddekadenz
Scratcher
Registered: 2012-04-22
Posts: 10

Re: Random Maze Generator

My basic idea would be to draw the path which leads to the exit first and then randomly add other paths which lead nowhere.

Offline

 

Board footer