1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

Move a badly positioned parenthesis that caused nonsensical movement

properties for the Wumpus.  The bug has been present since 4.3BSD-Reno
and was introduced by Keith Bostic on February 14, 1990 when committing
the major rewrite from Dave Taylor.

Patch (accompanied by a detailed functional and historical analysis)
from David Fifield <david at bamsoftware dot com> on bugs@.

With all the bats in these caves, how could a bug possibly survive
for twenty-eight years?
This commit is contained in:
schwarze 2018-12-20 09:55:44 +00:00
parent 2c63dfae8a
commit 6106ce73d6

View File

@ -1,4 +1,4 @@
/* $OpenBSD: wump.c,v 1.33 2016/03/07 12:07:57 mestre Exp $ */
/* $OpenBSD: wump.c,v 1.34 2018/12/20 09:55:44 schwarze Exp $ */
/*
* Copyright (c) 1989, 1993
@ -535,8 +535,8 @@ into room %d!\n", arrow_location, next, cave[arrow_location].tunnel[link]);
/* each time you shoot, it's more likely the wumpus moves */
static int lastchance = 2;
if (arc4random_uniform(level) == EASY ?
12 : 9 < (lastchance += 2)) {
lastchance += 2;
if (arc4random_uniform(level == EASY ? 12 : 9) < lastchance) {
move_wump();
if (wumpus_loc == player_loc) {
wump_walk_kill();