JAVA
Lap3/Main.ctxt
#BlueJ class context comment0.target=Main comment0.text=\n\ The\ sole\ purpose\ of\ this\ class\ is\ to\ start\ the\ game\ up.\ It\ does\ this\ by\n\ creating\ an\ instance\ of\ the\ Game\ and\ calling\ it's\ play\ method.\n\ \n\ @author\ Maria\ Jump\n\ @version\ 2015.02.01\n comment1.params= comment1.target=Main() comment1.text=Default\ constructor. comment2.params=e comment2.target=void\ componentResized(java.awt.event.ComponentEvent) comment3.params=event comment3.target=void\ actionPerformed(java.awt.event.ActionEvent) comment3.text=\n\ Default\ action\ listener.\n\ \n\ @param\ event\n\ \ \ \ \ \ \ \ \ \ \ \ The\ action\ event.\n comment4.params=args comment4.target=void\ main(java.lang.String[]) comment4.text=\n\ The\ main\ method\ for\ the\ program.\n\ \n\ @param\ args\n\ \ \ \ \ \ \ \ \ \ \ \ The\ command\ line\ arguments.\n numComments=5
Lap3/Game.ctxt
#BlueJ class context comment0.target=Game comment0.text=\n\ This\ class\ is\ the\ main\ class\ of\ the\ "Campus\ of\ Kings"\ application.\n\ "Campus\ of\ Kings"\ is\ a\ very\ simple,\ text\ based\ adventure\ game.\ Users\ can\ walk\n\ around\ some\ scenery.\ That's\ all.\ It\ should\ really\ be\ extended\ to\ make\ it\ more\n\ interesting\!\n\ This\ game\ class\ creates\ and\ initializes\ all\ the\ others\:\ it\ creates\ all\ rooms,\n\ creates\ the\ parser\ and\ starts\ the\ game.\ It\ also\ evaluates\ and\ executes\ the\n\ commands\ that\ the\ parser\ returns.\n\ \n\ @author\ Mohammed\ Alharbi\n\ @version\ 2018/1/24\n comment1.params= comment1.target=Game() comment1.text=\n\ Create\ the\ game\ and\ initialize\ its\ internal\ map.\n comment10.params=command comment10.target=void\ dropItem(Command) comment10.text=\n\ Try\ to\ go\ to\ one\ direction.\ If\ there\ is\ an\ exit,\ enter\ the\ new\ room,\n\ otherwise\ print\ an\ error\ message.\n\ \n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n comment11.params= comment11.target=void\ inventory() comment11.text=\n\ Try\ to\ go\ to\ one\ direction.\ If\ there\ is\ an\ exit,\ enter\ the\ new\ room,\n\ otherwise\ print\ an\ error\ message.\n\n\ \ The\ command\ to\ be\ processed.\n comment12.params= comment12.target=void\ printGameStatus() comment12.text=\n\ Print\ out\ the\ status\ of\ the\ game.\n comment13.params= comment13.target=void\ goBack() comment13.text=\n\ Take\ the\ player\ back\ to\ the\ previous\ location.\n comment14.params= comment14.target=void\ printGoodbye() comment14.text=\n\ Print\ out\ the\ closing\ message\ for\ the\ player.\n comment15.params= comment15.target=void\ printLocationInformation() comment15.text=\n\ Prints\ out\ the\ current\ location\ and\ exits.\n comment16.params= comment16.target=void\ printHelp() comment16.text=\n\ Print\ out\ some\ help\ information.\ Here\ we\ print\ some\ stupid,\ cryptic\n\ message\ and\ a\ list\ of\ the\ command\ words.\n comment17.params= comment17.target=void\ printWelcome() comment17.text=\n\ Print\ out\ the\ opening\ message\ for\ the\ player.\n comment18.params=command comment18.target=boolean\ quit(Command) comment18.text=\n\ "Quit"\ was\ entered.\ Check\ the\ rest\ of\ the\ command\ to\ see\ whether\ we\n\ really\ quit\ the\ game.\n\n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n\ @return\ true,\ if\ this\ command\ quits\ the\ game,\ false\ otherwise.\n comment19.params= comment19.target=void\ look() comment19.text=\n\ prints\ out\ the\ location\ information.\n\ \n comment2.params= comment2.target=Player\ getCurrentPlayer() comment2.text=\n\ Get\ current\ player\ playing\ the\ game.\n\ @return\ current\ player\n comment20.params=command comment20.target=void\ pack(Command) comment20.text=\n\ Pack\ an\ item\ into.\ \ \n\ \n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n comment21.params=command comment21.target=void\ unpack(Command) comment21.text=\n\ Pack\ an\ item\ into.\ \ \n\ \n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n comment22.params=command comment22.target=void\ eat(Command) comment22.text=\n\ eat.\n\ @param\ command\ the\ command.\n\ \n comment23.params=command comment23.target=void\ drink(Command) comment23.text=\n\ drink.\n\ @param\ command\ the\ command.\n comment24.params=command comment24.target=void\ equip(Command) comment24.text=\n\ equip.\n\ @param\ command\ the\ command.\n comment25.params=command comment25.target=void\ unequip(Command) comment25.text=\n\ unequip\ .\n\ @param\ command\ the\ command.\n comment3.params= comment3.target=void\ play() comment3.text=\n\ Main\ play\ routine.\ Loops\ until\ end\ of\ play.\n comment4.params=command comment4.target=boolean\ processCommand(Command) comment4.text=\n\ Given\ a\ command,\ process\ (that\ is\:\ execute)\ the\ command.\n\ \n\ @param\ command\n\ \ \ \ \ \ \ \ \ \ \ \ The\ command\ to\ be\ processed.\n\ @return\ true\ If\ the\ command\ ends\ the\ game,\ false\ otherwise.\n comment5.params=command comment5.target=void\ goGame(Command) comment5.text=\n\ Try\ to\ go\ to\ one\ direction.\ If\ there\ is\ an\ exit,\ enter\ the\ new\ room,\n\ otherwise\ print\ an\ error\ message.\n\ \n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n comment6.params=command comment6.target=void\ unlock(Command) comment6.text=\n\ Unlock\ a\ locked\ door.\ \n\ \n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n comment7.params=command comment7.target=void\ lock(Command) comment7.text=\n\ lock\ a\ locked\ door.\ \n\ \n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n comment8.params=command comment8.target=void\ examineItem(Command) comment8.text=\n\ Try\ to\ examine\ a\ play\ item.\ If\ the\ item\ doesn't\ exist\ in\ the\n\ players\ inventory\ nor\ the\ current\ room,\n\ print\ an\ error\ message.\n\ \n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n comment9.params=command comment9.target=void\ takeItem(Command) comment9.text=\n\ Try\ to\ go\ to\ one\ direction.\ If\ there\ is\ an\ exit,\ enter\ the\ new\ room,\n\ otherwise\ print\ an\ error\ message.\n\ \n\ @param\ command\n\ \ The\ command\ to\ be\ processed.\n numComments=26
Lap3/Drink.java
Lap3/Drink.java
/**
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*
*
@author
mohammed alharbi
*
@version
29/4/2018
*/
public
class
Drink
extends
Item
implements
Drinkable
{
/**
* Drink.
*
@param
name the name.
*
@param
pointValue the pointValue.
*
@param
description teh description.
*
@param
weight teh weight.
*/
public
Drink
(
String
name
,
int
pointValue
,
String
description
,
int
weight
)
{
super
(
name
,
pointValue
,
description
,
weight
);
}
@
Override
public
String
drink
(
Player
p
)
{
p
.
updateHealth
(
2
);
p
.
removeItem
(
this
.
getName
());
return
"you have taken a drink"
;
}
}
Lap3/Player.ctxt
#BlueJ class context comment0.target=Player comment0.text=\n\ class\ Player.\n\ @author\ Mohammed\ Alharbi\n\ @version\ 2018.1.27\n comment1.params=playPlayer comment1.target=Player(Room) comment1.text=\ constructor\ in\ the\ Player\ class.\n\ @param\ playPlayer\ for\ the\ room\ .\n comment10.params=weapon comment10.target=void\ setCurrentWeapon(Item) comment10.text=\ a\ mutator\ for\ the\ current\ weapon\ of\ the\ character.\n\ @param\ weapon\ to\ be\ equipped\n comment11.params= comment11.target=Room\ getpreviousRoom() comment11.text=\ Accessors\ for\ the\ previous\ room\ the\ character.\n\ @return\ cerrentRoom\n comment12.params= comment12.target=java.lang.String\ getInventory() comment12.text=\ Accessors\ for\ the\ players\ inventory.\n\ @return\ players\ inventory\n comment13.params= comment13.target=Item\ getCurrentWeapon() comment13.text=\n\n\ @return\ the\ players\ current\ weapon\n comment2.params=health comment2.target=void\ updateHealth(int) comment3.params=item comment3.target=boolean\ inventoryAddItem(Item) comment3.text=\ Add\ item\ to\ inventory.\n\ @param\ item\n\ @return\ true\ if\ item\ added\ to\ inventory\n comment4.params= comment4.target=int\ getCurrentWeight() comment4.text=\n\n\ @return\ current\ weight\ that\ the\ player\ is\ carrying\n comment5.params= comment5.target=int\ getMaxWeight() comment5.text=\n\n\ @return\ the\ maximum\ weight\ that\ the\ player\ can\ carry\n comment6.params=itemName comment6.target=Item\ getItem(java.lang.String) comment6.text=\ Get\ an\ item\ from\ the\ players\ inventory.\n\ @param\ itemName\ -\ name\ of\ item\ to\ be\ picked\n\ @return\ an\ Item\ object\n comment7.params=itemName comment7.target=Item\ removeItem(java.lang.String) comment7.text=\ remove\ an\ item\ from\ the\ players\ inventory.\n\ @param\ itemName\ -\ name\ of\ item\ to\ be\ removed\n\ @return\ an\ Item\ object\n comment8.params= comment8.target=Room\ getcurrentRoom() comment8.text=\ accessors\ \ for\ the\ current\ room\ the\ character.\n\ @return\ currentRoom\n comment9.params=playing comment9.target=void\ setcurrentRoom(Room) comment9.text=\ a\ mutator\ for\ the\ current\ room\ of\ the\ character.\n\ @param\ playing\ for\ the\ Room\n numComments=14
Lap3/Room.java
Lap3/Room.java
import
java
.
util
.
HashMap
;
/**
* Class Room - a room in an adventure game.
*
* This class is part of the "Campus of Kings" application. "Campus of Kings" 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 doors. The doors are labeled north, east, south, west.
* For each direction, the room stores a reference to an instance of door.
*
*
@author
Mohammed ALharbi
*
@version
2018.1.26
*/
public
class
Room
{
/** Counter for the total number of rooms created in the world. */
private
static
int
counter
;
/** The name of this room. Room names should be unique. */
private
String
name
;
/** The description of this room. */
private
String
description
;
/**earn points */
private
int
points
;
/** directions hash map with directions keys and doors values */
private
HashMap
<
String
,
Door
>
directions
=
new
HashMap
<
>
();
/** directions hash map with room item's keys and items values */
private
HashMap
<
String
,
Item
>
roomItems
=
new
HashMap
<
>
();
/**
* Static initializer.
*/
static
{
counter
=
0
;
}
/**
* Create a room described "description". Initially, it has no exits.
* "description" is something like "a kitchen" or "an open court yard".
*
@param
name The rooms name.
*
@param
description
* The rooms description.
*/
public
Room
(
String
name
,
String
description
)
{
this
.
name
=
name
;
this
.
description
=
description
;
counter
++
;
}
/**
* Returns the name of this room.
*
*
@return
The name of this room.
*/
public
String
getName
()
{
return
name
;
}
/**
* Returns the description of this room.
*
*
@return
The description of this room.
*/
public
String
getDescription
()
{
return
description
;
}
/**
* Returns the door of this room.
*
@return
The door of this room
*/
public
Door
getDirection
(
String
direction
){
return
directions
.
get
(
direction
);
}
/**
* Return the rooms that have been created int the world.
*
@return
the rooms that have been created int the world.
*/
public
static
int
getCounter
(){
return
counter
;
}
/**
*
@return
getExit for getting the direction.
*/
public
int
getPoints
(){
int
point
=
points
;
points
=
0
;
return
point
;
}
/** Mutator for setting the points.
*
@param
newPoints
*/
public
void
setPoints
(
int
newPoints
){
points
=
newPoints
;
}
/**
* Set exit.
*
@param
direction
*
@param
neighbor
*/
public
void
setDirection
(
String
direction
,
Door
neighbor
)
{
directions
.
put
(
direction
,
neighbor
);
}
/**
* Add Item
*
@param
item - The item object to be added
*/
public
void
addItem
(
Item
item
)
{
roomItems
.
put
(
item
.
getName
(),
item
);
}
/**
* get Item
*
@param
name - The name of the item to be added to the room
*
@return
Item - The item in the collection with the key name
*/
public
Item
getItem
(
String
name
)
{
return
roomItems
.
get
(
name
);
}
/**
* Remove Item
*
@param
name - The name of the item to be removed from the room
*
@return
item - The item that has been removed from the room
*/
public
Item
removeItem
(
String
name
)
{
Item
item
=
roomItems
.
get
(
name
);
roomItems
.
remove
(
name
);
return
item
;
}
/**
* Returns a string description including all the details of a Room.
*Exits : north east south west
*
@return
A string representing all the details of a Room.
*/
public
String
toString
(){
String
roomInformation
=
""
;
roomInformation
+=
getName
()
+
" "
+
getDescription
()
+
"\n"
;
roomInformation
+=
"Exits : "
;
for
(
String
direction
:
directions
.
keySet
()){
roomInformation
+=
" "
+
direction
;
}
roomInformation
+=
"\nItems : "
;
for
(
String
item
:
roomItems
.
keySet
()){
roomInformation
+=
" "
+
item
+
", "
;
}
return
roomInformation
;
}
}
__MACOSX/Lap3/._Room.java
Lap3/Equippable.class
public abstract interface Equippable { public abstract String equip(Player); public abstract String unequip(Player); }
Lap3/Door.java
Lap3/Door.java
/**
* Class Door - a door or portal between two Rooms in an adventure game.
*
* This class is part of the "Campus of Kings" application. "Campus of Kings" is a
* very simple, text based adventure game.
*
* A "Door" represents a door or portal between two locations of the game.
* It stores a reference to the neighboring room and whether that door
* or portal is locked. Doors are not locked by default.
*
*
@author
Maria Jump
*
@version
2015.02.01
*/
public
class
Door
{
/** The room that this door leads to. */
private
Room
destination
;
/** Whether this door is locked. */
private
boolean
locked
;
/** the doorkey.*/
private
Item
doorKey
;
/**
* Constructor for the Door class.
*
@param
destination The room this door leads to
*/
public
Door
(
Room
destination
)
{
this
.
destination
=
destination
;
this
.
locked
=
false
;
this
.
doorKey
=
null
;
}
/**
* A getter for the room this door leads to.
*
@return
The room this door leads to
*/
public
Room
getDestination
()
{
return
destination
;
}
/**
* A getter for whether this door is locked.
*
@return
Whether this door is locked
*/
public
boolean
isLocked
()
{
return
locked
;
}
/**
* A setter for the key that opens a door.
*
@param
key Specifies the key to unlock the door
*/
public
void
setKey
(
Item
key
)
{
this
.
doorKey
=
key
;
}
/**
* A setter for the key that opens a door.
*
@return
the key that unlocks that door
*/
public
Item
getKey
()
{
return
doorKey
;
}
/**
* A setter for whether this door is locked.
*
@param
locked Whether this door is locked.
*/
public
void
setLocked
(
boolean
locked
)
{
this
.
locked
=
locked
;
}
}
__MACOSX/Lap3/._Door.java
Lap3/Equippable.java
Lap3/Equippable.java
/**
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*
*
@author
mohammed alharbi
*
@version
29/4/2018
*/
public
interface
Equippable
{
/**
* equip.
*
@param
p The current player instance
*
@return
message
*/
public
String
equip
(
Player
p
);
/**
* unequip.
*
@param
p - The current player instance
*
@return
message
*/
public
String
unequip
(
Player
p
);
}
Lap3/CommandWords.ctxt
#BlueJ class context comment0.target=CommandWords comment0.text=\n\ This\ class\ is\ part\ of\ the\ "Campus\ of\ Kings"\ application.\ "Campus\ of\ Kings"\ is\ a\n\ very\ simple,\ text\ based\ adventure\ game.\n\ \n\ This\ class\ holds\ an\ enumeration\ of\ all\ command\ words\ known\ to\ the\ game.\ It\ is\n\ used\ to\ recognize\ commands\ as\ they\ are\ typed\ in.\n\ \n\ @author\ Maria\ Jump\n\ @version\ 2015.02.01\n comment1.params=aString comment1.target=boolean\ isCommand(java.lang.String) comment1.text=\n\ Check\ whether\ a\ given\ String\ is\ a\ valid\ command\ word.\n\ \n\ @param\ aString\ The\ string\ to\ determine\ whether\ it\ is\ a\ valid\ command.\n\ @return\ true\ if\ a\ given\ string\ is\ a\ valid\ command,\ false\ if\ it\ isn't.\n comment2.params=theString comment2.target=CommandEnum\ getCommand(java.lang.String) comment2.text=\n\ Converts\ a\ String\ into\ a\ CommandEnum\ object.\n\ @param\ theString\ The\ String\ containing\ the\ command\ word.\n\ @return\ The\ CommandEnum\ object\ representing\ the\ command,\ or\ null\ if\ the\ command\ does\ not\ exist.\ \n numComments=3
Lap3/Reader.class
public synchronized class Reader { private static java.util.Scanner reader; public void Reader(); public static Command getCommand(); public static String getResponse(); public static String getResponseKeepCase(); static void <clinit>(); }
Lap3/Food.ctxt
#BlueJ class context comment0.target=Food comment0.text=\n\ To\ change\ this\ license\ header,\ choose\ License\ Headers\ in\ Project\ Properties.\n\ To\ change\ this\ template\ file,\ choose\ Tools\ |\ Templates\n\ and\ open\ the\ template\ in\ the\ editor.\ \n\ \n\ @author\ mohammed\ alharbi\n\ @version\ 29/4/2018\n comment1.params=name\ pointValue\ description\ weight comment1.target=Food(java.lang.String,\ int,\ java.lang.String,\ int) comment1.text=\n\ food.\n\ @param\ name\ the\ name.\n\ @param\ pointValue\ the\ pointValue.\n\ @param\ description\ teh\ description.\n\ @param\ weight\ teh\ weight.\n comment2.params=p comment2.target=java.lang.String\ eat(Player) numComments=3
Lap3/.DS_Store
__MACOSX/Lap3/._.DS_Store
Lap3/Weapon.class
public synchronized class Weapon extends Item implements Equippable { public void Weapon(String, int, String, int); public String equip(Player); public String unequip(Player); }
Lap3/World.java
Lap3/World.java
import
java
.
util
.
HashMap
;
/**
* This class represents the entire world that makes up the "Campus of Kings"
* application. "Campus of Kings" is a very simple, text based adventure game.
* Users can walk around some scenery. That's all. It should really be extended
* to make it more interesting!
*
* This world class creates the world where the game takes place.
*
*
@author
mohammed alharbi
*
@version
20/2/2018
*/
public
class
World
{
/** The rooms in the world. */
private
HashMap
<
String
,
Room
>
rooms
;
/**
* Constructor for the world.
*/
public
World
()
{
rooms
=
new
HashMap
<
String
,
Room
>
();
createRooms
();
createItems
();
}
/**
* item the item.
*/
public
void
createItems
(){
Item
toothbrush
=
new
Item
(
"tooth brush"
,
3
,
"Brushing teeth"
,
10
);
Item
toothpaste
=
new
Item
(
"tooth paste"
,
3
,
"Applied on a tooth brush"
,
20
);
Weapon
knife
=
new
Weapon
(
"knife"
,
5
,
"Peel and cut fruits"
,
100
);
Drink
coffee
=
new
Drink
(
"coffee"
,
7
,
"good for personal health"
,
150
);
Food
grapes
=
new
Food
(
"grapes"
,
10
,
"Good for health and hunger"
,
100
);
Container
purse
=
new
Container
(
"purse"
,
2
,
"Contains small small items"
,
100
);
Item
houseKey
=
new
Item
(
"house key"
,
5
,
"Open locked doors"
,
20
);
purse
.
addItem
(
houseKey
);
//car
Container
backBag
=
new
Container
(
"back bag"
,
10
,
"Carry things in"
,
200
);
Item
carKey
=
new
Item
(
"car key"
,
5
,
"Open locked doors"
,
50
);
Drink
water
=
new
Drink
(
"bottle of water"
,
8
,
"Quenches thirst"
,
250
);
//out of the house
Weapon
mopStick
=
new
Weapon
(
"broom stick"
,
5
,
"Pick items from the roof"
,
600
);
//keep street
Weapon
hammer
=
new
Weapon
(
"hammer"
,
6
,
"Can be used to fight wild animals"
,
1000
);
Container
bucket
=
new
Container
(
"water buckets"
,
15
,
"carry more items if back is full"
,
50
);
bucket
.
addItem
(
hammer
);
for
(
String
room
:
rooms
.
keySet
()){
switch
(
room
){
case
"bathroom"
:
getcurrentRoom
(
room
).
addItem
(
toothbrush
);
getcurrentRoom
(
room
).
addItem
(
toothpaste
);
break
;
case
"kitchen"
:
getcurrentRoom
(
room
).
addItem
(
knife
);
getcurrentRoom
(
room
).
addItem
(
coffee
);
getcurrentRoom
(
room
).
addItem
(
grapes
);
getcurrentRoom
(
room
).
addItem
(
purse
);
getcurrentRoom
(
room
).
getDirection
(
"south"
).
setLocked
(
true
);
getcurrentRoom
(
room
).
getDirection
(
"south"
).
setKey
(
houseKey
);
break
;
case
"out of the house"
:
getcurrentRoom
(
room
).
addItem
(
mopStick
);
getcurrentRoom
(
room
).
getDirection
(
"north"
).
setLocked
(
true
);
getcurrentRoom
(
room
).
getDirection
(
"north"
).
setKey
(
houseKey
);
break
;
case
"car"
:
getcurrentRoom
(
room
).
addItem
(
backBag
);
getcurrentRoom
(
room
).
addItem
(
water
);
getcurrentRoom
(
room
).
addItem
(
carKey
);
break
;
case
"keep street"
:
getcurrentRoom
(
room
).
addItem
(
bucket
);
break
;
default
:
}
}
}
/**
* This method takes care of creating all of the aspects of the world for
* the "Campus of Kings" application.
*
*
@param
name
* The provided name of the room.
*
@return
The room associated with the provided name
*/
public
Room
getcurrentRoom
(
String
name
)
{
return
rooms
.
get
(
name
.
toLowerCase
());
}
/////////////////////////////////////////////////////////////////////////////////////
// Start of private helper methods
/**
* Helper method for recreating a Room. Ensure that the room is created and
* installed in to the collection of Rooms.
*
*
@param
theRoom
* The room to add to the world.
*/
private
void
addRoom
(
Room
theRoom
)
{
rooms
.
put
(
theRoom
.
getName
().
toLowerCase
(),
theRoom
);
}
/**
* Helper method for creating doors between rooms.
*
*
@param
from The room where the door originated.
*
@param
direction The direction of the door in the from room.
*
@param
to The room where the door goes.
*/
private
void
createDoor
(
Room
from
,
String
direction
,
Room
to
){
Door
door
=
new
Door
(
to
);
from
.
setDirection
(
direction
,
door
);
}
/**
* This method creates all of the individual places in this world and all
* the doors connecting them.
*/
private
void
createRooms
()
{
// Creating all the rooms.
int
pointScore
=
0
;
Room
bathroom
=
new
Room
(
"Bathroom"
,
"there is teeth brush, shower place."
);
Room
kitchen
=
new
Room
(
"Kitchen"
,
"there are two doors, one the way to go out of the house. The second door the way to the living room.."
);
Room
outOfTheHouse
=
new
Room
(
"out Of The House"
,
"the way outside the house to drive to university.."
);
outOfTheHouse
.
setPoints
(
10
);
pointScore
=
pointScore
+
10
;
Room
car
=
new
Room
(
"Car"
,
"inside the car, back bag, car key with house key.."
);
car
.
setPoints
(
7
);
pointScore
=
pointScore
+
7
;
Room
keepStreet
=
new
Room
(
"keep Street"
,
"the correct way."
);
Room
turnLeft
=
new
Room
(
"Turn left"
,
"wrong way to go with it.."
);
Room
endOfTheRoad
=
new
Room
(
"End of the road"
,
"closed way."
);
Room
gasStaion
=
new
Room
(
"Gas Staion"
,
"the way to traffic signal."
);
Room
trafficSignal
=
new
Room
(
"Traffic signal"
,
"there are three different ways."
);
trafficSignal
.
setPoints
(
10
);
pointScore
=
pointScore
+
10
;
Room
turnLeft2
=
new
Room
(
"Turn left2"
,
"maybe not the right way."
);
Room
wrongWay
=
new
Room
(
"Wrong way"
,
"it will take long time to reach the goal."
);
Room
turnRight
=
new
Room
(
"Turn right"
,
" more traffic."
);
Room
closedWay
=
new
Room
(
"Closed Way"
,
"no place to go."
);
Room
keepGoing
=
new
Room
(
"KeepGoing"
,
"almost arrive to university."
);
keepGoing
.
setPoints
(
10
);
pointScore
=
pointScore
+
10
;
Room
parking
=
new
Room
(
"Parking"
,
"there is a meter parking, 2$ in Hour."
);
parking
.
setPoints
(
17
);
pointScore
=
pointScore
+
17
;
Room
library
=
new
Room
(
"Library"
,
"some books, students, printer, computers."
);
Room
campusCenter
=
new
Room
(
"Campus Center"
,
"office for the activity, mailboxes, four floors"
);
Room
hallCampus
=
new
Room
(
"Hall Campus"
,
"the building for men."
);
Room
hBuilding
=
new
Room
(
"H Building"
,
"Five floors, elevator, six classrooms"
);
Room
square
=
new
Room
(
"Square"
,
"the place in the middle of the university, and from there the player can go any building."
);
square
.
setPoints
(
12
);
pointScore
=
pointScore
+
12
;
Room
mCBuilding
=
new
Room
(
"MCBuilding"
,
" Classes, six floors."
);
Room
aBuilding
=
new
Room
(
"A Building"
,
": the goal to reach the class, stairs, elevator, classroom."
);
Room
stairs
=
new
Room
(
"Stairs"
,
"take the player until fourth floor."
);
stairs
.
setPoints
(
18
);
pointScore
=
pointScore
+
18
;
Room
elevator
=
new
Room
(
"Elevator"
,
"take the player until fourth floor."
);
Room
floor2
=
new
Room
(
"2Floor"
,
"entry for classes"
);
Room
classroom
=
new
Room
(
"Classroom"
,
"one door, blackboard, tables"
);
Room
classroom201
=
new
Room
(
"Classroom201"
,
"you reach the goal."
);
classroom201
.
setPoints
(
30
);
pointScore
=
pointScore
+
30
;
Room
classroom204
=
new
Room
(
"Classroom204"
,
"one door, students."
);
Room
classroom202
=
new
Room
(
"Classroom202"
,
"blackboard, table, students."
);
// Adding all the rooms to the world.
this
.
addRoom
(
bathroom
);
this
.
addRoom
(
kitchen
);
this
.
addRoom
(
outOfTheHouse
);
this
.
addRoom
(
car
);
this
.
addRoom
(
keepStreet
);
this
.
addRoom
(
turnLeft
);
this
.
addRoom
(
endOfTheRoad
);
this
.
addRoom
(
gasStaion
);
this
.
addRoom
(
trafficSignal
);
this
.
addRoom
(
turnLeft2
);
this
.
addRoom
(
wrongWay
);
this
.
addRoom
(
turnRight
);
this
.
addRoom
(
closedWay
);
this
.
addRoom
(
keepGoing
);
this
.
addRoom
(
parking
);
this
.
addRoom
(
library
);
this
.
addRoom
(
campusCenter
);
this
.
addRoom
(
hallCampus
);
this
.
addRoom
(
hBuilding
);
this
.
addRoom
(
square
);
this
.
addRoom
(
mCBuilding
);
this
.
addRoom
(
aBuilding
);
this
.
addRoom
(
stairs
);
this
.
addRoom
(
elevator
);
this
.
addRoom
(
floor2
);
this
.
addRoom
(
classroom
);
this
.
addRoom
(
classroom201
);
this
.
addRoom
(
classroom204
);
this
.
addRoom
(
classroom202
);
// Creating all the doors between the rooms.
this
.
createDoor
(
bathroom
,
"east"
,
kitchen
);
this
.
createDoor
(
kitchen
,
"west"
,
bathroom
);
this
.
createDoor
(
kitchen
,
"south"
,
outOfTheHouse
);
this
.
createDoor
(
outOfTheHouse
,
"north"
,
kitchen
);
this
.
createDoor
(
outOfTheHouse
,
"west"
,
car
);
this
.
createDoor
(
car
,
"east"
,
outOfTheHouse
);
this
.
createDoor
(
car
,
"south"
,
keepStreet
);
this
.
createDoor
(
keepStreet
,
"north"
,
car
);
this
.
createDoor
(
keepStreet
,
"west"
,
turnLeft
);
this
.
createDoor
(
turnLeft
,
"east"
,
keepStreet
);
this
.
createDoor
(
turnLeft
,
"south"
,
endOfTheRoad
);
this
.
createDoor
(
endOfTheRoad
,
"north"
,
turnLeft
);
this
.
createDoor
(
keepStreet
,
"south"
,
gasStaion
);
this
.
createDoor
(
gasStaion
,
"north"
,
keepStreet
);
this
.
createDoor
(
gasStaion
,
"east"
,
trafficSignal
);
this
.
createDoor
(
trafficSignal
,
"west"
,
gasStaion
);
this
.
createDoor
(
trafficSignal
,
"north"
,
turnLeft2
);
this
.
createDoor
(
turnLeft2
,
"south"
,
trafficSignal
);
this
.
createDoor
(
turnLeft2
,
"north"
,
wrongWay
);
this
.
createDoor
(
wrongWay
,
"south"
,
turnLeft2
);
this
.
createDoor
(
trafficSignal
,
"south"
,
turnRight
);
this
.
createDoor
(
turnRight
,
"north"
,
trafficSignal
);
this
.
createDoor
(
turnRight
,
"south"
,
closedWay
);
this
.
createDoor
(
closedWay
,
"north"
,
turnRight
);
this
.
createDoor
(
trafficSignal
,
"east"
,
keepGoing
);
this
.
createDoor
(
keepGoing
,
"west"
,
trafficSignal
);
this
.
createDoor
(
keepGoing
,
"east"
,
parking
);
this
.
createDoor
(
parking
,
"west"
,
keepGoing
);
this
.
createDoor
(
parking
,
"southwest"
,
library
);
this
.
createDoor
(
library
,
"northeast"
,
parking
);
this
.
createDoor
(
library
,
"east"
,
campusCenter
);
this
.
createDoor
(
campusCenter
,
"west"
,
library
);
this
.
createDoor
(
parking
,
"south"
,
square
);
this
.
createDoor
(
square
,
"north"
,
parking
);
this
.
createDoor
(
square
,
"east"
,
hallCampus
);
this
.
createDoor
(
hallCampus
,
"west"
,
square
);
this
.
createDoor
(
square
,
"west"
,
hBuilding
);
this
.
createDoor
(
hBuilding
,
"east"
,
square
);
this
.
createDoor
(
square
,
"southeast"
,
mCBuilding
);
this
.
createDoor
(
mCBuilding
,
"northwest"
,
square
);