Implement the quit command

Assignment Help Other Subject
Reference no: EM131288395

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

Verified Expert

The solution file of the report prepared in ms word and wumpus game implemented in c sharp which has 10 tasks. They are print instruction of the game , stored high score of the game in file , create two types of cave and main menu. The report has basic explanation of the game logic and methods. The screen shots of the game attached in the solution

Reference no: EM131288395

Questions Cloud

Responsible for turnaround in its financial performances : In 1995, Global Oil Corporation’s Marketing and Refining (M&R) Division was the 5th largest US refiner with 7,700 Global-branded service stations selling about 23 million gallons per day, or 7% of the nation’s gasoline. Critically evaluate M&R’s impl..
The compensating balance account : Your company has a $100,000 line of credit through a local bank. The bank requires an 8 percent compensating balance and charges 10 percent on the amount borrowed against the line. If the company needs $55,000 to purchase inventory, what is the minim..
Prepare the journal entry : On January 1, 2016 Nezcorp borrows money on a 1-year 12% (stated rate = market rate) $10,000,000 interest-only note payable. Payments are made monthly. bond pays semi-annual interest i. Prepare the journal entry on January 1, 2016.
Determine the cost of checking account deposits : Why might an advertising agency use job costing for an advertising campaign by Pepsi, whereas a bank might use process costing to determine the cost of checking account deposits? How are these approaches similar? What importance to these results make..
Implement the quit command : 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.
Treasury stock transactions occurred : On January 1, 2017, the stockholders’ equity section of Newlin Corporation shows common stock ($4 par value) $1,200,000; paid-in capital in excess of par $1,000,000; and retained earnings $1,150,000. During the year, the following treasury stock tran..
Treasury stock transactions occurred : On January 1, 2017, the stockholders’ equity section of Newlin Corporation shows common stock ($4 par value) $1,200,000; paid-in capital in excess of par $1,000,000; and retained earnings $1,150,000. During the year, the following treasury stock tran..
Evaluate the change in costs over the period : Suppose industry abatement costs rise from $850 million in 2011 to $1000 million in 2012 in nominal terms and the CPI is 100 in 2011 and 106 in 2012. a. Evaluate the change in costs over the period in real terms, first in 2011 dollars and then in ..
How would you effectively reach employees with your message : Let's brainstorm, if you were the CEO and were designing a communication plan what would be some of the key elements that would be in your plan? How would you effectively reach the employees with your message?

Reviews

inf1288395

4/24/2018 5:11:04 AM

Thank you for your help. The paper is nicely written and extremely readable. It is right on target and addresses all the important points. It is also written on a level of that I can understand. Your work is quite helpful. Thank you again.

inf1288395

1/18/2018 5:04:38 AM

This is Laith Alfaloujeh for EM131288395. I will send you the source code through a Compressed zip file if that is okay with you. Thank you 26504146_1HuntTheWumpus.zip I have submitted the payment, so I hope there won't be anymore compilations. There is a problem with the code when I run it there is also a lot of errors the are underlined with red in the program. This is Laith, to answer your question about the software that I'm using is Microsoft Visual Studio, as for the error messages I took screenshots of them, from 1 to 8 are the hard code with the red underline, while 9 to 10 have the reason to why they are underline I am going to send it in a zipped file Thank you 26504132_1WumpusGameScreenShots.zip these underlines are not allowing me to run the program at all. because as soon as I try and start the game and press on a cave the program crashes. This is laith, I really appreciate your hard efforts on this project.

inf1288395

1/15/2018 4:36:30 AM

I will send you the source code through a Compressed zip file if that is okay with you. 26504146_1HuntTheWumpus.zip There is a problem with the code when I run it there is also a lot of errors the are underlined with red in the program The software that I'm using is Microsoft Visual Studio, as for the error messages I took screenshots of them, from 1 to 8 are the hard code with the red underline, while 9 to 10 have the reason to why they are underline I am going to send it in a zipped file 26504132_1WumpusGameScreenShots.zip I found the reason for error, it was fault on my laptop, I really appreciate your hard efforts on this project, here is the screenshot 26504129_1Capture.PNG

inf1288395

1/12/2018 12:14:28 AM

Hello, expertsmind This is Laith for the task. I will send you the source code through a Compressed zip file if that is okay with you. Thank you 26504146_1HuntTheWumpus.zip this is Laith I have submitted the payment, so I hope there won't be any more compilations. There is a problem with the code I have sent to you when I run it there is also a lot of errors the are underlined with red in the program. could you please correct them in this task? I took screenshots of them, from 1 to 8 are the hard code with the red underline, while 9 to 10 have the reason to why they are underline I am going to send it in a zipped file Thank you 26504132_1WumpusGameScreenShots.zip This is Laith, to answer your question about the software that I'm using is Microsoft Visual Studio,these underlines are not allowing me to run the program at all. because as soon as I try and start the game and press on a cave the program crashes. I really appreciate your hard efforts on this project, here is the screenshot of the problem 26504129_1Capture.PNG

Write a Review

Other Subject Questions & Answers

  Optical communication system in real time scenario

To understand the basic knowledge of optical communication systems and to explore the significance of the optical communication system in real time scenario.

  Supporting activity website critique

Supporting Activity Website Critique

  Communication essential in emergency disaster management

Why is communication essential in Emergency Disaster Management? Name essential communication tools and discuss what you consider as impediments to effective communication in the aftermath of a disaster.

  Discuss how general educational can affect health outcomes

Discuss how general educational can affect health outcomes. In doing so, consider the links between education, income, income- related lifestyle choices, and health outcomes.

  What exactly is the minnesota population

What exactly is the Minnesota Population Center (MPC) in the business of doing? That is, what sorts of ideas (motivations, topics, questions, etc.) guide their work as a research center

  Explain how the mixture control affects the engine operation

How does the mixture control affect the engine's operation and what type of situations dictate a particular mixture setting? Would an incorrect mixture setting be detrimental, a minor effect or nothing at all?

  What factors led luis and his friends to form/enter gangs

According to Blumstein and Wallman, how did the violence rate increases vary across race and gender groups? What are the major factors they discuss as potential factors associated with crime rate changes over time? (name and describe them). What..

  Examine the effect the issue has on society

Examine the effect the issue has on society.

  What is the function of fat in nutritional health

What is the function of fat in nutritional health besides serving as the body's primary means of storage for excess calories? What is the basis of our current concern about saturated fats, cholesterol, and trans-fatty acids

  Influence of alcohol and possession of marijuana

Tony was a 16-year-old juvenile who was picked up for driving under the influence of alcohol and possession of marijuana. He was evaluated and taken to juvenile detention.

  Leaders of functionalism in american psychology

Who are some of the leaders of functionalism in American psychology? Which one do you feel has had the largest impact in furthering functionalism in American psychology? Why?

  What are the emotional implications from the managers action

Also, briefly address how the pressure from the manager impacts Ben's ability to successfully perform his job-what are the emotional and psychological implications from the manager's actions?

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