java.lang.ObjectPlayer
public class Player
Represents a player in the game
Constructor Summary | |
---|---|
Player(java.lang.String name)
Constructor for objects of class Player |
Method Summary | |
---|---|
Room |
getCurrentRoom()
Returns the room in which the player is currently located |
java.lang.String |
getName()
Returns the name of this player |
void |
goRoom(Command command)
Try to go to one direction. |
java.lang.String |
printHelp()
Print out some help information. |
boolean |
processCommand(Command command)
Given a command, process (that is: execute) the command. |
void |
setCurrentRoom(Room currentRoom)
Sets the room in which the player is to be located |
void |
setName(java.lang.String name)
Set a new name for this player |
boolean |
takeTurn()
Take the player's turn in the game |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Player(java.lang.String name)
Method Detail |
---|
public Room getCurrentRoom()
public java.lang.String getName()
public void goRoom(Command command)
public java.lang.String printHelp()
public boolean processCommand(Command command)
command
- the command to be processed.
public void setCurrentRoom(Room currentRoom)
currentRoom
- the room in which the player is to be locatedpublic void setName(java.lang.String name)
name
- the new name for the playerpublic boolean takeTurn()