Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Maze Generator

edited December 2011 in Code Sharing Posts: 20

Generates a random maze using depth-first search. Red cell is the current cell, blue is the top of the stack: where it'll jump to if it gets to a cell with no unvisited neighbors.

This code actually comes from another project I was working on to make a tilt labyrinth type of game. Still messing with it, need to get the collision detection working better (any updates on the physics lib btw?) I pulled out this code and used coroutines to make it so the maze generation could be watched. The slider will slow down the speed. Also in the setup method you can change the size variable to make bigger or smaller mazes.


  • SimeonSimeon Admin Mod
    edited December 2011 Posts: 5,387

    That is awesome. I love watching it work. I had no idea you could generate mazes like this.

    Maze Generator

  • Posts: 384

    Wow, it is like watching systematic termites. Tres cool.

  • BortelsBortels Mod
    Posts: 1,557

    Heh, neat! I wrote a maze generator using the same method on the Atari 400 in BASIC back in the dinosaur age, but you couldn't see the process at work.

    By "tilt labyrinth game" do you mean you'd have to navigate the maze by tilting the iPad? Do it! It sounds like fun, and this is a great start.

Sign In or Register to comment.