I'm kind of new around here and I realy need some help in writing a method.
The method I need to write is working on a specific 2d array and doing these steps:
The method is going over all the array cells and checks for each and every one of them whether it's positive or negative. If positive-the method copies the cell value into an other 2d-array in the same row&col.
If negative, the method checks whether the cell has at least two positive neighbors (including oblique). If the cell has two positive neighbors-the method copies the cell's absolute-Value into the same 2d-array in the same row&col. If the negative cell doesn't have 2positive neighbors -the method copies the cell's value into the other 2d-array.
The problem is I can't find an elegant&short way to check if a specific cell has 2 positive neighbors without writing 200 conditions. I found a way to check it while using for loops but the soloution is still long&complicated. I hope one of you will be able to help me to write this method .
btw- I've attached the API file of the class. The method I'm talking about is Matrix sign()...(I can't upload html doc. so I've put it in a ZIP file...It isn't a Virus!)