sudoku game function help
I am trying to figure out a function to see if the current number exists in the sudoku block already. The full sudoku grid is represented by a 2d array of integers. Dont have much so far, still thinking about how I can do this, but all of this coding has fried my brain and im stuck. Ill probably say duh.
Code:
private Boolean IsCurrentNumberInBlock(int xloc, int yloc, int[,] ar)
{
}
Re: sudoku game function help
If you want to traverse a 2D array then the simplest way is with nested 'for' loops, using the result of calling GetUpperBound for each dimension to get the upper limit for each loop. You can reset a bool before the loops, set it if you find a match and break out of the loops if the flag is set, returning the bool at the end.