ref: 68ba10dc5a36e55b7de9dc4416715be73b424a1b
parent: 0dda52b4df41b397787f89a9076d1fe158896e4b
author: mkf <mkf@cloud9p.org>
date: Sun May 19 13:47:21 EDT 2024
engine.c: game is over when glenda reachs the edge, not sooner, not later
--- a/engine.c
+++ b/engine.c
@@ -51,8 +51,8 @@
for(i = 0 ; i < cnt ; i++)
{
/*
- it's unlikely, but possible:
- we randomly pick a cell which already have a wall or glenda inside it
+ * it's unlikely, but possible:
+ * we randomly pick a cell which already have a wall or glenda inside it
*/
do
{
@@ -163,15 +163,12 @@
if(networked)
return netmove(dir);
-
- if(dst.x == 0 || dst.x == SzX-1 || dst.y == 0 || dst.y == SzY-1)
- goto done;
grid[dst.x][dst.y] = Glenda;
-done:
grid[src.x][src.y] = Prev;
turn++;
+ nextglenda();
return Ok;
}
@@ -246,7 +243,6 @@
return grid[x+(y%2?0:-1)][y-1];
default:
sysfatal("andrey messed up big time");
- // return -1; /* silence compiler */
}
}
@@ -317,7 +313,8 @@
else if(ptype[1] == Computer)
domove(nextdir);
- if(eqpt(findglenda(), Pt(-1, -1)))
+ p = findglenda();
+ if(p.x == 0 || p.x == SzX || p.y == 0 || p.y == SzY)
state = Lost;
}
@@ -344,4 +341,4 @@
memcpy(g, grid, sizeof grid);
memcpy(grid, pgrid, sizeof grid);
memcpy(pgrid, g, sizeof grid);
-}
\ No newline at end of file
+}