recursive matrix traversal
i am trying to write a function to find the number of objects in a matrix of characters, where an object is defined as an group of adjacent 'X's (not diagonal) not separated by a '0'
has 3 objects: one at the top because all of them are connected, the three at the bottom right, and the single X in the middle.
I can write it iteratively, but it is complicated and i would like to have a recursive function that is easier to see.
i would imagine thaat the function would have four recursive calls in it to check left, up, right, and down. any help is appreciated. Thanks!