POV-Ray : Newsgroups : povray.binaries.images : Rectangular Mazes : Re: Rectangular Mazes Server Time
3 May 2024 08:52:13 EDT (-0400)
  Re: Rectangular Mazes  
From: Robert McGregor
Date: 12 Feb 2012 17:15:01
Message: <web.4f38394b7cb043df94d713cc0@news.povray.org>
Samuel Benge wrote:
> Care to give an overview of the algorithm?

My algorithm is similar to Christian's. I start with a 2d array of cells with
all 4 walls up in each cell. Each cell is a 4D vector <x,y,z,t> representing
<N,E,S,W>. Calculate total number of cells, randomly pick entrance and exit
cells from the borders, and make the entrance cell the current cell. Keep a
tally of each cell visited.

For the current cell check neighboring cells to find any with all walls still
up. Pick one of those at random and remove the wall between them, move to that
cell make it the current one, and loop until you've visited all cells or hit a
dead end (no more neighbors with all walls up) In that case, back track until
you find some valid neighbors and continue.

I just uploaded my maze include file and a few sample scenes to p.b.s-f for
anyone that wants to have a go at it.
-------------------------------------------------
www.McGregorFineArt.com


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.