From 2ee06dda5a4f1bac6cf8237f8745322d93ab678a Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 4 Nov 2015 21:13:34 +0200 Subject: [PATCH] Allow some variance in corridors and reduce predictability 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sp_lev.c b/src/sp_lev.c index 2df7dc548..01b0dd4c8 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -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;