
// CommandWords.java
// Andrew Davison, Nov 2018, ad@fivedots.coe.psu.ac.th


/* This class holds an array of all the command words in the game.
   It is used to recognise user commands.
 
 * @author  Michael Kolling and David J. Barnes
 * @version 2006.03.30
*/


public class CommandWords
{
  // a constant array that holds all the valid command words
  private static final String[] validCommands = {"go", "quit", "help"};


  public CommandWords()
  {  // nothing to initialize
  }


  public boolean isCommand(String cmdWord)
  {
    for (int i = 0; i < validCommands.length; i++) {
      if (validCommands[i].equals(cmdWord))
        return true;
    }
    // command word was not found in the list of valid commands
    return false;
  }  // end of isCommand()

}  // end of CommandWords class
