I need to figure out a way to check for conflicts in a Number Puzzle. This is how the number puzzle works....
It has a 1D array of size 81. It is filled with integers from 1-9.
When the user enters a number i need to make sure it's valid by checking if for conflicts with the rest of the grid. this is how the grid looks like:
| 5 7 4 | 6 9 1 | 8 3 2 |
| 9 3 2 | 7 8 5 | 4 6 1 |
| 8 6 1 | 4 2 3 | 5 7 9 |
|-------+-------+-------|
| 1 2 5 | 9 6 8 | 7 4 3 |
| 6 4 3 | 5 7 2 | 1 9 8 |
| 7 8 9 | 1 3 4 | 2 5 6 |
|-------+-------+-------|
| 3 5 7 | 8 1 9 | 6 2 4 |
| 4 9 8 | 2 5 6 | 3 1 7 |
| 2 1 6 | 3 4 7 | 9 8 5 |
So if the user puts a number into the 2nd Row and 3rd column I have to check for conflicts by:
1) make sure that number is not already there on the 2nd row.
2) the number is not already there on the 3rd column
3) and the number isn't there on the 3*3 subregion it's in --> in this case it's the first 3 rows and the first 3 columns.
I know how to check the 1st two parts in a one dimensional array but I don't know how to check the last part.
Any ideas would be greatly appreciated. :)