1 fromRandomImportChoice2 3Cave_numbers = Range (1,21)4Wumpus_location =Choice (cave_numbers)5Player_location =Choice (cave_numbers)6 whilePlayer_location = =wumpus_location:7Player_location =Choice (cave_numbers)8 9 Print "Welcome to Hunt the wumpus!"Ten Print "can see", Len (caves),"Caves" One Print "to play, just type the number" A Print "Of the Cave you wish to enter next" - - while1: the Print "You is in cave", Player_location - if(Player_location = = Wumpus_location-1or -Player_location = = wumpus_location + 1): - Print "I smell a wumpus!" + - Print "which cave next?" +Player_input = Raw_input (">") A if( notPlayer_input.isdigit ()or atInt (player_input) not inchcave_numbers): - PrintPlayer_input,"Is isn't a cave that I can see!" - - Else: -Player_location =Int (player_input) - ifPlayer_location = =wumpus_location: in Print "aargh! Got eaten by a wumpus!" - Break
<from wikipedia>
Hunt the wumpus is an important early computer games . He is based on a simple hidden/search form that has a mysterious monster (Wumpus), sneaking around the room's network. Players can use command-line text interface, by entering instructions to move in the room, or archery along a curved path in several adjoining rooms. There are 20 rooms, each with an additional three connected, arranged like a dodecahedron Vertex (or a icosahedron 's face). The possible dangers are: The Super Bat (which throws the player in any position) and Wumpus. When the player infers the room of the wumpus from the hint and does not enter, and shoots an arrow in the room to kill him. However, if the wrong room is fired, the Wumpus will be alerted, and he will devour the player.
The game was originally written by Gregory yob using BASIC .
A simplified version of the game has also become a classic example of the concept of a description (a computer program) in the field of Artificial intelligence . (Artificial intelligence is often used to simulate a player's character)
The first little game code that you learned today, you see the small error inside?
Come on! To is a pythoner.
Hunt the Wumpus "Python Code"