Log In  

Cart #31465 | 2016-10-22 | Code ▽ | Embed ▽ | No License

10-22-16 Made code a lot smaller w better coding
10-22-16 Changed random for cycle, makes tighter maze
10-22-16 No hesitation, hold (O?) to build maze

Sometimes programming languages are too complex for their own good.

Take B4GL. It's designed for building 3D games so to even get a simple rectangle or square that is measured by true-pixels on your screen is a pain to achieve without first defining your graphic plane of existence.

Even BlitzMAX must rely on you saving regions of raster information on the order of R G B A where A is alpha, in order to read it back.

Clumsy - inefficient, and then there is PICO.

Read a pixel, write a pixel. What could be easier ? :)

This is a program I've been meaning to try for a-while but didn't want to fight the architect of the other languages that don't handle individual pixels so well.

I had it in my mind. Draw a random vertical or horizontal line. Draw another. If it intersects an existing line, HOP over it. Keep repeating until no more lines can be added. Done.

I really didn't know what to expect, and now I can see it is a very definite and DIFFERENT type of maze maker.

Try and solve the maze with your fingers from the top-left-hand corner to the bottom-right-hand corner. It's not as easy as it sounds.

Enjoi !


Does anyone know how to build a maze that does not have any dead ends ? That is, every point in the maze can reach every other point but never give you a choice or chance of directions, only turns in the maze.

P#31462 2016-10-22 13:21 ( Edited 2016-11-13 03:23)

Fascinating. Now adapt it to rectangles.

P#31481 2016-10-22 17:21 ( Edited 2016-10-22 21:21)

Rectangles ? How do you mean ? Can you post a pseudo-image of this ?

P#31488 2016-10-22 19:04 ( Edited 2016-10-22 23:04)

Instead of square mazes only, allow any x,y dimension. The easiest thing to do is to draw the outer border as a rectangle and let it run as is and ignore what is outside that border. But that's wasteful if building a maze in memory as a level map.

P#31929 2016-10-27 22:40 ( Edited 2016-10-28 02:40)

This is an interesting maze algorithm that makes some weird lookin mazes

I can think of a cheesy way to do a labyrinth: do a normal maze at a lower resolution, then fill it in with a double-bandwidth path that treats dead ends as loopbacks.

IOW, imagine you have a normal maze with dead ends and intersections all that jazz (but no freestanding walls). Into it you drop a very small robot. It can only follow the right hand rule, and drags a piece of chalk behind it as it goes. The chalk would trace out a labyrinth.

P#31949 2016-10-28 08:02 ( Edited 2016-10-28 12:06)


  • It could be configured for a different size.


  • I've checked it pretty carefully. It does seem (at least from what I can tell) that all openings link to each other. There are no sealed off corridors that are unreachable.

A robot could be dropped in to check everything.

P#31978 2016-10-28 21:00 ( Edited 2016-10-29 01:00)

I didn't say anything about whether rooms were connected. (FWIW I believe your maze are connected because none of the line segments can ever seal off a space when they divide it.)

I was addressing your QUESTION! about how to make mazes that don't have any intersections in them. That kind of maze is called a labyrinth.

P#31993 2016-10-29 02:22 ( Edited 2016-10-29 06:22)

Not sure if I understood your question right ... Prim's algorithm gives nice mazes where every point can be reached but it still has many dead ends.

P#32355 2016-11-09 07:06 ( Edited 2016-11-11 01:44)

@movAX13h: a dead end is a cell with 3 walls. by scanning them and breaking a random wall you should get a pacman-ish maze.

P#32356 2016-11-09 07:31 ( Edited 2016-11-09 12:31)

I think dw was asking about a cretan labyrinth, one single long turning corridor that fills the map:

(this one is one big dead end, though ^^)

P#32357 2016-11-09 07:50 ( Edited 2016-11-09 12:59)
P#32423 2016-11-12 22:23 ( Edited 2016-11-13 03:23)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-03-20 21:02:17 | 0.022s | Q:27