Tile puzzles...

I’m trying to figure out how to generate a puzzle like this:

http://java4k.com/index.php?action=games&method=view&gid=119
and

The grid is of 8x8.

I thought I could simply generate a maze, and then randomly rotate the tiles/nodes.

Anyone implemented something like this before?

whats the question again :-*

start from some vertex and generate a tree randomly?

:slight_smile:

Ok, the question is: How do I generate a puzzle like that?

looking at the nodes in this puzzle I’d begin resolving the puzzle first and randomizing it right after it is created…

  • (~) ----±— <o) : this is solved and then randomize it

                |
                |
    
  • (~) + <o) : this looks like unsolved (nodes are randomized and the light-bubbles stay).
    |
    |

:slight_smile:

I assume that he figured as much as that he had to randomly rotate the tiles. I think there is more of a problem to:

  • Generate the maze in the first place
  • Make sure there are no empty tiles
  • Make sure that all tiles will have to be used (no sections not connected to the rest of the network)
  • No dead ends
  • Same number of bulbs for each generated puzzle (or at least about the same)
  • Only one solution exists (not sure if this is NEEDED, but probably the way it should be.
  • No loops

The code for jnetwalk was published, so hints could be in there, but it was a 4k game so he did some cheating I think.

Have not thought much about it, but I think you could create a big room and then split with a horizontal and a vertical line/wall at random places. Add 3 doors at random places on 3 different subsections of the walls. That way you can get to everywhere from everywhere. Then recursively subdivide the 4 new rooms the same way until it isn’t possible to subdivide anymore. Then you should have a maze with no loops and everything connected. You are looking for a network, so replace every path with a line and remove the walls. Just place the hub at a random place and a “bulb” at every dead end. Think that should solve most of the problems. Not sure if this would only give one solution, and number of bulbs could vary, so there might be a better way to do it, but it seems like a fairly easy way to create it. I have not tried to implement anything like this, just seemed like a fun challenge to figure out. Hope I didn’t overlook any problems with it.