I'm trying to write a function that can generate a random path for a given 2D array of points (x, y).
Now the path has a few requirements I'd like it to meet in order for it to be valid. The path cannot:
- ...be a straight line from point A to B.
- ...go back on itself but can go backwards (demonstrated below).
- ...run parallel/along itself.
I also want to make sure the path starts from the left and ends on the right to hopefully keep it simple.
So I'm looking for something that would do:
......... | ......... | ########.
......... | ......... | .......#.
##....### end | ....####. | ...#####.
.######.. | #####..#. | ...#.....
......... | .......## end | ...###### end
But I don't know where to start and there's vary little information available that does something similar to this.
I could go the A* rout but that seems overkill and from what I know about A* (vary little) I'd need to create "fake" obstacles. Anyway before I go on a rant, can anyone help me?
Any suggestions is greatly appreciated! Thank you.