SYSC 2004 Lecture Notes - Lecture 5: Interactive Fiction, Adventure Game, Dynamic Array
Document Summary
Import java. util. set; import java. util. hashmap; import java. util. iterator; import java. util. * 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. * stores a reference to the neighboring room. * @author michael kolling and david j. barnes. * @version october 21, 2012 public class room private string description; private hashmap exits; // stores exits of this room. private arraylist items; * @param description the room"s description. public room(string description) this. description = description; exits = new hashmap(); items = new arraylist(); * @param item adds items to the array list public void additem(item item){ items. add(item); * @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);