-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandWord.java
More file actions
44 lines (41 loc) · 1001 Bytes
/
CommandWord.java
File metadata and controls
44 lines (41 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Representations for all the valid command words for the game
* along with a string in a particular language.
*
* @author Michael Kölling, David J. Barnes and Thomas Vakili
* @version 2013.12.12
*/
public enum CommandWord
{
// A value for each command word along with its
// corresponding user interface string.
GO("go"),
QUIT("quit"),
HELP("help"),
PICKUP("pickup"),
DROP("drop"),
INVENTORY("inventory"),
SEARCH("search"),
TELEPORT("teleport"),
LOOK("look"),
FIGHT("fight"),
HIDE("hide"),
UNKNOWN("?");
// The command string.
private String commandString;
/**
* Initialise with the corresponding command string.
* @param commandString The command string.
*/
CommandWord(String commandString)
{
this.commandString = commandString;
}
/**
* @return The command word as a string.
*/
public String toString()
{
return commandString;
}
}