public static void Main()
int[][] board1 = new int[][]
new int[] {5, 3, 4, 6, 7, 8, 9, 1, 2},
new int[] {6, 7, 2, 1, 9, 5, 3, 4, 8},
new int[] {1, 9, 8, 3, 4, 2, 5, 6, 7},
new int[] {8, 5, 9, 7, 6, 1, 4, 2, 3},
new int[] {4, 2, 6, 8, 5, 3, 7, 9, 1},
new int[] {7, 1, 3, 9, 2, 4, 8, 5, 6},
new int[] {9, 6, 1, 5, 3, 7, 2, 8, 4},
new int[] {2, 8, 7, 4, 1, 9, 6, 3, 5},
new int[] {3, 4, 5, 2, 8, 6, 1, 7, 9}
int[][] board2= new int[][]
new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9},
new int[] {2, 3, 1, 5, 6, 4, 8, 9, 7},
new int[] {3, 1, 2, 6, 4, 5, 9, 7, 8},
new int[] {4, 5, 6, 7, 8, 9, 1, 2, 3},
new int[] {5, 6, 4, 8, 9, 7, 2, 3, 1},
new int[] {6, 4, 5, 9, 7, 8, 3, 1, 2},
new int[] {7, 8, 9, 1, 2, 3, 4, 5, 6},
new int[] {8, 9, 7, 2, 3, 1, 5, 6, 4},
new int[] {9, 7, 8, 3, 1, 2, 6, 4, 5}
Console.WriteLine("Hello World\n");
Boolean yay = new Boolean();
Boolean yay2 = new Boolean();
yay = Sudoku.ValidateSolution(board1);
yay = Sudoku.ValidateSolution(board1);
Console.WriteLine("Board 1 is ... " + (yay ? "Good!" : "Bad!"));
Console.WriteLine("\n-------Next Board-------\n");
Console.WriteLine("Board 2 is ... " + (yay2 ? "Good!" : "Bad!"));
public static bool ValidateSolution(int[][] board)
Console.WriteLine("\n-------- Start New Board --------\n");
int[] row = new int[board.Length + 1];
int[,] column = new int[board.Length, board.Length + 1];
int[,] lilSquare = new int[board.Length, board.Length + 1];
for (int y = 0; y < board.Length; y++)
Console.WriteLine("---- Next Row ----");
for (int x = 0; x < board.Length; x++)
int square = findLilSquare(x,y);
lilSquare[square, board[y][x]] += 1;
column[x, board[y][x]] += 1;
Console.Write("Location X:" + x + ", Y:" + y + " Board-value / Row-array index:" + (board[y][x]) + " Row value:" + row[board[y][x]]);
Console.WriteLine(" Square: " + square + " Column: " + y + " Value " + board[y][x] + " Count: " + column[x, board[y][x]]);
if (row[board[y][x]] > 1)
if (column[x, board[y][x]] > 1)
if (lilSquare[square, board[y][x]] > 1)
if (x == board.Length - 1)
row = new int[board.Length + 1];
public static int findLilSquare(int x, int y)