Hiya, I have been working on a program that looks for 4 in a line in a 2D array. I have made several methods such as
These methods work fairly well sometimes and completely fail at others. I get all excited that my program works, and the next minute, using the same pattern, it doesnt! It also sees things that are not there.if(token(i,j) == token(i+1,j) { if(token(i+1,j) == token(i+2,j) { Counter++; } }
It this a common problem in java for these methods to not always check very well. Even my Winner method sometimes fails even though if I re-do the pattern it works. Also I have had to keep several backups as slight changes to it when working make it return very strange things!
Why do my methods fail sometimes and not others? Is it my code, or some sort of slow java related problem?? I seem to get it working just by looking at it sometimes.
Where token is just return array[col][row];