Log In  


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


UPDATE:
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 !


QUESTION!

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.

5


Fascinating. Now adapt it to rectangles.


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


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.


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.


Juanitogan:

  • It could be configured for a different size.

Cheepicus:

  • 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.


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.


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.


@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.


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 ^^)




[Please log in to post a comment]