You are a mighty warrior and armed with your trusty bow and

Assignment Help JAVA Programming
Reference no: EM13346346

You are a mighty warrior, and armed with your trusty bow and 3 arrows, you enter The Caves in search of the mighty Wumpus. If you shoot the Wumpus, you are victorious and the masses will praise you, but if you stumble upon the Wumpus unaware, it will eat you! Also, beware of the webs of the giant poisonous spiders and the bottomless pits!

Your senses of smell and hearing will aid you on your quest, for the Wumpus does not bathe and can be smelled one room away. Also, the clicking mandibles of the poisonous spiders can be heard one room away, and the foul odor of a bottomless pit can be smelled one room away.

For this project, you will implement a program that lets the user play Hunt the Wumpus!

Modeling the Caves

The layout of the cave rooms is specified in a text file that looks like this (you may use this text file, but it is not required):

10

1 2 6 10

A wooden sign reads "Beware of the Wumpus!"

2 1 3 7

There is a black pool of water in the corner.

3 2 4 8

You see a Tyrannosaurus Rex fossil embedded in the wall.

4 3 5 9

There is an empty Diet Rite can here.

5 4 6 10

You almost step on a broken cellular phone.

6 1 5 7

A couple of evil rats stare at you from under a pile of rocks.

7 2 6 8

You find a Spanish doubloon on the floor.

8 3 7 9

The ceiling is very low and you have to stoop.

9 4 8 10

You step on a slippery spot, slip, and fall on your keester.

You get a strong sense of deja vu.

The first line of the text file gives the number of rooms in the caves (your program should handle any number of rooms). Each room is described on two lines: the first gives the room number, the room numbers of the three adjacent rooms (there are always 3); the second gives a string that describes the room.

Put this cave layout (or one in a similar format) into a text file. Declare a class to represent a single cave room (Room), and then declare an array of rooms to hold the entire cave in your main program. One of the first things your program should do is open and read the layout file and put the information into your array of rooms. 

Your program should then pick random numbers to figure out where to place the Wumpus, the two spider rooms (in two different rooms), and the bottomless pit. Make sure nothing ends up in room #1, as that is where the player starts, and don't put spiders, the Wumpus, or a pit in the same room together.

Playing the game

Here is a sample game. Comments in italics are not visible to the player, but are there to help explain what is happening. The user's input appears in boldface.

Welcome to **Hunt The Wumpus!**

You are in room 1.

You have 3 arrows left.

A wooden sign reads "Beware of the Wumpus!"

There are tunnels to rooms 2, 6, and 10.

You hear a faint clicking noise. (There are spiders in room 6)

(M)ove or (S)hoot?

M

Which room?

5

Dimwit! You can't get to there from here.

There are tunnels to rooms 2, 6, and 10.

(M)ove or (S)hoot?

M

Which room?

2

You are in room 2.

You have 3 arrows left.

There is a black pool of water in the corner.

There are tunnels to rooms 1, 3, and 7.

You smell a dank odor. (There is a pit in room 3)

You smell some nasty Wumpus! (The Wumpus is in room 7)

(M)ove or (S)hoot?

S

Which room?

3 (The user picks the wrong room)

Your arrow goes down the tunnel and is lost. You missed.

You are in room 2.

You have 2 arrows left.

There is a black pool of water in the corner.

There are tunnels to rooms 1, 3, and 7.

You smell a dank odor.

You smell some nasty Wumpus!

(M)ove or (S)hoot?

After the caves are all set up, the game proceeds. Have an integer (perhaps called currentRoom) to keep track of which room the warrior/player is in currently. Your program will then repeat the following loop:

1. Display the information about the current room. Print the room number, its description, and the list of adjacent rooms. Also check if any of the adjacent rooms have spiders, a pit, or the Wumpus and print a smell/hear message as appropriate. (If adjacent to two pits, only print one smelly message.) You might also display the number of remaining arrows.

2. Ask the player if he/she wants to move or shoot.

3. If the player shoots, have her/him pick which of the adjacent rooms to shoot into. If that room contains the Wumpus, the player wins and the game is over. If not, reduce the number of arrows by one. If the player runs out of arrows, they lose.

4. If the player moves, ask for the room number and change room. If the new room contains spiders, a pit, or the Wumpus, the game is over.

Reference no: EM13346346

Questions Cloud

Organisations behaviour is guided by financial data in the : organisations behaviour is guided by financial data. in the short term such data will help determine operational
The final project for this module is a consultancy report : the final project for this module is a consultancy report to anthonys orchard an expanding apple orchard and
The application with all the specifications should be : the application with all the specifications should be developed based on a graphical user interface.1. implement proper
Affiliations and partnerships are frequently used to reach : affiliations and partnerships are frequently used to reach a larger local audience? which options stand to avail for
You are a mighty warrior and armed with your trusty bow and : you are a mighty warrior and armed with your trusty bow and 3 arrows you enter the caves in search of the mighty
Complete the financial reporting for every period and : complete the financial reporting for every period and develop recommendations using the templates provided.procedure1.
In this project you will create an application to run in : in this project you will create an application to run in the amazon ec2 service and you will also create a client that
1give five illustration of securities that are exempted : 1.give five illustration of securities that are exempted from the registration provisions of the 1933 act.2.in the
Report describe the ways in which timely and accurate : report describe the ways in which timely and accurate financial data provide a powerful tool for managers to use in the

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write method called median that accepts an array of integer

Write a method called median that accepts an array of integers as its parameter and returns the median of the numbers in the array.

  Summary of the case astrazeneca-unitedhealth

What is the summary of the case "AstraZeneca, UnitedHealth, and Others: IT-Asset Management- Do you know what youv've got?"

  Determine if strings are equal

Complete the recursive method match in the code below which will determine whether or not two strings match.

  Write down ijvm code to remove top two words from stack

Write down IJVM code which will remove these top two words, multiply and put their product back on stack. You are allowed to use existing IJVM instructions only.

  Create a project using the classes in the doc sharing area

create a project using the classes in the Doc Sharing area labeled A Simple LinkedList class. Compile it, run it, and review the code that is given carefully. This code tests the LinkedList class provided in the lecture.

  Accepts a binary number from the user

Write a Java test program that accepts a binary number from the user. You should store the binary number in a String. Your program should then use afor loop to sequence through every character in the String, counting the number of ones, zeros, and..

  Collection of scores (type int) for the last exam i

After being given a collection of scores (type int) for the last exam in your computer course, you are to computer the average of the scores and assign grades (O, S, U i.e. Outstanding, Satisfactory, Unsatisfactory)) to each student according to the ..

  Make a fourth button called special

Make a fourth button called "special" that does something else notdescribed in the assignment, such as change the background color.

  E-marketing-e-commerce consultant

You are an e-marketing and e-commerce consultant. Mary and Joe Johnson, the owners of Book Bunker, have hired you to help them improve their sales both online and in their store.

  A class for counting the number of people

Specification: A class for counting the number of people in a room. This might be used to control how many people are allowed into a club with a doorman.

  Create a driver class in java

Your project is to create a driver class that uses SuperJavaIceCreamClass.

  Recognize one high severity vulnerability for computer

Recognize one high severity vulnerability for each computer (if there is one). Explain vulnerability and describe control(s) to minimize risk from vulnerability.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd