Simple Puzzle Algorithm

I am developing a (really) simple puzzle game that asks you to join point A to B (enter / exit) using a ball and mechanisms that you can rotate to give the ball the right direction to join the exit.

Here are simple-level screenshots that clearly show the purpose of the game:

1) A new level has begun, the mechanisms rotate randomly

2) The level is completed, all mechanisms are rotated correctly to give the ball the correct path to join the exit

Question:

How can I create an algorithm that automatically generates levels, taking into account the rotation and leaving only one opportunity for the player to reach the level?

I would also like to add extra complexity by adding more mechanisms (to create difficulty levels).


I don't think we need to talk about technology, but I use C # and Unity.

Let me know if you need more information.

Thank!

+4
source share
1 answer

If you look at the second image, the game solution is a broken line starting with "ENTER" and ending with "EXIT".

You can create a new level by creating such a line (randomize the number of “gaps” and their direction). Then you turn each corner into a rotation mechanism. There will be only one legal decision, since you will need to turn things right simply.

+3
source

Source: https://habr.com/ru/post/1673584/


All Articles