SYSC 2004 Lecture Notes - Lecture 3: Interactive Fiction

27 views1 pages

Document Summary

* this class is part of the "world of zuul" application. * "world of zuul" is a very simple, text based adventure game. * this class holds an enumeration of all command words known to the game. * it is used to recognise commands as they are typed in. * @author michael kolling and david j. barnes. * @version october 21, 2012 public class commandwords. // a constant array that holds all valid command words private static final string[] validcommands = { "go", "quit", "help" , "look" , "eat" ,"back" ,"stackback" * constructor - initialise the command words. public commandwords() * check whether a given string is a valid command word. * @return true if it is valid, false otherwise public boolean iscommand(string astring) for(int i = 0; i < validcommands. length; i++) { if(validcommands[i]. equals(astring)) return true; // if we get here, the string was not found in the commands return false;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents