aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bridges.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bridges.c b/bridges.c
index db4a66e..3226334 100644
--- a/bridges.c
+++ b/bridges.c
@@ -2571,6 +2571,8 @@ static game_state *execute_move(const game_state *state, const char *move)
goto badmove;
if (!INGRID(ret, x1, y1) || !INGRID(ret, x2, y2))
goto badmove;
+ /* Precisely one co-ordinate must differ between islands. */
+ if ((x1 != x2) + (y1 != y2) != 1) goto badmove;
is1 = INDEX(ret, gridi, x1, y1);
is2 = INDEX(ret, gridi, x2, y2);
if (!is1 || !is2) goto badmove;
@@ -2582,6 +2584,7 @@ static game_state *execute_move(const game_state *state, const char *move)
goto badmove;
if (!INGRID(ret, x1, y1) || !INGRID(ret, x2, y2))
goto badmove;
+ if ((x1 != x2) + (y1 != y2) != 1) goto badmove;
is1 = INDEX(ret, gridi, x1, y1);
is2 = INDEX(ret, gridi, x2, y2);
if (!is1 || !is2) goto badmove;