+ /*
+ * Opinion varies on whether getting to a single peg counts as
+ * completing the game, or whether that peg has to be at a
+ * specific location (central in the classic cross game, for
+ * instance). For now we take the former, rather lax position.
+ */
+ if (!ret->completed) {
+ int count = 0, i;
+ for (i = 0; i < w*h; i++)
+ if (ret->grid[i] == GRID_PEG)
+ count++;
+ if (count == 1)
+ ret->completed = 1;
+ }
+