summaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-12-20 09:55:44 +0000
committerschwarze <schwarze@openbsd.org>2018-12-20 09:55:44 +0000
commit6106ce73d60968add179949ec4fdf000d95bed55 (patch)
tree6adab0491d4ca8d9af25811130c429a6cc6ab2f1 /games
parentzap whitespace (diff)
downloadwireguard-openbsd-6106ce73d60968add179949ec4fdf000d95bed55.tar.xz
wireguard-openbsd-6106ce73d60968add179949ec4fdf000d95bed55.zip
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?
Diffstat (limited to 'games')
-rw-r--r--games/wump/wump.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/games/wump/wump.c b/games/wump/wump.c
index e41319af67a..09ec8e04a3b 100644
--- a/games/wump/wump.c
+++ b/games/wump/wump.c
@@ -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();