At this point I have a tile based game. The tiles are stored in a 6 by 12 array labelled 1-10. I need to search the board to find if there are 3 or more in a row or column after the player makes a switch, btw switches can only happen on the x axis and only with other tiles. I have the event listener all set but to search the board but after an event happens all I have is about 50 lines of if statements after two for loops. Each statement compares the x and y to x+1 and x+2 or x1 and x-2 and so on.

I have searched google and do know how to search 2d arrays but only for individual pieces, is there a way to expedite and unclutter the process of searching for rows or columns of 3+ of the same tile??

Also as a second question a move is made the tiles in row or column that have 3+ consecutive tiles of the same value will disappear and the remaining tiles will move up. again i do this with lots of if statements first changing the tiles found in 3 ore more to 0 my null number then replacing them with the next tile in the row the is not 0. Is there a better way to do either of the above processes that does not involve the millions of if statements i am currently using?