Please have a look at the following image (created in Excel for explanation purposes) :
I have a 11x17 grid. No arrays, but done with sprites (each block indicates a sprite). The user needs to build a pipeline from side A to side B, by tapping on the blocks. Tapping on a block 'selects' it, changing opacity to 60%. Tapping again on the same block, 'deselects' it by returning the opacity to 100%. Once a path has been made with selected sprites from side A to side B, the user clicks on OK button, and the 60% opacity sprites are destroyed, thereby creating the path. Also, the sprites each have the solid behaviour set to ON.
What I need to do is to implement a check, before the sprites are destroyed, that the path is valid (as shown with the blue line in image). This check needs to pick up that the yellow line is not valid (due to the joint indicated in circle 1) or that the path is incomplete, as shown by the green line (circle 2).
The selecting/deselecting of the sprites I've mastered, as well as the destruction of the 60% opacity sprites. But for the life of me I have no clue where to even start creating a check as described above.
I would really really really apreciate anyones guidance or even just thoughts on how to tackle this problem.