import java.util.HashMap;
import java.util.Iterator;
import java.util.ArrayList;
/**
* Class Room - a room in an adventure game.
*
* This class is part of the "World of Zuul" application.
* "World of Zuul" is a very simple, text based adventure game.
*
* A "Room" represents one location in the scenery of the game. It is
* connected to other rooms via exits. For each existing exit, the room
* stores a reference to the neighboring room.
*
* @author Sama Adil Shekh
* @version October 21, 2017
*/
public class Room
{
private String description;
private HashMap<String, Room> exits; // stores exits of this room.
private ArrayList<Item> items;
/**
* Create a room described "description". Initially, it has
* no exits. "description" is something like "a kitchen" or
* "an open court yard". Intializes an ArrayList of items
* in the room.
*
* @param description The room's description.
*/
public Room(String description)
{
this.description = description;
exits = new HashMap<String, Room>();
items= new ArrayList<Item>();
}
/**
* Define an exit from this room.
*
* @param direction The direction of the exit
* @param neighbour The room to which the exit leads
*/
public void setExit(String direction, Room neighbour)
{
exits.put(direction, neighbour);
}
/**
* Returns a short description of the room, i.e. the one that
* was defined in the constructor
*
* @return The short description of the room
*/
public String getShortDescription()
{
return description;
}
/**
* Return a long description of the room in the form:
* You are in the kitchen.
* Exits: north west
This study source was downloaded by 100000850872992 from CourseHero.com on 02-18-2023 22:48:54 GMT -06:00
https://www.coursehero.com/file/27690734/Roomjava/