” 写作CSC72003程序、Java编程设计程序CSC72003 Assignment 2Weight: 30% of your final markDue: 25 May 2020, 10.00 pmSpecificationsYour task is to complete various exercises in BlueJ, using the Java language, and to submit these viathe 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. Test your game thoroughly.Getting HelpThis assignment is to be completed individually. It is the opportunity to gain an understanding of theconcepts of object-oriented programming and coding syntax. It is important that you master theseconcepts yourself. You are permitted to work from the examples in the study guide or textbook butyou must acknowledge assistance from other textbooks or classmates. In particular, you must notuse 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 withyour program.EncouragedAttribution RequiredAsk tutorNot acceptableLecturer Tutors OnlineForumsRelatives Studentsoutside unit Hired codersClassmates PrivateTutors OtherPart 1:Set up your assignmentTo set up your assignment you will need to do the following: Create a folder called username-A2. For example, mine would be nfrancis -A2. Copy the zuul-better project in chapter 8 of the book projects to your username-A2folder. Create a word document called username-A2-documentation. For example, minewould be nfrancis-A2- documentation. Add your full name and student id to thefooter. You will lose marks if you do not do this. Save this word document to yourusername-A2 folder.After you have set up your assignment open the zuul-better project In BlueJ, create a newinstance 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 usein your assignment. Download chapter 6 of the text book from topic 7 on mySCU as you will need this forthe assignment.NOTE: When you submit your assignment, you will need to zip up your username-A2 folderand upload onto mySCUDesign your gameUsing the given zuul game as a starting point, you must design your own game. In thetutorial, you can ask your tutor for advice.If you find it difficult to visualize this sort of game scenario, try modelling your game on 写作CSC72003作业、Java编程设计作业调试、Java课程作业 辅导、 写作data作业some familiar real-world location. If you need additional inspiration, you can try playing theoriginal Colossal Cave Adventure game.You must have the following in your game: Your game scenario must have at least ten (10) different rooms. Your game scenario must have at least six (6) types of exits e.g., north, south, east,west, up, down and any others you require. This requirement does NOT mean thateach room must have 6 exits. Your game scenario must include at least two (2) items in each room that the playercould find, pick up and potentially use. Your game must have some way for the player to win. Most likely, this will be byachieving some goal such as finding a particular item, surviving for some specifiednumber of moves, or exiting a particular room anything sensible for your game.DocumentationWrite a brief description of your game in your word document. You must: Describe your game including the back story and the setting List the items in the game and how to use it Draw a map for your game scenario. You must:o Label the roomso Label the exits (connections between rooms)o Specify the locations of the items in the map Explain how the player winsThe document must include the map (e.g., screenshot, picture).Part 2:Programming exercise 1 Update the comments at the beginning of the Game class, the Room class and themessage displayed by the printWelcome and printHelp method so that theydescribe your game. Update the Game and Room class so that it creates the rooms and exits that youinvented for your game. You do not need to add any items to your game yet. You willadd items later.Programming exercise 2Your game scenario requires that there be items positioned throughout the world that theplayer can pick up and possibly use. An item sounds like something that should berepresented by an object! So create an Item class to represent the items in your game. Youwill need to decide what fields your Item class needs to have, what parameters theconstructor will require and what methods the class will have. At a minimum, items willhave a name and a description. However, items may have many other attributes that makesense for your game (e.g. weight, colour, value, destructive power ..)Programming exercise 3Now that there is a class for representing Items we need a way to allow the rooms tocontain an item. Modify the Room class so that items can be added to or removed from theroom. 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 anitem to a room that already contains an item, or an attempt is made to remove an itemfrom a room that does not contain an item.Programming exercise 4Now that a room can contain an item, when the player enters a room he/she should be toldabout the item in that room (unless you have taken the item). Modify the appropriate codeso that if the player enters a room containing an item, the name and description of the itemare displayed along with the description of the room and the list of exits.Programming exercise 5Edit the code in the Game class so that the items for your game are created and added tothe appropriate rooms at the start of the game. Recall that your game must include at leasttwo items per room. Be sure to test any methods that you add or modify.Play the game to ensure that your items are appearing in the rooms.Part 3:Now that rooms can contain items and a player will know when they enter a room with anitem, it would be nice if the player could pick up and carry items. Add functionality to thePlayer class that will allow the player to pick up and drop items. The player should be able tocarry any number (i.e. a collection) of items.Programming exercise 6Modify the Game class so that it will recognize the command take. When the user entersthe take command, the item in the current room, if there is one, should be added to theitems that the player is carrying, and a message should be printed indicating that the playerhas taken the item. If there is no item in the current room the take command should printan error message. Be sure to test any methods that you add or modify. (Hint: Rememberthat one task of the Game constructor is to teach the CommandReader what words arevalid commands. Thus, you will need to make a change in Games constructor if you want tointroduce a new command.)Programming exercise 7Modify the Game class so that it will recognize the command inventory. When the usertypes inventory the game prints the names of the items that the player is currentlycarrying. 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 exitsfor a room is generated and displayed.)Play the game to be sure the inventory command works!Programming exercise 8Add 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 roomalready contains more than 2 items, the drop command should print an error messageindicating 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 9Implement at least two locked doors to your game. The first door/entrance door should belocked 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 usecommand to open the door. Hint: Reuse the take command to implement the usecommand. Adjust your winning condition if necessary.Programming exercise 10Modify the printHelp method of the Game class so that it also prints the status of thecurrent room and make sure to include helpful messages to the players.Programming exercise 11Add some form of time limit to your game. If a certain task is not completed in a specifiedtime, the player loses. A time limit can easily be implemented by counting the number ofmoves or the number of entered commands. It does not have to be real-time.Play the game to be sure the modified help command works – celebrate!THIS IS END OF THE REQUIRED PART OF THE ASSIGNMENT. Below are bonusenhancements:If you completed all of the above parts, you may complete any or all of the followingexercises for extra credit. The exercises can be found in the provided textbook chapter fromtopic 7 on mySCUPLEASE NOTE YOU MUST: Explicitly state which of these bonus problems you have done in your worddocument or they will not be marked. Provide the explanation which refers to the code (class and line number) you havewritten for these bonus exercises in your word document or they will not bemarked.Problems worth at most 2 extra points: Add a transporter room. Whenever the player enters this room, he/she is randomlytransported into one of the other rooms. Note: Coming up with a good design forthis task is not trivial. Should you decide to implement this feature, you might haveto redesign the map. Modify the game so that only a list of the names of the items in a room are displayedwhen the player enters. Then add a look command that allows the player to look atan item in the current room by name. For example, if the player types look book andthere is an item named book in the current room, your game should display thedescription of that item. If there is no such item, your game should display an errormessage. If the player enters the look command with no second word, it shoulddisplay the entire description of the room, its exits and the names of any itemsagain.Problems worth at most 4 extra points: Implement the back command so that using it repeatedly takes you back severalrooms, all the way to the beginning of the game if used often enough. Use a Stack todo this. (You may need to find out about stacks. Look at the Java librarydocumentation.) Add characters to the game. Characters are similar to items, but they can talk. Theyspeak some text when you first meet them, and they may give you some help if yougive them the right item.Problems worth at most 6 extra points: Add moving characters. These are like other characters, but every time the playertypes a command, these characters can move into an adjoining room. Hints:You can add the following method to the Room class to randomly choose an exit for thecharacter when it moves. Note that exits are the field (of type HashMap) that contains theexits for the room – if you used a different field name, use that name instead./*** choose a potential exit at random*/public String randomExit() {Object [] dirs = exits.keySet().toArray();int index = (int) (Math.random() * dirs.length);return (String) dirs[index];}Your test cases for character movement do not need to check the location of the characterafter moving (because characters may move randomly).如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。