static void Print(SudukoBoard board) { Console.Clear(); Console.WriteLine("Possible Values: \n"); Console.WriteLine(board.PossibilitiesToString()); Console.WriteLine("Current Board: \n"); Console.WriteLine(board.ToString()); }
static void play(SudukoBoard board, int x, int y, int z) { if (board.IsAllowed(x, y, z)) { Console.WriteLine("Placing " + z + " at position [" + x + ", " + y + "]"); board.Set(x, y, z); } else { Console.WriteLine("Can't place " + z + " at position [" + x + " , " + y + "]"); } }
static void Main(string[] args) { int[] init; if (args.Length == 0) { init = GetInit("s1"); } else { init = GetInit(args[0]); } SudukoBoard board = new SudukoBoard(init); int x, y, z; while (!board.IsSolved()) { Print(board); (x, y, z) = GetInput(); if (z == 0) { Console.WriteLine("EXIT"); break; } else { play(board, x, y, z); } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); } Console.WriteLine(board.ToString()); Console.ReadKey(); }//Main