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.
This commit is contained in:
Pasi Kallinen
2015-11-04 21:13:34 +02:00
parent 145ff80ec5
commit 2ee06dda5a

View 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;