Java Sample Project - 1 | Text Adventure Game

In a text adventure game, the central character is the Adventurer, which is an object representing the human player. You need this object because you need to keep track of where the player is, what the player is holding, and anything else you need The adventurer plays the game by typing in commands. Commands consist of one or two words (more than two is too much work).
There are several commands that are found in nearly every game: go direction Moves the Adventurer from one Room to another. The direction is usually one of "north", "south", "east", "west", and sometimes "up" and "down." Occasionally other directions are used, such as "northwest" or "sideways". Directions can usually be abbreviated, such as "n" for north, "u" for up, etc. Many games allow the verb "go" to be omitted, so "n" is short for "go north". look Gives a full description of the Room that the Adventurer is in. look thing Gives a full description of the named Thing. For this command to work, the Adventurer must either be holding the named Thing, or at least be in the same Room with it. Looking at a thing sometimes reveals surprising details about it. take thing Picks up a Thing that is in the same room as the Adventurer. The game might contain Things that cannot be picked up, such as a vending machine, or a cave painting. drop thing Puts down a Thing that the player is holding. Usually this means that the Thing is put into the Room that the Adventurer is in, but there may be exceptions (if the Adventurer is on a tightrope, for example), depending on the game.
Here is a command that is occasionally available:
use thing
-- This is a very general command, whose meaning depends on the Thing. Using a gun is very different from using a key, or a chocolate. Most often, though, games require more specific verbs: shoot gun, open safe, eat chocolate. Depending on your game and specific items, this may or may not be needed. Every command should get a response. If there is nothing much to say, the response can be simply OK. If the command can't be done, the player should be told, for instance, “I don't understand” or “You can't go that way.” When the player moves to a new location, the response should usually be a full description of the newly- entered Room. Program Details An adventure game consists of:
(1) A TextAdventure class.
This class:
Contains the main method used to start the game.
Talks to the AdventureModel and to the Adventurer classes, as needed.
(2) An AdventureModel class.
This class: • Creates the Rooms, the Things, and the Adventurer. • Connects the Rooms with "paths" to other Rooms. • Places Things in the Rooms. • Places the Adventurer in some Room. • Accepts commands from the player, and executes them. o As commands are entered, they should be copied to the main text area. o The method that executes commands should return a String to be displayed in the main text area.
(3) An Adventurer (the human player).
An adventurer has:
A location (some room).
An inventory (the things being carried). When the player executes the “take thing” command, the item should be added to the inventory. An adventurer can:
Move from room to room.
Carry a number of objects.
Pick up, drop, look at, and use various objects.
(4) Some number of Rooms.
A room has:
A name.
A description, possibly several sentences long.
Contents: the things in the room.
Exits: paths to other rooms (usually some of north, south, east, and west).
Some number of Things.
A thing has:
A name § If some of your Things have multi-word names, such as "firebreathing dragon" or "that thing that your aunt gave you that you don't know what it is", then you might want to give your Things both a full name and a one-word name.
A description, to be shown when the adventurer "looks" at it.
One or more methods for using the Thing. You can have a multi- purpose use verb, or you can make up your own verbs (for instance, drink water or pour water), which determines what the thing does when the adventurer tries to use it.
For simplicity, we will say that the adventurer can only use things being carried (in the inventory)
Whether "using" a thing does anything or not (or exactly what it does) can depend on what room it is in, what other things are in the room or in the inventory, or any other conditions you can think of. Your assignment is to write an adventure game with your group.
It should have:
A general location (battlefield, outer space, etc.)
At least 10 rooms
An inventory for the player to store items
At least 3 examples of Inheritance
At least 2 examples of Overridden Methods
At least 1 example of Polymorphism (note it in a code comment so I can see you understand it)
Be sure only the minimum methods are public; most of your methods and variables should be private
README.txt
This is where you will describe the available commands and anything else necessary for the user to play your game. The theme of the game, and the goal of the game, is up to you. So that your adventure game is not too difficult to grade, please:
1. Don't let the player "die" or otherwise get into a situation from which there is no possibility of winning the game.
2. Include a walkthrough (in a file named README.txt) to tell me how to play your game to a successful completion
Script to do this:
AdventureModel.java
import java.util.HashMap;
import java.util.Scanner;
public class AdventureModel {
private Room rooms[];
private Thing things[];
private Adventurer adventurer;
private Wall walls[];
private Water waters[];
public AdventureModel() {
}
public void initGame(){
things = new Thing[8];
walls = new Wall[4];
waters = new Water[10];
rooms = new Room[16];
for(int i =0 ;i< 4 ;i++)
walls[i] = new Wall();
for(int i =0 ;i< 10 ;i++)
waters[i] = new Water();
things[0] = new Thing("Gold", "A gold is hidden in this room");
things[1] = new Thing("Dragon", "A dragon is taking care of room");
things[2] = new Thing("Banner", "Banner is pasted outside the wall");
things[3] = new Thing("Food", "Food for whole people in the room");
things[4] = new Thing("Army", "An army to protect room");
things[5] = new Thing("Boat", "A boat to sail over water");
things[6] = new Thing("Dragon Glass", "An Sword to shoot Enemy");
rooms[0] = new Room("Iron Bank","Iron Bank contains 2 Golds and pick up items command");
rooms[0].addObject(things[0]);
rooms[0].addObject(things[0]);
rooms[1] = new Room("Vaas Dothrak","Vaas Dothrak needs items");
rooms[2] = new Room("Slaver's Bay","Slaver's Bay pick up items");
rooms[3] = new Room("Pentos","Pentos pick up items and start position");
rooms[4] = new Room("Meereen","Meereen contains pick up items and Army");
rooms[4].addObject(things[4]);
rooms[5] = new Room("Qohor","Qohor contains pick up items and Dragon");
rooms[5].addObject(things[1]);
rooms[6] = new Room("Astapor","Astapor contains pick up items, Reqruired command,Gold and Boat");
rooms[6].addObject(things[0]);
rooms[6].addObject(things[5]);
rooms[7] = new Room("Dragon Stone","Dragon Stone contains pick up items, Reqruired command,Dragon and Banner");
rooms[7].addObject(things[1]);
rooms[7].addObject(things[2]);
rooms[8] = new Room("The Vale","The Vale contains pick up items, Reqruired command,Food and Banner");
rooms[8].addObject(things[3]);
rooms[8].addObject(things[2]);
rooms[9] = new Room("Castle Black","Castle Black contains pick up items, Reqruired command,Dragon Glass and 2 Banner");
rooms[9].addObject(things[6]);
rooms[9].addObject(things[2]);
rooms[9].addObject(things[2]);
rooms[10] = new Room("High Garten","High Garten contains pick up items and Food");
rooms[10].addObject(things[3]);
rooms[11] = new Room("Dorne","Dorne contains pick up items,sticker and Food");
rooms[11].addObject(things[2]);
rooms[11].addObject(things[3]);
rooms[12] = new Room("Iron Island","Iron Island contains pick up items,sticker and Food");
rooms[12].addObject(things[0]);
rooms[12].addObject(things[2]);
rooms[13] = new Room("WinterFell","WinterFell contains pick up items,sticker and Food");
rooms[13].addObject(things[2]);
rooms[14] = new Room("Casterly Rock","Casterly Rock contains pick up items,Items required,sticker and Food");
rooms[14].addObject(things[2]);
rooms[14].addObject(things[3]);
rooms[15] = new Room("King's Landing(End)","King's Landing(End) and items required Dragon,Sticker, and Army");
rooms[15].addObject(things[1]);
rooms[15].addObject(things[2]);
rooms[15].addObject(things[4]);
//maping wall direction
walls[0].addDirection("east", walls[1]);
walls[0].addDirection("south", rooms[0]);
walls[1].addDirection("east", walls[2]);
walls[1].addDirection("south", rooms[1]);
walls[1].addDirection("west", walls[0]);
walls[2].addDirection("east", walls[3]);
walls[2].addDirection("south", waters[2]);
walls[2].addDirection("west", walls[1]);
walls[3].addDirection("east", waters[4]);
walls[3].addDirection("south", waters[3]);
walls[3].addDirection("west", walls[2]);
//maping waters direction
waters[0].addDirection("east", waters[1]);
waters[0].addDirection("south", waters[4]);
waters[0].addDirection("west", walls[3]);
waters[1].addDirection("south", rooms[2]);
waters[1].addDirection("west", waters[0]);
waters[2].addDirection("east", waters[3]);
waters[2].addDirection("west", rooms[1]);
waters[2].addDirection("north", walls[2]);
waters[2].addDirection("south", rooms[5]);
waters[3].addDirection("east", waters[4]);
waters[3].addDirection("west", waters[2]);
waters[3].addDirection("north", walls[3]);
waters[3].addDirection("south", waters[5]);
waters[4].addDirection("east", rooms[2]);
waters[4].addDirection("west", waters[3]);
waters[4].addDirection("north", waters[0]);
waters[4].addDirection("south", rooms[6]);
waters[5].addDirection("east", rooms[6]);
waters[5].addDirection("west", rooms[5]);
waters[5].addDirection("north", waters[3]);
waters[5].addDirection("south", rooms[10]);
waters[6].addDirection("east", rooms[10]);
waters[6].addDirection("west", rooms[9]);
waters[6].addDirection("north", rooms[5]);
waters[6].addDirection("south", waters[7]);
waters[7].addDirection("east", rooms[15]);
waters[7].addDirection("west", rooms[14]);
waters[7].addDirection("north", waters[6]);
waters[8].addDirection("east", waters[9]);
waters[8].addDirection("west", rooms[15]);
waters[8].addDirection("north", rooms[11]);
waters[9].addDirection("west", waters[8]);
waters[9].addDirection("north", rooms[12]);
//maping rooms direction
rooms[0].addDirection("east", rooms[1]);
rooms[0].addDirection("north",walls[0]);
rooms[0].addDirection("south",rooms[3]);
rooms[1].addDirection("east",waters[2]);
rooms[1].addDirection("west",rooms[0]);
rooms[1].addDirection("north",walls[1]);
rooms[1].addDirection("south",rooms[4]);
rooms[2].addDirection("west",waters[4]);
rooms[2].addDirection("north",waters[1]);
rooms[2].addDirection("south",rooms[7]);
rooms[3].addDirection("east",rooms[4]);
rooms[3].addDirection("north",rooms[0]);
rooms[3].addDirection("south",rooms[8]);
rooms[4].addDirection("east",rooms[5]);
rooms[4].addDirection("west",rooms[3]);
rooms[4].addDirection("north",rooms[1]);
rooms[4].addDirection("south",rooms[9]);
rooms[5].addDirection("east",waters[5]);
rooms[5].addDirection("west",rooms[4]);
rooms[5].addDirection("north",waters[2]);
rooms[5].addDirection("south",waters[6]);
rooms[6].addDirection("east",rooms[7]);
rooms[6].addDirection("west",waters[5]);
rooms[6].addDirection("north",waters[4]);
rooms[6].addDirection("south",rooms[11]);
rooms[7].addDirection("west",rooms[6]);
rooms[7].addDirection("north",rooms[2]);
rooms[7].addDirection("south",rooms[12]);
rooms[8].addDirection("east",rooms[9]);
rooms[8].addDirection("north",rooms[3]);
rooms[8].addDirection("south",rooms[13]);
rooms[9].addDirection("east",waters[6]);
rooms[9].addDirection("west",rooms[8]);
rooms[9].addDirection("north",rooms[4]);
rooms[9].addDirection("south",rooms[14]);
rooms[10].addDirection("east",rooms[11]);
rooms[10].addDirection("west",waters[5]);
rooms[10].addDirection("north",waters[6]);
rooms[10].addDirection("south",rooms[15]);
rooms[11].addDirection("east",rooms[12]);
rooms[11].addDirection("west",rooms[6]);
rooms[11].addDirection("north",rooms[10]);
rooms[11].addDirection("south",waters[8]);
rooms[12].addDirection("west",rooms[11]);
rooms[12].addDirection("north",rooms[7]);
rooms[12].addDirection("south",waters[9]);
rooms[13].addDirection("east",rooms[14]);
rooms[13]