shithub: puzzles

Download patch

ref: 9ce0a6d93212ffc0986a2b399fd8e9e983f62904
parent: 05c536e50d0c3114e1de5283eac97ff22bad0fc7
author: Simon Tatham <anakin@pobox.com>
date: Sun Feb 5 07:05:28 EST 2023

Pearl: fix bounds check in previous commit.

Ahem. That's what I get for testing the fix on a square puzzle.

--- a/pearl.c
+++ b/pearl.c
@@ -873,7 +873,7 @@
                 for (d = 1; d <= 8; d += d) {
                     int nx = x + DX(d), ny = y + DY(d);
                     int rlink;
-                    if (0 <= nx && nx < w && 0 <= ny && ny < w)
+                    if (0 <= nx && nx < w && 0 <= ny && ny < h)
                         rlink = result[ny*w+nx] & F(d);
                     else
                         rlink = 0;     /* off-board squares don't link back */