代写OOP2025 Assignment 1 – Text Based Game代写Java编程

Assignment 1 – Text Based Game

Deadline: 16:00, Nov 10, 2025

1    Introduction

In this assignment, you are tasked with creating a basic text-based game in the style of Zork (https://en.wikipedia.org/wiki/Zork)

The game is played by the user entering in various commands (e.g.  "move south", "look", "search chest", "get key"), to which the game responds with text based output (e.g. "You pick up the rusty key").

You need to create your own narrative or story for the game. This narrative can be of any genre: science-fiction, cosy cooking game, fantasy, detective noir, etc. The game consists of "rooms" or "areas" which the player can travel to and perform actions in. Your game also needs to present puzzles to the player.  Puzzles involve the player using an item in their inventory.  The game will also provide the player with a score based on how many "rooms" they have visited and how many puzzles they have solved.

Finally, the game also needs to display a text-based map of the game world as the player is exploring.

2 Mark allocations

You will receive marks based on two aspects of the game: Firstly, the results of running the test.sh command. We will run our own version of these tests once you have submit- ted. This command will test each class and method (detailed as Task 1 - 6).  You need to implement all the classes and methods shown in the Task sections.

Secondly, you will need to submit a screen recording showing you playing the game and discussing the code. Your screen recording needs to have the following:

•  Show your face and your student card or any other valid proof of identity (e.g. Passport or drivers license).

•  Play through the game once showing all the rooms, puzzles and an example of each of the expected commands. Do this in the order given in Section 2.1

Show and briefly explain the code in your Game.java file.

•  Show and briefly explain anything additional, innovative, or interesting you did in the game.

The screen recording must be shorter than 5 minutes. You can use a text-to-speech app if you do not want to record your own voice.

2.1 Minimum expected commands

The following is a minimum list of commands the game must be able to parse (values in angle brackets refer to arguments given to a command):

"move <direction>" - ( can be "north", "south", "east", "west"). The player moves to a new room based on the direction.

"look" - Displays a description of the room the player is in.

"look <feature>" - Displays a more detailed description of a feature in a room. A feature is a fixed object in the room.

"look <item>" - Displays a description of an item. This should only work if the item is in the player’s inventory.

"inventory" - Displays a list of all items the player has obtained.

"score" - Displays the users current score.

"map" - Displays a text-based map of the current explored game world.

"help" - Displays a help message.

"quit" - Quits the game.

2.2 Additional commands

You need to add additional commands of your choice for the puzzles you will create. For example, "open toolbox" will open a toolbox. Then "take crowbar" will take the crowbar out of the toolbox and put it into the user’s inventory.

You can create any other additional commands you want so long as they make log- ical sense in your game.  You need to use these additional commands to create your puzzles.

2.3 Minimum game requirements

The following are the minimum requirements for the game.  You are welcome to add more if you want to:

At least ten (10) unique rooms or areas.

At least two (2) puzzles.

At least four (4) items.

3    Task 1 - Position.java

The Position class stores an position in terms of an x and y value. The required methods are:

public  Position(int  x,  int  y)

The x and y fields need to be declared as public so that other classes can access them directly.

4    Task 2 - Room.java

The Room class stores information about a Room, including a name, description, a symbol and a Position. The required methods are:

•   public  Room(String  name,  String  description,  char  symbol,  Position position)

public  String  getName()

public  String  getDescription()

public  char  getSymbol()

public  Position  getPosition()

The symbol is used when displaying the room on the map.

5    Task 3 - Map.java

The Map class stores information about the game Map, including the map array, a width and height, and the value used for empty map areas. The required methods are:

•   public  Map(int  width,  int height)  (this represents therols and columns starting at the top left of the map)

public  void placeRoom(Position pos,  char  symbol)

public  String  display()

Declare the empty area value as follows:     final  private  char  EMPTY  =   ' . ' ;

6    Task 4 - Inventory.java

The Inventory class stores the player’s inventory, and is essentially a wrapper around an array. It includes the maximum items you can store, the current number of items stored and an array to store the items in. The required methods are:

public  Inventory()

•    public  void  addItem(String  item)   Adds an item to the array if there is space.

•    public  int hasItem(String  item)  Returns the position of the item in the array if it is in the array. Otherwise it returns -1

•    public  void  removeItem(String  item)   Removes a specified item while ensuring there are no empty elements in the array.

•    public  String  displayInventory()   Returns a String of all items sepa- rated by spaces (note that there is a space after the last item as well).

Declare the maximum size as follows: final  int  MAX_ITEMS  =  10;

7    Task 5 - Score.java

The Score class stores and calculates the player’s score.  It includes the starting score, the current score, the number of rooms visited, the number of puzzles solved and the score per puzzle. The required methods are:

public  Score(int  startingScore)

public  void  visitRoom()

public  void  solvePuzzle()

•    public  double  getScore()   Calculates and returns the current score.  The score is calculated as the starting score minus the number of rooms visited plus the number of solved puzzles times the score per puzzle.

Declare the score per puzzle as follows:      private  final  int  PUZZLE_VALUE =  10;

8    Task 6 - Game.java

The Game class runs the main game loop.  You can create any methods you feel you require but you need to use all the other classes to make the game work.  The only required method is:

public  static  void main(String[]  args)

You can write this code in any way you want to but here is a hint for a possible approach:

•  Create some Room objects to store information about each Room in your game.

Create Inventory and Score objects.

Use a while loop for the main game loop.

•  Inside this loop use an if statement to check what commands the user has typed. Based on the command, the Room the user is in and what items the user has in their inventory output a different response and update the Inventory, Score and Map information if appropriate.

9 Submission Procedure

The general steps to take to complete the project are as follows:

Set up your gitlab ssh access using the setup-git command on vlab.

Copy your ssh key to your gitlab profile.

Clone the template repository from your gitlab.

Do not change any of the code in the template but you may add to it.

•  Work on your code, testing it regularly.  Use the run.sh script to run the code as this builds the code correctly as well.

•  Use the test.sh script to test your code.  This will give you an output similar to what we will use to mark the code.

Make sure you commit and push regularly as well.

•  Make sure to add comments to your code to clearly explain what each method is doing.

•  Once you have completed the code, record a short video using MS Stream. Refer to Section 2 for more information.

Submit the video to canvas.

Submit the latest commit hash to canvas.

•  You will receive an automated message indicating whether we are able to mark your code.

If there are no problems you are done with the assignment.

•  If there are problems with your submission, update it accordingly and resubmit the latest commit hash.

10 Rubric

Task

Submission Type

Mark

Position.java

gitlab

5

Room.java

gitlab

10

Map.java

gitlab

10

Inventory

gitlab

15

Score

gitlab

10

Game playthrough

Canvas video submission

20

Game.java

Canvas video submission

15

Additional features

Canvas video submission

15

Total

100

Table 2: Mark Rubric

11    Sample Output

Your  empty  cell  in  the brig.  The  only notable  feature  is  the half  open cell  door  to  the  south .

>>  move  south

You  follow  the hallway  south >>  move  south

You  follow  the hallway  towards  the  control  room >>  look

You  are  standing  in  the  control  room  of  the brig.  There  is  a  control panel with  a number  of  large button with  ’locked ’  written  on  it .

>> press button

You press  the button marked  ’locked ’ .

>>  look

You  are  standing  in  the  control  room  of  the brig.  There  is  a  control

panel with  a number  of  large button with  ’unlocked ’  now written  on it .  The  lock  on  the  door  to  the  east  is  open .

>>  move  east You  go  east .

>>  look

You  are  standing  in  a  dark  and  dusty  storage  room. You notice  a  closed

toolbox  standing  on  a  crate .  There  is  a metal  grate  in  the  corner  of the  room .

>>  inventory

You have:

>> map

.......... .c........ .h........ .bs....... .......... .......... .......... .......... .......... ..........

>>  open  toolbox

You  open  the  toolbox .  Inside  you  find  a  crowbar .

>>  take  crowbar

You  take  the  crowbar .

>>  inventory

You have:  crowbar

>> use  crowbar  on  grate

You  lift  the  grate up .  A  ladder  leads  down  into  darkness.

>>  look

You  are  standing  in  a  dark  and  dusty  storage  room.  You  notice  a  open  and empty  toolbox  standing  on  a  crate .  There  is  a  open metal  grate  in  the corner  of  the  room .

>> help


Valid  commands  are:  ,    ,  ,  ,  ,  , ,    and  

>>  score

SCORE:  106 .0

>>  quit

Game  over



热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图