Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Homework Help/Study Tips Expert

Learning Objectives

This project will require knowledge of the following programming techniques:

- Reading, understanding, and modifying existing code.
- Control Structures.
- Methods.
- Arrays and multi-dimensional arrays.
- Debugging, testing, and code maintenance techniques.
- Building a large, complex program with several parts.

Task 0: Read and Understand the Code

Thoroughly read through the existing code and documentation. Compile it. Run it. Move the player through the rooms. Become familiar with the design and methods. Answer the following questions completely in a separate Word document and submit those answers with your project.
1. Consider the static variables declared on lines 11-15:
a) What kind of variables they (not the data type, but the kind based on their location in the code)?
b) Why are those variables declared inside the class instead of inside a method?
2. In your own words, explain the design of the adjacentRooms rectangular array. What does the array represent?
3. Conceptually what does adjacentRooms.GetLength(0) represent? Be specific within the context of Hunt The Wumpus.
4. Conceptually what does adjacentRooms.GetLength(1) represent? Be specific within the context of Hunt The Wumpus.
5. Look at the loop condition for running the game (inside Main()). When will the game end?
6. Currently there are ten (10) methods besides Main(). List each method header and briefly describe what that method does.

Task 1: Shoot the Wumpus

Our player is unarmed and cannot defeat the Wumpus. Arm the player with arrows that he can shoot at the Wumpus. The arrows can be shot into any adjacent room. Write code that does the following:

1. Implement the ‘shoot' command. If the player types ‘shoot' the program should ask ‘Which Room?' The player can then type in an adjacent room number to shoot into that room.
- Detect if the player types in an invalid room and print out "You cannot shoot there."
- [Hint] Look at the code for the ‘move' command. How different is shoot from move?
- Run the program. Verify that you handled invalid rooms correctly.

2. Once the player shoots the arrow into a room:
- If the room HAS the Wumpus:
i. Print out "ARGH...Splat!"
ii. Print out "Congratulations. You killed the Wumpus! You Win." The game ends.
- If the room does not have the Wumpus:
i. Print out "Miss! But you startled the Wumpus".
ii. Shooting the arrow startles the Wumpus and it moves to another room. Move the Wumpus to any random room including the room you are currently in -- in which case the player will die. Create a separate method to move the startled wumpus.
iii. Print out a trace message that tells you which room the Wumpus moved to.
3. Run the program. Test both missing the Wumpus and hitting it.

Task 2: Add Bats

The Wumpus isn't the only creature that calls these caves home. There are other hazards. Superbats are large and scary bats that when startled pick you up and fly you to a random room. Implement the following to add superbats to the game:
1. Place bats in TWO random rooms at the start. Bats cannot be in room 0, the same room as the Wumpus, or the same room as other bats.
2. Print out trace messages that tell you which rooms the bats are in.
3. If you enter a room adjacent to the bats, you can hear them and you should print out "Bats nearby!" Implement this feature. Look at InspectCurrentRoom()to see how it is implemented for the Wumpus. Your code will be very similar to that.
4. Run the program. Test that you can detect the bats in an adjacent room.
5. If you enter a room with the bats, the bats fly you away to any random room. Look at InspectCurrentRoom(). That is where you will write the code to identify if you entered a room with bats. How can you add logic that will then move the player to another random room?
- The game should display "Snatched by superbats!" when bats move you to a new room.
- The new room might contain the Wumpus, a bottomless pit, or even other bats and you have to handle that. The bats moving you should work just like a normal move.
6. Run the program. Test that the bats will fly you to another room.

Task 3: Add Bottomless Pits

Another hazard in these caves is the bottomless pit. If you enter a room with a bottomless pit you will fall to your death. Add bottomless pits to your game:
1. Place bottomless pits in TWO random rooms at the start. A bottomless pit can be in any room except room 0.
- If a bottomless pit and bats are in the same room, the bats will fly you to safety.
- The Wumpus has sucker feet and won't fall into the bottomless pit if they are in the same room.
2. Print out trace messages that tell you which rooms have the bottomless pits.
3. If the player enters a room with a bottomless pit, the player will die and the game will end.
- The game should display "YYYIIIIEEEE...fell in a pit."
4. Run the program. Go into a room with a bottomless pit and verify that it works.
5. If you enter a room adjacent to a bottomless pit you feel a draft and should print out "You feel a draft..." Implement this feature. It will be very similar to your implementation for the bats.
6. Run the program. Test that bottomless pits work as described.

Task 4: Implement the ‘quit' command

We want to allow the player to quit mid-way through a game. Implement the ‘quit' command. If the player types ‘quit' the game should end and return to the main menu.

Task 5: Play again?
If the player dies from the Wumpus or falls into a pit, they may want to replay the same exact map again. Implement code that does that.
1. Once the game is over, prompt the user if they would like to replay the same map again.
2. If the player says yes, start a new game but on the exact same map with the Wumpus, bats, and bottomless pits all in the same places.
3. If the player says no, the game should end and return to the main menu.

Task 6: Keeping Score
Let's start to keep score now. Come up with your own scoring rules and implement them. Once the game ends, tell the player their score. What object should keep track of the player's score?
Some possible scoring rules:

- The player should get points for killing the Wumpus.
- The player should lose points for getting eaten or falling into a bottomless pit.
- Maybe the player should get more points for killing the Wumpus quickly (less moves).
- Maybe the player should lose points for shooting but missing the Wumpus.

Task 7: Save the Score to Disk
Use the File I/O techniques we just learned to save the player's high score to a file called
WumpusHighScore.txt on the Hard Drive.

1. After you display the high score to the player, save it to the disk.
2. You should append to the existing file so all previous high scores remain.
3. Run the program. Test that the high score is successfully written to disk. Test that multiple high scores will correctly append to the file.

Task 8: Implement ViewHighScores()
Implement the ViewHighScores() method to load the high score file from disk and display them one high score per line.

Task 9: Add Treasure
Add a treasure to the game. Place a gold bar somewhere in the cave. If the player finds it, they get extra points. Notify the player that they found bar.

Task 10: Add a New Type of Cave
Our cave layout is a dodecahedron. It is static and the layout will never change. Implement one other type of cave that is a different layout. When the game starts, ask the player which cave layout they would like to use and build that type of cave network.
Consider the design of the adjacentRooms rectangular array and how you can initialize it to different values based on user input.

Some possible cave layouts are listed at the end of this document. Each number represents the room id starting at room 0. You can also make your own design.

Finishing Up Tasks

1. Remove all trace or debugging messages you wrote. This should make the game much more challenging and fun now -- ready for prime time.

2. Implement the PrintInstructions() method. Just display a few instructions to get a new player started in the game.

https://www.dropbox.com/s/kb0yelh5k2dfd5v/huntthewumpusstart.zip?dl=0

Attachment:- Project-instructions.rar

Homework Help/Study Tips, Others

  • Category:- Homework Help/Study Tips
  • Reference No.:- M92043076

Have any Question?


Related Questions in Homework Help/Study Tips

Question topic to torture or not to torturenote you must

Question: Topic: To Torture or Not to Torture Note: You must read Holmes chapters 4-7 and 14 in order to complete this assignment. If you have not done so, stop now and read that material. The ethical issue: One of the e ...

Question continuing with the same cultural group and health

Question: Continuing with the same cultural group and health issue for the Session Long Project that you began in Module 1, write a paper to address the following: Describe the Relationships and Expectations of the group ...

Police administrationmidtermanswer each question with 500 -

Police AdministrationMidTerm Answer each question with 500 - 700 words, completely and fully for full credit. You are to provide at least 3 references other than your readings to support each response. These references a ...

Determinations presentation many times as a chief officer

Determinations Presentation Many times as a chief officer you are expected to provide presentations to the governing body to identify current trends or deficiencies within your agency and the community. This assignment i ...

Most inmates return to the community at some point it is in

Most inmates return to the community at some point. It is in the best interest of the community that the ex-offender be able reestablish himself and be a contributing member of society, however; how successful their reen ...

Question 1the two major cell types that make up the nervous

Question: 1. The two major cell types that make up the nervous system are cells and . 2. Almost all hormone secretion is under the control of the gland, which is in turn controlled by the . 3. The basal ganglia include t ...

Question - write a research study on diabetes describe the

Question - Write a research study on Diabetes. Describe the cause, symptoms, treatment and management measures.

Question primary task response within the discussion board

Question: Primary Task Response: Within the Discussion Board area, write 800 words that respond to the following questions with your thoughts, ideas, and comments. This will be the foundation for future discussions by yo ...

Topic - childhood obesityintroductionthis proposal

Topic - Childhood Obesity Introduction This proposal development assignment is intended to facilitate: (1) learning the steps of the health promotion program planning process based on the PRECEDE-PROCEED Model; (2) apply ...

Question for the final project you will propose a menu for

Question: For the final project, you will propose a menu for one of two options: 1. a new food truck with a limited menu 2. a catered event The proposed menu should have at least two items for at least four menu categori ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As