I'm working on a game for iOs and I'm stuck on something.
The idea is simple: I have a player that must go forward in order to win points (and avoid the yellow bricks). Here is (on green) the ideal path in order to go forward inside the rectangle (from the bottom to up).
I'm adding a new row each time, so each new row has to let the player move forward (it can move to the left, right and forward, no diagonal).
The idea is to have some 'parasite' empty spots, so the user must think about his next move.`
So, my question: how to generate something like this (for any number of columns)
Thanks.
C.C.
Personally, I would tackle this backward:
Generate the "right" path then randomize the remaining cells with some heuristic that prevents it from generating a "wrong" path.
The heuristic could be something similar to this:
Let line 1 be the closest row, and line 10 the furthest.
Let a path be a series of contiguous 0s.
If line 1 contains only the "right" path and all lines from 2 to 9 contains at least one "wrong" path, have line 10 contain only the "right" path.
This heuristic might not be perfect, it's just an idea off the top of my head.