]> granicus.if.org Git - nethack/commitdiff
Allow some variance in corridors and reduce predictability
authorPasi Kallinen <paxed@alt.org>
Wed, 4 Nov 2015 19:13:34 +0000 (21:13 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 4 Nov 2015 19:13:39 +0000 (21:13 +0200)
The corridors used to head towards the goal using the straightest
possible line, often making a zig-zag beeline. Allow some slight variance,
sometimes going straight instead of turning, reducing the predictability,
and making those monotonously turning corridors less likely.

src/sp_lev.c

index 2df7dc548a6a0a1346e290380d91689029e5b879..01b0dd4c822071074497843748e08b9999ad30ed 100644 (file)
@@ -2148,6 +2148,12 @@ schar ftyp, btyp;
         dix = abs(xx - tx);
         diy = abs(yy - ty);
 
+        if ((dix > diy) && diy && !rn2(dix-diy+1)) {
+            dix = 0;
+        } else if ((diy > dix) && dix && !rn2(diy-dix+1)) {
+            diy = 0;
+        }
+
         /* do we have to change direction ? */
         if (dy && dix > diy) {
             register int ddx = (xx > tx) ? -1 : 1;