Question
Java Project - Adventure Game: In this project, I need your help with the required code to implement a text adventure game. I have started
Java Project - Adventure Game:
In this project, I need your help with the required code to implement a text adventure game. I have started the code but it has incomplete classes, could you please add the required code so that the game is working as expected wrt the below scenarios provided
Download files provided in the below github link:
https://github.com/JustInJave/AdventureGame
- adventure5044.jar Download adventure5044.jar- main adventure game library
- adventure5044-api.jar Download adventure5044-api.jar- API for the library
- MyGame.java Download MyGame.java- basic starter class, to help demonstrate how to design a game
- MyGameTest.java Download MyGameTest.java- basic starter class, to help demonstrate how to test a game
Locked Out Scenario
The game starts off with you outside in your driveway at night, and the goal of this scenario is to get into your house. The front door to your house is locked, and you don't have your key. You can go north to your garage, but the side door to your house (in the garage) is also locked.
Here are the 8 items of this scenario, sorted by their initial locations:
- front yard items:
- front-door
- wall-lantern(container)
- fake-rock(container)
- spare-key
- garage items:
- side-door
- screw-driver
- shoe-box(container)
- light-bulb
The pink circle in the front yard is a fake-rock, which is actually a closed container hiding your spare-key. The spare-key is not accessible until you open the fake-rock. However, the wall-lantern has no light-bulb, so it's dark here, and you can't open anything in the dark. Therefore you must fix the wall-lantern by using a new light-bulb.
To implement this, you must first open the wall-lantern, by using a screw-driver. The screw-driver is in the garage, and so is a new light-bulb. However, the light-bulb is inside the shoe-box, which is closed. So you must open the shoe-box before you can take the light-bulb.
Once you've fixed the wall-lantern, can retrieve the spare-key from the fake-rock. Then can then use the spare-key to unlock the front-door and/or the side-door. Either way will let you finally enter your house, and thus solve this scenario.
Note: Please don't include any additional items in these three outside rooms (front yard, driveway, or garage) as they may interfere with the automated testing.
Note: The item names must all be exactly as they appear above. The hyphens are necessary because the parser only allows the player to enter two words per command, each word separated by a space. The first word is a command, and the second word is interpreted (or ignored) by the command processor.
Note: Doors only reside within a single room, and operate only in one direction. The font-door is in the font yard, and the side-door is in the garage, as shown in the diagram above. When locked, these doors inhibit movement into the house. However, they're not considered at all when moving from inside the house to the front yard or to the garage.
Implementation
The game class must be calledMyGameand the test class must be calledMyGameTest. These needed to be developed and several other classes, all in theedu.vt.cs5044package, to add the required features in the game. The game implementation must do the following:
- The game must work according to the requirements described in the section "Locked Out Scenario" above.
In addition to the 4 rooms above, must develop and integrate at least3 additionalrooms (1 point each). These additional rooms should be located outside of the house.
In addition to the 8 objects above, must develop and integrate at least3 additionalobjects (1 point each).
- The player must be able to win. There must be some situation that is recognized as the achieving the final goal of the game (1 point).
The game must support the following commands:
- examine(also shortcutx) - Allows to see the description of an item. This command should work as long as the item is in scope. An item is in scope if it is in the same room as you, or it is in your inventory.
- take- Allows to take an item from the room and place it in your inventory.
- inventory(also shortcuti) - Allows to view the list of items in your inventory.
- open- Allows to open a closed container. If any object was contained in the container, that object is removed from the container and placed in the current room.
- use- Allows to use an object in your inventory, to perform some action in the current room.
- go- Allows to move around. Please note that your game must supportthree variantsfor each of the four movement directions ("north", "south", "east", and "west"). In addition to the "go [direction]" variant, your game must also support both one-word and one-letter abbreviations (1 point). For example, both "north" and "n" must be equivalent to "go north" as ways to move in the "north" direction. Note that you must support all of these variants with a single command class.
- In addition to the 6 commands above, you must develop and integrate at least2 additionalcommands (1 point each).
To make it easier to test your own game, and to ensure compatibility with the Web-CAT automated tests, please be sure to always use the Message class anywhere it applies. Don't hard-code any message-related strings into your implementation, except in a custom Message subclass.
\fStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started