https://docs.google.com/file/d/0B3iZ60F3QWxTWnJQb19EM3lmyZTA/edit - the capx.
Good day! Again, I'm stuck at this logic. As you can see, sometimes it work and correct blocks are destroyed, sometimes it work terrible , and sometimes it show message that stack is overloaded, but I don't see the reason, because there are no infinite recursions.
The logic have works as: when you touch block, it call function with it's position in array params and it's index param. Then, function go in 4 directions (up, down, left, right) with step = 1 and when it found the value it call same function but with current params (like recursion).