Example #1
0
def play(Bin_T, room_count, room_wumpus_in, spider_rooms, pit_rooms, bat_room,
         resupply_room, descs):

    play = True
    room = 1
    arrows = 3
    wumpus_is_in = False

    while play:
        desc = Rooms.get_desc(room, descs)
        adjrooms = Rooms.get_adj_rooms(Bin_T, room)
        adjroomss = adjrooms.split()
        adjroom1 = adjroomss[0]
        adjroom2 = adjroomss[1]
        adjroom3 = adjroomss[2]

        print(
            "You are in room {0}.\nYou have {1} arrows left.\n{2}\nThere are tunnels to {3}, {4}, and {5}"
            .format(room, arrows, desc, adjroom1, adjroom2, adjroom3))

        Rooms.check_adjrooms_trap(room, adjrooms, room_count, room_wumpus_in,
                                  bat_room, resupply_room, spider_rooms,
                                  pit_rooms, arrows, wumpus_is_in)
        inputs = input("Do you want to move or shoot?")

        if inputs.lower().startswith("m") or inputs.lower() == "move":
            inputs = input("Which room?")
            if inputs in adjroomss:
                room = int(inputs)
                if inputs == room_wumpus_in:
                    print(
                        "The wumpus ate you and you could not escape in time.")
                    continue
            else:
                #can't reach
                print("Please enter a valid input.")
        elif inputs.lower().startswith("s") or inputs.lower() == "shoot":
            inputs = input("Which room?")
            if inputs in adjrooms:
                arrows -= 1
                if inputs == room_wumpus_in:
                    print(
                        "You slayed the mighty wumpus and you go home as a hero."
                    )
                    continue
            else:
                print("Please enter a valid input.")
        else:
            print("Please enter a valid input.")