Hi David,

thanks for the extensive analysis, explanation, and research
and for the patch.  It is now committed.

Yours,
  Ingo



CVSROOT:        /cvs
Module name:    src
Changes by:     [email protected]        2018/12/20 02:55:44

Modified files:
        games/wump     : wump.c 

Log message:
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?



David Fifield wrote on Thu, Dec 20, 2018 at 12:11:25AM -0700:

> Index: wump.c
> ===================================================================
> RCS file: /cvs/src/games/wump/wump.c,v
> retrieving revision 1.33
> diff -u -p -u -r1.33 wump.c
> --- wump.c    7 Mar 2016 12:07:57 -0000       1.33
> +++ wump.c    20 Dec 2018 07:00:13 -0000
> @@ -535,8 +535,8 @@ into room %d!\n", arrow_location, next, 
>               /* 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();

Reply via email to