In: Computer Science
Please include all text files !!
Welcome to the second individual assignment in ITEC-3860! The goal from these series of individual assignments is to warm up your programming skills for the final project deliverable for your text-based adventure game. In games of this sort, the player wanders around from one location to another, picking up objects, and solving simple puzzles. The program you will create for this assignment is considerably less elaborate than the final project deliverable and it therefore limited in terms of number of rooms, items, monsters etc. Even so, you can still write a program that captures much of the spirit and flavor of the final game. ( text based adventure game )
This handout contains what you need to know about the second individual deliverable along with a number of hints and strategic suggestions.
Assumptions:
Goal: implement the items and puzzle feature as directed below.
Items feature:
Now that the player is able to navigate between different rooms, for the second assignment deliverable your goal is to allow the player to interact with 3 different items of your choice in three different rooms. Interaction behaviuor with items should include the exact following commands:
Hint: The items will move around in the game as the player picks them up or drops them off. Therefore, your implementation must therefore provide a facility (internal data structure) for storing objects in a room and in the player’s inventory of items. The easiest approach is to use an ArrayList, which makes it easy to add and remove items.
Under the assumption that you have followed the suggested text file structure (You are allowed to use different structure as long as you are able to fulfill the requirements) your text file for this deliverable could look like the one in the figure below:
You will need to consider adding another text file that holds the items information The entries in the items text file can consist of three lines indicating the word used to refer to the item, the description of the item that appears when you encounter it, and the room number in which the item is initially located. For example, this file indicates that the keys are in room 3, the lamp is room 8, and the rod is in room 12.
Puzzle feature:
Your goal is to allow the player to interact with one puzzle of your choice in any of the rooms. The interaction behavior with the puzzle should include the following commands:
Hit: in the text file, you can link the puzzle to the room similar to items. You need to consider adding puzzle text file to hold the following information puzzle name, description, answer, number of attempts etc.
Important notes:
The third assignment will add more to the first and second assignment. Therefore, it is important to finish this assignment on time and as directed. Otherwise, you will fall behind quickly.
Working code implemented in Java and appropriate comments provided for better understanding.
Note: I am not able to share text files. That's why I am sharing all text files through a link.
Link: https://gofile.io/d/dm6Jhx
Mirror Link: https://anonymousfiles.io/L5cK8uEJ/
Here I am attaching code for these files:
Driver.java:
import java.util.*;
import java.io.*;
/**
*
* This class reads the file "RoomMap2.txt", "Items.txt", &
"Puzzles.txt" & guides the player through a each room.
*
* Purpose: Methods and attributes needed to create a new player
of
* Player class. Read the text file, adds the each object into
the
* arraylist, & allows the player to choose which direction they
want to go.
*
*/
public class Driver
{
public static void main(String[] args)
{
//new Player object
Player player = new Player();
//open text file
File roomFile = new
File("RoomMap.txt");
//open a Scanner to read data from
File
Scanner roomReader = null;
try
{
roomReader = new
Scanner(roomFile);
}
catch (FileNotFoundException
e)
{
System.out.println("The RoomMap.txt file has not been
found");
}
// read one value at a time
while(roomReader != null &&
roomReader.hasNext())
{
//assign values
to attributes
String roomNum =
roomReader.nextLine();
String desc =
roomReader.nextLine();
String
visitedString = roomReader.nextLine();
boolean visited
= Boolean.parseBoolean(visitedString);
String
itemString = roomReader.nextLine();
boolean item =
Boolean.parseBoolean(itemString);
String
puzzleString = roomReader.nextLine();
boolean puzzle =
Boolean.parseBoolean(puzzleString);
String north =
roomReader.nextLine();
String east =
roomReader.nextLine();
String south =
roomReader.nextLine();
String west =
roomReader.nextLine();
//create a new
object & add it to the arraylist
Room room = new
Room(roomNum, desc, visited, item, puzzle, north, east, south,
west);
Map.addRoom(room);
}
//open text file
File itemFile = new
File("Items.txt");
//open a Scanner to read data from
File
Scanner itemReader = null;
try
{
itemReader = new
Scanner(itemFile);
}
catch (FileNotFoundException
e)
{
System.out.println("The Items.txt file has not been found");
}
// read one value at a time
while (itemReader != null
&& itemReader.hasNext())
{
// assign values
to attributes
String itemName
= itemReader.nextLine();
String itemDesc
= itemReader.nextLine();
String
itemLocation = itemReader.nextLine();
// create a new
object & add it to the arraylist
Item item = new
Item(itemName, itemDesc, itemLocation);
Item.addItem(item);
}
//open text file
File puzzleFile = new
File("Puzzles.txt");
// open a Scanner to read data from
File
Scanner puzzleReader = null;
try
{
puzzleReader =
new Scanner(puzzleFile);
}
catch (FileNotFoundException
e)
{
System.out.println("The Puzzles.txt file has not been
found");
}
// read one value at a time
while (puzzleReader != null
&& puzzleReader.hasNext())
{
// assign values
to attributes
String
puzzleLocation = puzzleReader.nextLine();
String question
= puzzleReader.nextLine();
String answer =
puzzleReader.nextLine();
String attempts
= puzzleReader.nextLine();
// create a new
object & add it to the arraylist
Puzzle puzzle =
new Puzzle(puzzleLocation, question, answer, attempts);
Puzzle.addPuzzle(puzzle);
}
// open text file
File helpFile = new
File("Help.txt");
// open a Scanner to read data from
File
Scanner helpReader = null;
try
{
helpReader = new
Scanner(helpFile);
}
catch (FileNotFoundException
e)
{
System.out.println("The Help.txt file has not been found");
}
// read one value at a time
while (helpReader != null
&& helpReader.hasNext())
{
// assign values
to attributes
String command =
helpReader.nextLine();
// create a new
object & add it to the arraylist
Help help = new
Help(command);
Help.addCommands(help);
}
// open text file
File navFile = new
File("Navigation.txt");
// open a Scanner to read data from
File
Scanner navReader = null;
try
{
navReader = new
Scanner(navFile);
}
catch (FileNotFoundException
e)
{
System.out.println("The Navigation.txt file has not been
found");
}
// read one value at a time
while (navReader != null &&
navReader.hasNext())
{
// assign values
to attributes
String roomNav =
navReader.nextLine();
String
beginningLine = navReader.nextLine();
String nav =
navReader.nextLine();
String
middleLine = navReader.nextLine();
String header =
navReader.nextLine();
String north =
navReader.nextLine();
String east =
navReader.nextLine();
String south =
navReader.nextLine();
String west =
navReader.nextLine();
String
endingLine = navReader.nextLine();
// create a new
object & add it to the arraylist
Navigation navi
= new Navigation(roomNav, beginningLine, nav, middleLine, header,
north, east, south, west, endingLine);
Navigation.addNavigation(navi);
}
Scanner keyboard = new
Scanner(System.in);
//starting point
int roomId = 0;
boolean done = false;
player.help.askHelp();
//repeats the program
while(!done)
{
while
(Map.getRoomItems().get(roomId).hasPuzzle())
{
for (int i = 0; i <
Puzzle.getPuzzleItems().size(); i++)
{
if
(Map.getRoomItems().get(roomId).getRoomNum().equals(Puzzle.getPuzzleItems().get(i).getPuzzleLocation()))
{
System.out.println(Puzzle.getPuzzleItems().get(i).getQuestion());
String
input = keyboard.next();
player.puzzle.solvePuzzle(input);
}
}
}
//states which
room the player is currently in based on the roomId
System.out.println("You are currently in Room #" +
Map.getRoomItems().get(roomId).getRoomNum());
player.navigation.getNavigation(roomId);
//asks which
direction the player would like to go
String input =
keyboard.next();
if
(input.equalsIgnoreCase("c"))
{
player.help.askHelp();
}
else if
(input.equalsIgnoreCase("examine"))
{
String input2 = keyboard.next();
if (input2.equalsIgnoreCase("room"))
{
player.map.examineRoom(input2);
}
else if
(input2.equalsIgnoreCase("inventory"))
{
player.examineInventory(input2);
}
else
{
player.item.examineItem(input2);
}
}
else if
(input.equalsIgnoreCase("pickup"))
{
String input2 = keyboard.next();
player.item.pickUp(input2);
}
else
if(input.equalsIgnoreCase("drop"))
{
String input2 = keyboard.next();
player.item.drop(input2);
}
else if
(input.equalsIgnoreCase("n"))
{
String direction =
Map.getRoomItems().get(roomId).getNorth();
//checks to see if the player can go north
player.map.getRoom(direction);
}
else if
(input.equalsIgnoreCase("e"))
{
String direction =
Map.getRoomItems().get(roomId).getEast();
//checks to see if the player can go east
player.map.getRoom(direction);
}
else if
(input.equalsIgnoreCase("s"))
{
String direction =
Map.getRoomItems().get(roomId).getSouth();
//checks to see if the player can go south
player.map.getRoom(direction);
}
else if
(input.equalsIgnoreCase("w"))
{
String direction =
Map.getRoomItems().get(roomId).getWest();
//checks to see if the player can go west
player.map.getRoom(direction);
}
else if
(input.equalsIgnoreCase("quit"))
{
System.out.println("You have successfully quit
the game.");
done = true;
}
else
{
System.out.println("Invalid input. Please try
again.");
}
//this room has
officially been visited
Map.getRoomItems().get(roomId).setVisited(true);
//assigns a new
roomId based on the new location of the player
roomId =
Player.getPlayerLocation();
}
keyboard.close();
}
}
Help.java:
import java.util.ArrayList;
/**
* Class: Help
*
* @author Taylor Williams
* @version 2.0
* Course: ITEC 3860 Spring 2020
* Written: Maqrch 14, 2020
*
* This class describes the commands & helpful tips the player
might need
*/
public class Help
{
private String help;
private static ArrayList<Help> commands = new
ArrayList<Help>();
/**
*
*/
public Help()
{
super();
// TODO Auto-generated constructor
stub
}
/**
* @param help
*/
public Help(String help)
{
super();
this.help = help;
}
/**
* @return the help
*/
public String getHelp()
{
return help;
}
/**
* @param help the help to set
*/
public void setHelp(String help)
{
this.help = help;
}
//adds Help objects into the arraylist
public static void addCommands(Help h)
{
commands.add(h);
}
public static ArrayList<Help>
getCommands()
{
return commands;
}
public void askHelp()
{
for (int i = 0; i <
getCommands().size(); i++)
{
System.out.println(getCommands().get(i).getHelp());
}
System.out.println("Type \"C\" at
anytime to see your commands.");
}
}
Item.java:
import java.util.ArrayList;
/**
* Class: Item
*
* This class describes the common attributes and
* methods of the Items being collected into an inventory
*/
public class Item
{
private String itemName;
private String itemDesc;
private String itemLocation;
private static ArrayList<Item> itemItems = new
ArrayList<Item>();
//counts items
private int count;
/**
*
*/
public Item()
{
super();
// TODO Auto-generated constructor
stub
}
/**
* @param itemName
* @param itemDesc
* @param itemLocation
*/
public Item(String itemName, String itemDesc, String
itemLocation)
{
super();
this.itemName = itemName;
this.itemDesc = itemDesc;
this.itemLocation =
itemLocation;
}
/**
* @return the itemName
*/
public String getItemName()
{
return itemName;
}
/**
* @param itemName the itemName to set
*/
public void setItemName(String itemName)
{
this.itemName = itemName;
}
/**
* @return the itemDesc
*/
public String getItemDesc()
{
return itemDesc;
}
/**
* @param itemDesc the itemDesc to set
*/
public void setItemDesc(String itemDesc)
{
this.itemDesc = itemDesc;
}
/**
* @return the itemLocation
*/
public String getItemLocation()
{
return itemLocation;
}
/**
* @param itemLocation the itemLocation to set
*/
public void setItemLocation(String itemLocation)
{
this.itemLocation =
itemLocation;
}
//adds Item objects into the arraylist
public static void addItem(Item i)
{
itemItems.add(i);
}
//removes Item objects from the arraylist
public static void removeItem(Item i)
{
itemItems.remove(i);
}
//returns Item objects
public static ArrayList<Item>
getItemItems()
{
return itemItems;
}
//examines items
public void examineItem(String item)
{
for (int i = 0; i <
getItemItems().size(); i++)
{
if
(item.equalsIgnoreCase(getItemItems().get(i).getItemName()))
{
System.out.println(getItemItems().get(i).getItemDesc());
}
}
for (int i = 0; i <
Player.getInventory().size(); i++)
{
if
(item.equalsIgnoreCase(Player.getInventory().get(i).getItemName()))
{
System.out.println(Player.getInventory().get(i).getItemDesc());
}
}
}
//removes Item objects from the itemItems arraylist
and adds them into the Inventory arraylist
public void pickUp(String item)
{
count = 0;
for (int i = 0; i <
getItemItems().size(); i++)
{
if
(item.equalsIgnoreCase(getItemItems().get(i).getItemName()))
{
Player.getInventory().add(getItemItems().get(i));
removeItem(getItemItems().get(i));
for (i = 0; i < Player.getInventory().size();
i++)
{
if
(item.equalsIgnoreCase(Player.getInventory().get(i).getItemName()))
{
System.out.println(Player.getInventory().get(i).getItemName() + "
has been picked up from the room and successfully added to the
player inventory.");
}
}
for (i = 0; i < getItemItems().size();
i++)
{
if
(Map.getRoomItems().get(Player.getPlayerLocation()).hasItem())
{
if
(Map.getRoomItems().get(Player.getPlayerLocation()).getRoomNum().equals(getItemItems().get(i).getItemLocation()))
{
count++;
}
if (count
== 0)
{
Map.getRoomItems().get(Player.getPlayerLocation()).setItem(false);
}
}
}
if(getItemItems().size() == 0)
{
Map.getRoomItems().get(Player.getPlayerLocation()).setItem(false);
}
}
}
}
//removes Item objects from the arraylist
public void drop(String item)
{
count = 0;
for (int i = 0; i <
Player.getInventory().size(); i++)
{
if
(item.equalsIgnoreCase(Player.getInventory().get(i).getItemName()))
{
addItem(Player.getInventory().get(i));
Player.getInventory().get(i).setItemLocation(Map.getRoomItems().get(Player.getPlayerLocation()).getRoomNum());
Player.getInventory().remove(i);
for (i = 0; i < getItemItems().size();
i++)
{
if
(item.equalsIgnoreCase(getItemItems().get(i).getItemName()))
{
System.out.println(getItemItems().get(i).getItemName() + " has been
dropped successfully from the player inventory and placed in the "
+
Map.getRoomItems().get(Player.getPlayerLocation()).getDesc());
}
if
(Map.getRoomItems().get(Player.getPlayerLocation()).hasItem() ==
false)
{
if
(Map.getRoomItems().get(Player.getPlayerLocation()).getRoomNum().equals(getItemItems().get(i).getItemLocation()))
{
count++;
}
if (count
> 0)
{
Map.getRoomItems().get(Player.getPlayerLocation()).setItem(true);
}
}
}
}
}
}
}
Map.java:
import java.util.*;
/**
*
* Purpose: Methods and attributes needed to create a Map of Room
class items.
*
*/
public class Map
{
//actual Map data
private static ArrayList<Room> roomItems = new
ArrayList<Room>();
//adds Room objects into the arraylist
public static void addRoom(Room r)
{
roomItems.add(r);
}
//returns Room objects
public static ArrayList<Room>
getRoomItems()
{
return roomItems;
}
//gets the information of the specific room
public void getRoom(String direction)
{
if (direction.equals("0"))
{
//invalid
direction
System.out.println("Sorry! You cannot go in this direction! Try
typing in a different direction.");
}
else if (direction != "0")
{
//-1 because the
arraylist starts at index 0
int location =
Integer.parseInt(direction)-1;
if(roomItems.get(location).isVisited())
{
//previously visited room
System.out.println("This room looks
familliar...");
}
if(direction.equals(roomItems.get(location).getRoomNum()))
{
//updates player location
Player.setPlayerLocation(location);
}
}
}
//lists what is in the room
public void examineRoom(String item)
{
if
(item.equalsIgnoreCase("room"))
{
System.out.println("You are in the: " +
Map.getRoomItems().get(Player.getPlayerLocation()).getDesc());
if
(Map.getRoomItems().get(Player.getPlayerLocation()).hasItem())
{
System.out.println("The item(s) in this room:
");
System.out.print("[");
for (int i = 0; i <
Item.getItemItems().size(); i++)
{
if
(Map.getRoomItems().get(Player.getPlayerLocation()).getRoomNum().equals(Item.getItemItems().get(i).getItemLocation()))
{
System.out.print(" \"" + Item.getItemItems().get(i).getItemName() +
"\"");
}
}
System.out.println(" ]");
}
else
{
System.out.println("This room is empty.");
}
}
}
}
Navigation.java:
import java.util.ArrayList;
/**
* Class: Navigation
*
* This class describes the navigation pane that shows
* where the player can go based on their location
*/
public class Navigation
{
private String roomNav;
private String beginningLine;
private String nav;
private String middleLine;
private String header;
private String north;
private String east;
private String south;
private String west;
private String endingLine;
private static ArrayList<Navigation> directions
= new ArrayList<Navigation>();
/**
*
*/
public Navigation()
{
super();
// TODO Auto-generated constructor
stub
}
/**
* @param roomNav
* @param beginningLine
* @param nav
* @param middleLine
* @param header
* @param north
* @param east
* @param south
* @param west
* @param endingLine
*/
public Navigation(String roomNav, String
beginningLine, String nav, String middleLine, String header, String
north,
String east,
String south, String west, String endingLine)
{
super();
this.roomNav = roomNav;
this.beginningLine =
beginningLine;
this.nav = nav;
this.middleLine = middleLine;
this.header = header;
this.north = north;
this.east = east;
this.south = south;
this.west = west;
this.endingLine = endingLine;
}
/**
* @return the roomNav
*/
public String getRoomNav()
{
return roomNav;
}
/**
* @param roomNav the roomNav to set
*/
public void setRoomNav(String roomNav)
{
this.roomNav = roomNav;
}
/**
* @return the beginningLine
*/
public String getBeginningLine()
{
return beginningLine;
}
/**
* @param beginningLine the beginningLine to set
*/
public void setBeginningLine(String
beginningLine)
{
this.beginningLine =
beginningLine;
}
/**
* @return the nav
*/
public String getNav()
{
return nav;
}
/**
* @param nav the nav to set
*/
public void setNav(String nav)
{
this.nav = nav;
}
/**
* @return the middleLine
*/
public String getMiddleLine()
{
return middleLine;
}
/**
* @param middleLine the middleLine to set
*/
public void setMiddleLine(String middleLine)
{
this.middleLine = middleLine;
}
/**
* @return the header
*/
public String getHeader()
{
return header;
}
/**
* @param header the header to set
*/
public void setHeader(String header)
{
this.header = header;
}
/**
* @return the north
*/
public String getNorth()
{
return north;
}
/**
* @param north the north to set
*/
public void setNorth(String north)
{
this.north = north;
}
/**
* @return the east
*/
public String getEast()
{
return east;
}
/**
* @param east the east to set
*/
public void setEast(String east)
{
this.east = east;
}
/**
* @return the south
*/
public String getSouth()
{
return south;
}
/**
* @param south the south to set
*/
public void setSouth(String south)
{
this.south = south;
}
/**
* @return the west
*/
public String getWest()
{
return west;
}
/**
* @param west the west to set
*/
public void setWest(String west)
{
this.west = west;
}
/**
* @return the endingLine
*/
public String getEndingLine()
{
return endingLine;
}
/**
* @param endingLine the endingLine to set
*/
public void setEndingLine(String endingLine)
{
this.endingLine = endingLine;
}
//adds Navigation objects into the arraylist
public static void addNavigation(Navigation n)
{
directions.add(n);
}
public static ArrayList<Navigation>
getDirections()
{
return directions;
}
public void getNavigation(int roomId)
{
System.out.println(getDirections().get(roomId).getBeginningLine());
System.out.println(getDirections().get(roomId).getNav());
System.out.println(getDirections().get(roomId).getMiddleLine());
System.out.println(getDirections().get(roomId).getHeader());
System.out.println(getDirections().get(roomId).getNorth());
System.out.println(getDirections().get(roomId).getEast());
System.out.println(getDirections().get(roomId).getSouth());
System.out.println(getDirections().get(roomId).getWest());
System.out.println(getDirections().get(roomId).getEndingLine());
}
}
Player.java:
import java.util.ArrayList;
/**
* Class: Player
*
* This class gives the player access to the map, items, an item
inventory. The player also sets/gets their current location,
* gets info from the inventory, picks up/drops/examines items,
& solves puzzles
*/
public class Player
{
private static int roomId;
//inventory of items
private static ArrayList<Item> inventory = new
ArrayList<Item>();
//has access to the Item class
Item item = new Item();
//has access to the Help class
Help help = new Help();
//has access to the Navigation class
Navigation navigation = new Navigation();
//has access to the Map class
Map map = new Map();
//has access to the Puzzle class
Puzzle puzzle = new Puzzle();
//places the player inside the specific room
public static void setPlayerLocation(int x)
{
roomId = x;
}
//locates the player
public static int getPlayerLocation()
{
return roomId;
}
//gets items in inventory
public static ArrayList<Item>
getInventory()
{
return inventory;
}
//lists the items int the inventory (if there are
any)
public void examineInventory(String item)
{
if
(item.equalsIgnoreCase("inventory"))
{
if
(getInventory().size() == 0)
{
System.out.println("Your inventory is
empty.");
}
else
{
System.out.println("The item(s) in your
inventory: ");
System.out.print("[");
for (int i = 0; i < getInventory().size();
i++)
{
System.out.print(" \"" +
getInventory().get(i).getItemName() + "\"");
}
System.out.println(" ]");
}
}
}
}
Puzzle.java:
import java.util.ArrayList;
/**
* Class: Puzzle
*
* This class describes the common attributes and
* methods of the Puzzles being collected into an inventory
*/
public class Puzzle
{
private String puzzleLocation;
private String question;
private String answer;
private String attempts;
private static ArrayList<Puzzle> puzzleItems =
new ArrayList<Puzzle>();
/**
*
*/
public Puzzle()
{
super();
// TODO Auto-generated constructor
stub
}
/**
* @param puzzleLocation
* @param question
* @param answer
* @param attempts
*/
public Puzzle(String puzzleLocation, String question,
String answer, String attempts)
{
super();
this.puzzleLocation =
puzzleLocation;
this.question = question;
this.answer = answer;
this.attempts = attempts;
}
/**
* @return the puzzleLocation
*/
public String getPuzzleLocation()
{
return puzzleLocation;
}
/**
* @param puzzleLocation the puzzleLocation to
set
*/
public void setPuzzleLocation(String
puzzleLocation)
{
this.puzzleLocation =
puzzleLocation;
}
/**
* @return the question
*/
public String getQuestion()
{
return question;
}
/**
* @param question the question to set
*/
public void setQuestion(String question)
{
this.question = question;
}
/**
* @return the answer
*/
public String getAnswer()
{
return answer;
}
/**
* @param answer the answer to set
*/
public void setAnswer(String answer)
{
this.answer = answer;
}
/**
* @return the attempts
*/
public String getAttempts()
{
return attempts;
}
/**
* @param attempts the attempts to set
*/
public void setAttempts(String attempts)
{
this.attempts = attempts;
}
public static ArrayList<Puzzle>
getPuzzleItems()
{
return puzzleItems;
}
//adds Puzzle objects into the arraylist
public static void addPuzzle(Puzzle p)
{
puzzleItems.add(p);
}
//removes Puzzle objects from the arraylist
public static void removePuzzle(Puzzle p)
{
puzzleItems.remove(p);
}
public void solvePuzzle(String answer)
{
for (int i = 0; i <
getPuzzleItems().size(); i++)
{
int attempts =
Integer.parseInt(getPuzzleItems().get(i).getAttempts());
if
(answer.equalsIgnoreCase(getPuzzleItems().get(i).getAnswer()))
{
System.out.println("You solved the puzzle
correctly!");
removePuzzle(getPuzzleItems().get(i));
Map.getRoomItems().get(Player.getPlayerLocation()).setPuzzle(false);
}
else
{
attempts--;
String attempted =
Integer.toString(attempts);
getPuzzleItems().get(i).setAttempts(attempted);
if (attempts > 0)
{
System.out.println("The
answer you provided is wrong, you still have " + attempts
+ " more attempt(s). Try one more time");
}
else
{
System.out.println("Failed to
solve");
removePuzzle(getPuzzleItems().get(i));
Map.getRoomItems().get(Player.getPlayerLocation()).setPuzzle(false);
}
}
}
}
}
Room.java:
/**
* Class: Room
*
* This class describes the common attributes and
* methods of the Room being collected into an inventory
*/
public class Room
{
private String roomNum;
private String desc;
private boolean visited;
private boolean item;
private boolean puzzle;
private String north;
private String east;
private String south;
private String west;
/**
*
*/
public Room()
{
super();
}
/**
* @param roomNum
* @param desc
* @param visited
* @param north
* @param east
* @param south
* @param west
*/
public Room(String roomNum, String desc, boolean
visited, boolean item, boolean puzzle, String north, String east,
String south,
String
west)
{
super();
this.roomNum = roomNum;
this.desc = desc;
this.visited = false;
this.item = item;
this.puzzle = puzzle;
this.north = north;
this.east = east;
this.south = south;
this.west = west;
}
/**
* @return the roomNum
*/
public String getRoomNum()
{
return roomNum;
}
/**
* @param roomNum the roomNum to set
*/
public void setRoomNum(String roomNum)
{
this.roomNum = roomNum;
}
/**
* @return the desc
*/
public String getDesc()
{
return desc;
}
/**
* @param desc the desc to set
*/
public void setDesc(String desc)
{
this.desc = desc;
}
/**
* @return the visited
*/
public boolean isVisited()
{
return visited;
}
/**
* @param visited the visited to set
*/
public void setVisited(boolean visited)
{
this.visited = visited;
}
/**
* @return the item
*/
public boolean hasItem()
{
return item;
}
/**
* @param item the item to set
*/
public void setItem(boolean item)
{
this.item = item;
}
/**
* @return the puzzle
*/
public boolean hasPuzzle()
{
return puzzle;
}
/**
* @param puzzle the puzzle to set
*/
public void setPuzzle(boolean puzzle)
{
this.puzzle = puzzle;
}
/**
* @return the north
*/
public String getNorth()
{
return north;
}
/**
* @param north the north to set
*/
public void setNorth(String north)
{
this.north = north;
}
/**
* @return the east
*/
public String getEast()
{
return east;
}
/**
* @param east the east to set
*/
public void setEast(String east)
{
this.east = east;
}
/**
* @return the south
*/
public String getSouth()
{
return south;
}
/**
* @param south the south to set
*/
public void setSouth(String south)
{
this.south = south;
}
/**
* @return the west
*/
public String getWest()
{
return west;
}
/**
* @param west the west to set
*/
public void setWest(String west)
{
this.west = west;
}
}
Sample Output Screenshots: