> What do you mean by error prone?
Your approach is simple, if you reach a mine you increase the neighbours counter.
The problem is your implementation, you need to make sure that:
- you don't have out of bounds access (your conditionals)
- you are actually touching what you want (the conditional and the statement refer to the same cell)
- you are visiting all the neighbours, and only one time
That verification takes time, and you may made mistakes doing it. So you may end with something incorrect that is reviewed as right.
> Also I tested other test cases from different websites
¿didn't you notice an extra blank line at the beginning of the output?
By instance, for
it should be
not
not
About your arrays declaration, what you're doing is illegal, so yes, consider to change it.