Add SAFE state to indicate un-probed safe tile

This commit is contained in:
2025-03-22 13:33:38 +00:00
parent 3d4cfc7a0c
commit 49417b4840
3 changed files with 15 additions and 4 deletions

14
puzz.c
View File

@@ -106,8 +106,18 @@ status_t check(puzz_t puzz)
{
for (int y = 0; y < HEIGHT; ++y) {
for (int x = 0; x < WIDTH; ++x) {
if (puzz[x][y] != UNKNOWN && puzz[x][y] != soln[x][y])
return INCORRECT;
switch (puzz[x][y]) {
case UNKNOWN:
continue;
case SAFE:
if (soln[x][y] == MINE)
return INCORRECT;
break;
default:
if (puzz[x][y] != soln[x][y])
return INCORRECT;
break;
}
}
}
return OK;