Implement at least two locked doors to your game

Assignment Help Programming Languages
Reference no: EM132983224

Designing your game

Using the given zuul-bad game as a starting point, you must design your own game. Some possible game scenarios are described in Exercise 6.3 of the reference textbook. If you find it difficult to visualise this sort of game scenario, try modelling your game on some familiar real- world location. If you need additional inspiration, you can try playing the original Colossal Cave Adventure game.
You must have the following in your game:

• Your game scenario must have at least nine (9) different rooms.
• Your game scenario must have at least six (6) types of exits - north, south, east, west, up and down, and any other you require. This requirement does NOT mean that each room must have 6 exits.
• Your game scenario must include at least four (4) items that the player could find, pick up and potentially use.

• The player can only carry a maximum of four (4) items in the player's inventory.
• Your game must have some way for the player to win. Most likely, this will be by achieving some goal such as finding a particular item, surviving for some specified number of moves, or exiting a particular room ... whatever makes sense for your game.

Written Exercise 1

Write a brief description of your game in your word document. You must:

• Describe your game, including the back story and the setting of the game
• List the items in the game and how to use it
• Explain how the player wins

Written Exercise 2

Draw a map for your game scenario. You must:

• Label the rooms
• Label the exits (connections between rooms)
• Specify the locations of the items
The map can be hand-drawn. You do not need to use a drawing program, but your map must be clearly readable. This map must also be placed in the Word document.

Written Exercise 3

Your game has 6 exits; however, the zuul-bad game only has 4 exits. Yours will also have more rooms than zuul-bad, and they will have different names. Copy the following template into your word document and replace the text for each of the methods. You must identify and describe the changes you would need to make to the zuul-bad project to convert it into your game. You need to consider the additional exits and rooms you have in your game.

Written Exercise 4

The printWelcome method and the goRoom methods contain code duplication and both print a description of the current room and a list of the exits. This is not a good design. Explain why.

Programming exercise 1

Correct the problem of repeated functionality in the printWelcome and goRoom methods by refactoring the repeated functionality out of these methods into a method of its own called getRoomExitsAndDescription. Then call this new method in each place the description and exits need to be displayed.

Written Exercise 5

In the previous exercise, you created the getRoomExitsAndDescription method that prints a description of the current room and a list of the exits. This code is contained in the Game class. This is not a good design. Explain why.

Programming exercise 2

• Refactor the code that generates the list of the exits into a method named getExitString in the Room class. This method should return a String listing the exits from the room. For example, if the room has exits to the north and west, this method should return a String containing: "north west".
• Add a method called getLongDescription to the Room class that returns a String containing the description of the current room and a list of the exits of a room (hint: call the getExitString method you just created.
• Now that each room has a method that can print information about a Room refactor the code in the Game class to take advantage of this functionality. i.e. anywhere the Game class uses the getRoomExitsAndDescription method, change it to use your getLongDescription method.

Written Exercise 6

Now that you have made some changes to your code, create a template similar to the template I provided for written exercise 3 for the Game and Room class (note that it will be different as you now have new methods and have refactored code into different classes). Then identify and describe the changes you would need to make to the zuul-bad project to convert it into your game, just like you did in written exercise 3. You need to consider the additional exits and rooms you have in your game. DO NOT WRITE THE CODE...YOU WILL NOT GET ANY MARKS. You must identify and describe the changes.

Written Exercise 7

Answer the following question.
• Has the design improved?
• You must explain why or why not.
Programming exercise 3

• Update the comments at the beginning of the Game class, the Room class and the message displayed by the printWelcome method so that they describe your game.
• Update the Game and Room class so that it creates the rooms and exits that you invented for your game. You do not need to add any items to your game yet. You will add items later.

Programming exercise 4

Your game scenario requires that there be items positioned throughout the world that the player can pick up and possibly use. An item sounds like something that should be represented by an object! So, create an Item class to represent the items in your game. You will need to decide what fields your Item class needs to have, what parameters the constructor will require and what methods the class will have. At a minimum, items will have a name and a description. However, items may have any other attributes that make sense for your game (e.g. weight, colour, value, destructive power ...)

Programming exercise 5

Now that there is a class for representing Items, we need a way to allow the rooms to contain an item. Modify the Room class so that one item can be added to or removed from the room. You will need to think about what fields and methods to add to the Room class. Also, think about what the methods that you add should do when an attempt is made to add an item to a room that already contains an item, or an attempt is made to remove an item from a room that does not contain an item.

Programming exercise 6

Now that a room can contain an item, when the player enters a room, he/she should be told about the item in that room (if there is one). Modify the appropriate code so that if the player enters a room containing an item, the name and description of the item are displayed along with the description of the room and the list of exits.

Programming exercise 7

Edit the code in the Game class so that the items for your game are created and added to the appropriate rooms at the start of the game. Recall that your game must include at least four
(4) items. Be sure to test any methods that you add or modify.
Play the game to ensure that your items are appearing in the rooms.

Now that rooms can contain items and a player will know when they enter a room with an item, it would be nice if the player could pick up and carry items. Add functionality to allow the player to pick up and drop items. Recall that the player should be able to carry a maximum of four (4) items. How you do this is up to you. You could add a Player class or add the functionality to the Game class.

Programming exercise 8

Modify the Game class so that it will recognise the command take. When the user enters the "take" command, the item in the current room, if there is one, should be added to the items that the player is carrying, and a message should be printed indicating that the player has taken the item. If there is no item in the current room, the take command should print an error message. Be sure to test any methods that you add or modify. (Hint: Remember that one task of the Game constructor is to "teach" the CommandReader what words are valid commands. Thus, you will need to make a change in Game's constructor if you want to introduce a new command.)
Play the game to be sure the take command works!

Programming exercise 9

Modify the Game class so that it will recognise the command inventory. When the user types "inventory" the game prints the names of the items that the player is currently carrying. You should think carefully about where the list of item names should be generated. (Consider the fact that the player is carrying the items and think about how the list of exits for a room is generated and displayed.)
Play the game to be sure the inventory command works!

Programming exercise 10

Add support to the game for a drop command so that the player can drop an item by name (e.g. "drop book"). The dropped item should appear in the current room. If the current room already contains an item, the drop command should print an error message indicating that the room is full, and the player should continue to carry the item.
Play the game to be sure the drop command works!

Programming exercise 11

Implement at least two locked doors to your game. The first door/entrance door should be locked, and for the second one, you may choose any other doors. The player needs to find (or otherwise obtain) a key/item to open a door. You will need to create a new "use" command to open the door. Hint: Reuse the take command to implement the use command. Adjust your winning condition if necessary.
Play the game to be sure the locked doors and the use command work!

Programming exercise 12

Add some form of time limit to your game. If a certain task is not completed in a specified time, the player loses. A time limit can easily be implemented by counting the number of moves or the number of entered commands. You do not need to use real-time.

Programming exercise 13

Modify the game so that only the name of the item in a room is displayed when the player enters. Then add a look command that allows the player to look at an item in the current room by name. For example, if the player types look book and there is an item named "book" in the current room, your game should display the description of that item. If there is no such item, your game should display an error message. If the player enters the look command with no second word, it should display the entire description of the room, its exits and the names of any items again.

Attachment:- Assignment.rar

Reference no: EM132983224

Questions Cloud

Do think are able to be less costly than the financial cost : Reading about the development of this technology, do you think they are able to be less costly than the financial cost of fraud, especially in the case of small
Can debit sales for dollar fifteen thousand : Can we debit Sales for $15,000, credit Cost of Sales for $15,000 on 30 June 2021? One of the liabilities of Valley Ltd was $50,000 for dividend payable.
Calculate the new net profit : Neelopa Enterprise's financial statement for the year ended 31 December 2020 has showed a net profit of RM100, 500. Calculate the new net profit
Compute the amount the company can borrow : The accounts receivable at the end of the period is $7.5 million with $500,000 over 90 days old. Compute the amount the company can borrow
Implement at least two locked doors to your game : Describe your game, including the back story and the setting of the game - Implement at least two locked doors to your game.
What spending rate can the endowment fund accommodate : What spending rate (to two decimal places) can the endowment fund accommodate if long-term inflation is 1.6% p.a. and the management expenses
What is the utility of the investor of a portfolio : What is the utility of the investor (two decimal places) of a portfolio that has an expected return of 5.1% p.a. and a standard deviation of return of 10.4 p.a.
What is its price : A bond that matures in 8 years has a par value of $1,000 and an annual coupon payment of $70; its market interest rate is 9%. What is its price
Calculate accumulated value at time that claim is paid : Calculate the accumulated value (to the nearest whole number), at the time that the claim is paid, of all of the premium payments of $5,000.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write application to calculate average of temperature

Write the application to calculate average of set of temperature readings. Application prompts user to enter the number of temperature readings to be entered, then prompts user to enter temperature.

  Write an anonymous block that places a substitution variable

Write an anonymous block that places a substitution variable (&) into a local variable of type varchar2. You will need to convert the types and round them to nearest tens unit. For example 84.4555 would be 84.5.

  Create a class for performing arithmetic with fractions

Create a class called Rational for performing arithmetic with fractions. Write a program to test your class. 1/2+2/3+3/4.......+98/99+99/100.Use integer variables to represent the private data of the class

  Create test application that creates objects of type book

Create a test application that creates several objects of type book class and adds each Book to an ArrayList. Your test application should then do the following.

  Write a class named employee that holds the data of employee

Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title.

  A class method to initialize class data members.

Sales class data members for a char letter input from the console, a double to hold each individual sale as it is entered and a double for each of the individual salesperson's total commission.

  Write a function to calculate your wages for a part-time job

Explain how an animation uses still images and loops to create the illusion of motion. Write a function to calculate your wages for a part-time job. (Don't worry about calculating overtime.)

  The design and testing the design of learning environments

HCI projects will gravitate on the design and testing the design of learning environments. Design or improvement of a computer application to support; promote learning, identifying new means of using technology for fostering and assessing learning..

  Develop program for concrete class in hierarchy

Develop program which reference objects of each concrete (non-abstract) class in hierarchy. Write down abstract method "display" which determines whether displayed shape is TwoDimensionalShape.

  CTEC2906 Object Oriented Development Assignment

CTEC2906 Object Oriented Development Assignment Help and Solution, De Montfort University - Assessment Writing Service

  Provide an analogous response when adding the two positive

What is the range of values that the multiplication of those two numbers (a ? b) will have - Provide an analogous response when adding the two positive n-bit and m-bit numbers (a + b).

  Compute service charge customer owes for writing bad check

Create the output and sketch the flowchart or write pseudocode for program which computes service charge a customer owes for writing bad check.

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