Hello guys,
Getting a infinite loop in my code.. I hope someone can help me out here..
static int[,] Sudoku_Solver(int value, int px, int py, int[,] field)
{
if (count == 2)
{
}
else
{
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
field[i, j] = fileText[i * size + j] - '0';
}
}
field[px, py] = value;
for (int x = 0; x < 9; x++)
{
for (int y = 0; y < 9; y++)
{
if (field[x, y] == 0)
{
for (int val = 1; val <= 9; val++)
{
if (ChkMove(y, x, val, field))
{
Sudoku_Solver(val, x, y, field);
}
}
return null;
}
}
}
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
Console.Write(field[j, i]);
}
Console.WriteLine();
}
Console.WriteLine("---------");
count = 1;
}
return field;
}
Hope this is enough to detect the problem.
Pasibun