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

Explain the meaning of the phrase sell right not more

Why does having a common profitability goal throughout the supply chain lead to better performance with regard to returns? Explain the meaning of the phrase "Sell right, not m

Religion cultural and societal influences-hinduism

Hinduism lacks a uniting belief system. In other words, Hinduism is actually many beliefs and practices labeled as a single religion. Completing this paper should give you a

Demonstrate vocabulary strategies to your colleagues

Select one of the seventh grade passages from the New K-8 Reading Passages website. Create a 5-8 slide PowerPoint that could be used to demonstrate vocabulary strategies to

Essential structures and function of cellular components

Essential structures and function of cellular components of the blood and essential structures and function of cellular components of the heart and cardiovascular system.

Determining faerytales and religion

Although it is true that primitive religions are bound to the host culture and cannot survive as a whole when exposed to other civilizations and religions

Describe the portrayal of blacks in the film

Describe the portrayal of blacks in the film. Would you describe any part of the depiction as accurate? Why or why not? Did the public's reaction to this film have anything to

Develop an original research study proposal

Develop an original research study proposal and describe it in detail in a 10-12 page (APA style) paper. Include at least 10 scholarly references in your proposal. Use the

Describe at least two renewable alternatives to oil

Based on the concern that we may be running out of oil, describe at least two renewable alternatives to oil that are currently available and discuss the barriers that keep t

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

 
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