Anonymous user
Knight's tour: Difference between revisions
→{{header|Java}}: we only have to check the neighbors of the last move
m (→{{header|Java}}: parameterize rawtypes) |
(→{{header|Java}}: we only have to check the neighbors of the last move) |
||
Line 1,554:
c = nb[1];
grid[r][c] = count;
if (!orphanDetected(count, r, c) && solve(r, c, count + 1))
return true;
grid[r][c] = 0;
Line 1,584:
}
private static boolean orphanDetected(int
if (
}
return false;
|