Draw a map for game scenario

Assignment Help JAVA Programming
Reference no: EM132787569

CSC72003 Programming - Southern Cross University

Specifications

Your task is to complete various exercises in BlueJ, using the Java language, and to submit these via the MySCU link created for this purpose.
Marking criteria includes:

• Use of correct coding style, including the use of comments;
• Accuracy of coding;
• Use of suitable coding structures;
• Correct submission and naming conventions of assessment items as required.

This assignment is to be completed individually. It is the opportunity to gain an understanding of the concepts of object oriented programming and coding syntax. It is important that you master these concepts yourself. You are permitted to work from the examples in the study guide or textbook but you must acknowledge assistance from other textbooks or classmates. In particular, you must not use online material or help from others, as this would prevent you from mastering these concepts.
Who can you get help from? Use this diagram to determine from whom you may seek help with your program.

After you have set up your assignment open the zuul-bad project In BlueJ, create a new instance of the Game class, run the play method and familiarize yourself with the game.
You should also:

• Review the code style guide in topic 7 as this is the style you will be required to use in your assignment.
• Download chapter 6 of the textbook from topic 7 on mySCU as you will need this for the assignment.

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 text. If you find it difficult to visualize 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 six (6) different rooms.
• Your game scenario must have at least six (6) types of exits - north, south, east, west, up, 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 six (6) items that the player could find, pick up and potentially use.
• 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... 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 of the game and the setting of the game
• List the items in the game
• 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. Your 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.
DO NOT WRITE THE CODE...YOU WILL NOT GET ANY MARKS, you must identify and describe the changes.
I have completed the Room class, so you can see what is required.

Class Room

Instance variables

• Add an instance variables of type Room for the up exit
• Add an instance variables of type Room for the down exit setExits method
• Add a parameter of type Room to the setExits method for the up exit
• Add a parameter of type Room to the setExits method for the down exit
• Add an if statement to the setExits method to assign the up parameter to the up instance variable
• Add an if statement to the setExits method to assign the down parameter to the down instance variable
getDescription method

• no changes needed

Class Game

Instance variables

• Replace this text. Identify and describe the changes you need to make to the instance variables to add your additional exits and rooms in point form. If no changes are needed write no changes needed
createRooms method

• Replace this text. Identify and describe the changes needed in the createRooms method to add your additional exits and rooms in point form. If no changes are needed write no changes needed
play method

• Replace this text. Identify and describe the changes needed in the play method to add your additional exits and rooms in point form. If no changes are needed write no changes needed
printWelcome method

• Replace this text. Identify and describe the changes needed in the printWelcome method to add your additional exits and rooms in point form. If no changes are needed write no changes needed
processCommand method

• Replace this text. Identify and describe the changes needed in the processCommand method to add your additional exits and rooms in point form. If no changes are needed write no changes needed
printHelp method

• Replace this text. Identify and describe the changes needed in the printHelp method to add your additional exits and rooms in point form. If no changes are needed write no changes needed
goRoom method

• Replace this text. Identify and describe the changes needed in the goRoom method to add your additional exits and rooms in point form. If no changes are needed write no changes needed

quit method

• Replace this text. Identify and describe the changes needed in the quit method to add your additional exits and rooms in point form. If no changes are needed write no changes needed


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

Make a copy of the zuul-bad project in your FirstNameLastName-A2 folder and rename the copy to FirstNameLastName-PE1. For example, mine would be AlexHendry-PE1. Your folder should now look like:

In the FirstNameLastName-PE1 project:

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

Make a copy of the FirstNameLastName-PE1 project and rename the copy to FirstNameLastName-PE2. For example, mine would be AlexHendry-PE2. Your folder should now look like:

In the FirstNameLastName-PE2 project:

• 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 we have made some changes to our 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 questions:

• Has the design improved?
• Why or why not?

Programming Exercise 3

Make a copy of the FirstNameLastName-PE2 project and rename the copy to FirstNameLastName-PE3. For example, mine would be AlexHendry-PE3. Your folder should now look like:

In the FirstNameLastName-PE3 project:

• 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

Make a copy of the FirstNameLastName-PE3 project and rename the copy to FirstNameLastName-PE4. For example, mine would be AlexHendry-PE4. Your folder should now look like:


In the FirstNameLastName-PE4 project:

Even with the improvements we have made to our code there are a lot of places that need to be changed to add a new exit. It would be better if it were possible for an exit to have any arbitrary name and that when given the name of an exit we could find the associated Room that lies beyond. This should sound like a good job for a HashMap where the name of an exit is the key and the Room lying beyond the exit is the value. Improve the design of the Room class by refactoring it so that it uses a HashMap to store the exits instead of an individual field for each exit.
Play the game to check that it still works.

Programming Exercise 5

Make a copy of the FirstNameLastName-PE4 project and rename the copy to FirstNameLastName-PE5. For example, mine would be AlexHendry-PE5. In the FirstNameLastName-PE5 project:
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 6

Make a copy of the FirstNameLastName-PE5 project and rename the copy to FirstNameLastName-PE6. For example, mine would be AlexHendry-PE6. In the FirstNameLastName-PE6 project:
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 7

Make a copy of the FirstNameLastName-PE6 project and rename the copy to FirstNameLastName-final. For example, mine would be AlexHendry-final. All remaining excercises will be completed in this project. In the FirstNameLastName-final project:
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 8

In the FirstNameLastName-final project:

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 six 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 the functionality to allow the player to pick up and drop items. The player should be able to carry any number (i.e. a collection) of 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 9

In the FirstNameLastName-final project:

Modify the Game class so that it will recognize 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 10

In the FirstNameLastName-final project:

Modify the Game class so that it will recognize 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 11

In the FirstNameLastName-final project:

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 12

In the FirstNameLastName-final project:

Notice that when you use the help command take, inventory and drop do not appear as command words. Modify the printHelp method of the Game class so that it automatically

displays any new command words that are added to the game. Do not hard code the words in the printHelp method. Hint: you should modify the CommandWords class to do this.

Attachment:- JAVA programming assignment.rar

Reference no: EM132787569

Questions Cloud

Discuss your lyric and poems meaning : Discuss your lyric / poem's meaning and tell how the poem intersects with the additional readings and with some or all of the class novels
What kinds of mistakes were made by the company : An IT administrator for Acme Inc., a small anvil manufacturing company, used her personal email address when creating cloud-based work accounts with CloudEmails
Why would a database administrator set up a honeypot : Using your textbook, the Internet, and any other suitable references, answer the following questions in your own words. Save your answers in a single file.
Define analysis of the descriptive statistics : Once the data is calculated, provide a 150-250 word analysis of the descriptive statistics on the spreadsheet. This should include differences and health.
Draw a map for game scenario : Draw a map for game scenario - Write a brief description of your game in your word document - This map must also be placed in the Word document
Describe the inputs and outputs and define the job roles : Explain managerial concepts as they pertain to business process costing of Coca-Cola. Describe the inputs and outputs, and define the job roles.
Describe the effect of the problem or issue : In collaboration with the approved course preceptor, students will identify a specific evidence-based topic for the capstone project change proposal.
What amount of bonds should be accounted for in tuston : What amount of bonds should be accounted for in Tuston's government-wide financial statement as a liability resulting from governmental activities?
What year President Roosevelt promoted the housing program : Government Segregation Forum Questions - What year President Roosevelt promoted the housing program? What was the intension of this program

Reviews

Write a Review

JAVA Programming Questions & Answers

  Main method to test your class with at least three hot dog

Need a constructor that allows a user of the class to initialize both values. Also need a method named JustSold that increments the number of hot dogs the stand

  Write a class called square that is child class of rectangle

Write a class called Square that is a child class of Rectangle. A square is a rectangle with equal sides. It should inherit the perimeter() and area() methods.

  Why attenuation can occur in bacteria

Will trp operon be responsive to tryptophan levels if trpLis deleted? Yes or no Why attenuation can occur in bacteria but not in a eukaryotic cell

  Create four classes that must all interact

You will create four classes that must all interact in some meaningful way. In order to start you will create a class diagram to determine which classes depend on other classes and what those classes are

  Write a generic linked list class named AdaptiveList

Com S 228 Assignment: An Adaptive List. Write a generic linked list class named AdaptiveList. Your class must implement the java.util.List interface

  Question superclass and provide a different implementa

Add a method addText to the Question superclass and provide a different implementa- tion of ChoiceQuestion that calls addText rather than storing an array list of choices.

  Write the function int sum to calculate the sum of number

Please write the function int sum (int start, int end) to calculate the sum of natural number between start and end (included)

  Create an operating system for the machine

CISC640 - Operating Systems - Nova Southeastern University - Create a virtual machine/operating system for the machine described below that will accept programs

  Write a java statement that outputs the first name

Write a Java statement that outputs the first name followed by the last name separated by a single blank space of the first student.

  Calls the function readarray to read data into the array

Write a function void readArray(int arr[], int length) to read in length many values into the array arr.

  How to do guis in java

Write a catchy song, jingle, wrap, or poem about how to do GUI's in Java, specifying the order of the components, and the components themselves

  Benefits of using java as a programming language

What are the benefits of using Java as a programming language? Discuss how the use of an integrated development environment (IDE) such as Eclipse enhances programmer productivity

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