/****
* Person
*
* is the one moving through the rooms.
*
***/
class Person {
private Room currentLocation;
private String name;
Person(String who, Room startingRoom){
currentLocation = startingRoom;
name = who;
}
void status(){
System.out.println(
"\n You are in "+currentLocation.getShortDescription()+".");
}
void moveTo(int whichWay){
if ( currentLocation.doorTo[whichWay] == null ){
System.out.println(" Oops - you can't move that way.\n");
}
else {
currentLocation = currentLocation.doorTo[whichWay];
System.out.println(" You walk " + Room.directions[whichWay]+".");
}
}
void look(){
System.out.println("\n You look around you and see the following.");
System.out.println(currentLocation.getLongDescription());
}
}
syntax highlighted by Code2HTML, v. 0.9.1