Lines Matching refs:cave

67 /* some defines to spec out what our wumpus cave should look like */
70 #define MAX_LINKS_IN_ROOM 25 /* a complex cave */
88 /* simple cave data structure; +1 so we can index from '1' not '0' */
92 } cave[MAX_ROOMS_IN_CAVE+1];
107 static int pit_num = PIT_COUNT; /* # pits in cave */
109 static int room_num = ROOMS_IN_CAVE; /* # rooms in cave */
175 "No self-respecting wumpus would live in such a small cave!\n");
200 "Too many tunnels! The cave collapsed!\n(Fortunately, the wumpus escaped!)\n");
211 "The wumpus refused to enter the cave, claiming it was too crowded!\n");
217 "The wumpus refused to enter the cave, claiming it was too dangerous!\n");
226 "\nYou're in a cave with %d rooms and %d tunnels leading from each room.\n\
227 There are %d bat%s and %d pit%s scattered throughout the cave, and your\n\
248 if (getans("In the same cave? (y-n) ") == 0)
266 "\nYou are in room %d of the cave, and have %d arrow%s left.\n",
277 cave[player_loc].tunnel[0]);
280 if (cave[player_loc].tunnel[i] <= room_num)
281 (void)printf("%d, ", cave[player_loc].tunnel[i]);
282 (void)printf("and %d.\n", cave[player_loc].tunnel[link_num - 1]);
321 * cave as per their directions. If room_number is a null string,
332 cave[player_loc].tunnel[link_num-1] != next_room)
337 (void)printf("Sorry, but we're constrained to a semi-Euclidean cave!\n");
339 (void)printf("What? The cave surely isn't quite that big!\n");
341 cave[player_loc].tunnel[link_num-1] != next_room) {
342 (void)printf("What? The cave isn't that big!\n");
355 if (cave[player_loc].tunnel[i] == next_room)
381 if (cave[next_room].has_a_pit) {
391 if (cave[next_room].has_a_bat) {
439 if (cave[arrow_location].tunnel[j] == next)
456 else if (cave[arrow_location].tunnel[lnk] > room_num)
460 cave[arrow_location].tunnel[lnk]);
466 cave[arrow_location].tunnel[lnk]);
467 arrow_location = cave[arrow_location].tunnel[lnk];
536 * In this routine we'll initialize the Wumpus cave to have all rooms
545 /* initialize the cave first off. */
548 cave[i].tunnel[j] = -1;
552 * To keep the cave connected, we need the greatest common divisor
561 cave[i].tunnel[0] = lnk; /* forw link */
562 cave[lnk].tunnel[1] = i; /* back link */
564 /* now fill in the rest of the cave with random connections */
567 if (cave[i].tunnel[j] != -1)
572 if (cave[i].tunnel[k] == lnk)
574 cave[i].tunnel[j] = lnk;
579 if (cave[lnk].tunnel[k] == i)
583 if (cave[lnk].tunnel[k] == -1) {
584 cave[lnk].tunnel[k] = i;
594 qsort(cave[i].tunnel, link_num,
595 sizeof(cave[i].tunnel[0]), int_compare);
602 (void)printf("%d ", cave[i].tunnel[j]);
614 * remove bats and pits from the current cave in preparation for us
618 cave[i].has_a_bat = cave[i].has_a_pit = 0;
630 } while (cave[loc].has_a_bat);
631 cave[loc].has_a_bat = 1;
641 } while (cave[loc].has_a_pit || cave[loc].has_a_bat);
642 cave[loc].has_a_pit = 1;
659 } while (player_loc == wumpus_loc || cave[player_loc].has_a_pit ||
660 cave[player_loc].has_a_bat || (level == HARD ?
697 if (cave[cave[player_loc].tunnel[i]].has_a_bat)
709 if (cave[cave[player_loc].tunnel[i]].has_a_pit)
721 if (cave[player_loc].tunnel[i] == wumpus_loc)
724 if (cave[cave[player_loc].tunnel[i]].tunnel[j] ==
734 wumpus_loc = cave[wumpus_loc].tunnel[random() % link_num];
814 A horrible roar fills the cave, and you realize, with a smile, that you\n\
827 with its psychic powers, the evil Wumpus rampages through the cave, finds\n\
857 cave apparently wasn't enough to clue you in to the presence of the\n\
867 "Without conscious thought you grab for the side of the cave and manage\n\