public class Player
extends java.lang.Object
Constructor and Description |
---|
Player(java.lang.String name)
Constructor for objects of class Player
|
Modifier and Type | Method and Description |
---|---|
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
|
public Player(java.lang.String name)
name
- the player's namepublic boolean takeTurn()
public boolean processCommand(Command command)
command
- the command to be processed.public java.lang.String printHelp()
public void goRoom(Command command)
command
- the Command object which caused the player to navigatepublic java.lang.String getName()
public void setName(java.lang.String name)
name
- the new name for the playerpublic Room getCurrentRoom()
public void setCurrentRoom(Room currentRoom)
currentRoom
- the room in which the player is to be located