-.\" $NetBSD: wump.6,v 1.6 2003/08/07 09:37:57 agc Exp $
+.\" $NetBSD: wump.6,v 1.7 2006/01/19 21:20:35 garbled Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
The default is three.
.It Fl r
Specifies the number of rooms in the cave.
-The default cave size is twenty-five rooms.
+The default cave size is twenty rooms.
.It Fl t
Specifies the number of tunnels connecting each room in the cave to
another room.
-/* $NetBSD: wump.c,v 1.19 2006/01/19 20:15:31 garbled Exp $ */
+/* $NetBSD: wump.c,v 1.20 2006/01/19 21:20:35 garbled Exp $ */
/*
* Copyright (c) 1989, 1993
#if 0
static char sccsid[] = "@(#)wump.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: wump.c,v 1.19 2006/01/19 20:15:31 garbled Exp $");
+__RCSID("$NetBSD: wump.c,v 1.20 2006/01/19 21:20:35 garbled Exp $");
#endif
#endif /* not lint */
for (i = 0; i < pit_num; ++i) {
do {
loc = (random() % room_num) + 1;
- } while (cave[loc].has_a_pit && cave[loc].has_a_bat);
+ } while (cave[loc].has_a_pit || cave[loc].has_a_bat);
cave[loc].has_a_pit = 1;
#ifdef DEBUG
if (debug)
(void)printf("<wumpus in room %d>\n", loc);
#endif
+ i = 0;
do {
player_loc = (random() % room_num) + 1;
- } while (player_loc == wumpus_loc || (level == HARD ?
- (link_num / room_num < 0.4 ? wump_nearby() : 0) : 0));
+ i++;
+ } while (player_loc == wumpus_loc || cave[player_loc].has_a_pit ||
+ cave[player_loc].has_a_bat || (level == HARD ?
+ (link_num / room_num < 0.4 ? wump_nearby() : 0) : 0) ||
+ (i > 100 && player_loc != wumpus_loc));
}
int