/* User sessions new user: creates an account. Ask for a username and password //readline(), getUserName(), getPassword() then signs in. new user starts at Harris for New Student Orientation. registered user: signs in. Check the world to see what room the user was in the last time. [String getLastLocation(String username)] Call the user's stats and inform the user how many turns he/she has left. [int getUserStats(String username)], [int getUserTurns(String username)] The user is asked where he wants to go (South Campus, North Campus, East Campus). [pickCampus()] The event manager is called and the user is informed of the options of buildings and events. [Array listBuildings()] The user picks a building [void pickBuilding()] The user chooses a room. [void pickRoom()] Give a description of items in the room. [Array describeItems(String room)] If there are fewer than 20 other users in the room [int getNumberOfUsers(String room)], the user goes into the selected room. Otherwise the user must choose another room. [void pickAnotherRoom()] A list of objects is given to the user as well as the actions that he can perform (talk, learn from professor, drink, etc.) [Array describeObjects(String room)] The user begins to pick objects. [void pickItem(String username)] We keep track of the items picked up. [void recordItems(String username)] We then update the user's stats. Certain objects have more value than others(determined by World) [void setStats(String username)] If the user tries to pick up too many objects, or goes beyond the size limit, he is informed that his backpack is full. [println("No more room in your backpack. Discard an item.")] User keeps performing actions like bodybuilding, resting, learning, and drinking until he runs out of turns for the day or he decides to log out. a. interactWith: Advantages * less typing * less work for the world (possibly overburdened) Disadvantages * the commands are less centralized interact: Advantages * centralized commands Decision: use interact(String actor, String verb, String target) b. Use objects. It's easier to not have to worry about the string. c. World * boolean signIn(String username, String password) -if username matches with password, sign in user * boolean isValid(String username, String password) username = getUserName() // getUserName involves readline() password = getPassword() // getPassword involves readline() * String getLastLocation(String username) * int getUserStats(String username) * int getUserTurns(String username) * Array listBuildings() * void pickBuilding() * void moveToRoom(String room) * void interact(String actor, String verb, String target) * boolean isCapable(String actor, String verb) Place * void pickRoom() * int getNumberOfUsers(String room) * Array listObjects(String room) * void pickUpItem(String item) * void recordStatOfObject(String room) // record these in an array * void removeObject(String item) Person * void addToInventory(String item) * void increasedSkill(String skillcategory, int numincrease) * void useItem(String item, String target) * void pickItem(String username) * void setStats(String username) Thing * String describeMyself(String item) * boolean useableItem(String item, String verb) d. When interacting, the world informs the target that a user has performed an action on the person. */ /* User Interface Group a. Describe, as precisely as you can, what valid user input should look like. (For example, many systems use a verb/object metaphor, such as "grab book" or "say 'Run away!'" or "Smash Sam".) Valid user input should be in the form "verb, object, modifier" or "verb, object," where the verb is in the present imperative form. For example, eat pizza 3 means that the user eats three slices of pizza. Our reading and parsing will be case-insensitive. b. Think about the steps that will have to happen when the user "logs in" and what objects need to know about other objects. (Think about the series of method calls, similar to those we went over in class.) 1. User logs in. 2. UI reads name and password with public void readStuff() and passes that to World through the server. 3. World checks username and password with private boolean isValid(string username, string password). 4. World passes either true or false to user interface. 5. If true, UI declares that user is logged in and initiates session. If false, UI throws an InvalidAccountException 6. UI reads input with public void readStuff() and checks if action is valid. Action must be in arrayOfActions. If not, UI throws an InvalidActionException. 7. If the input is valid, UI calls interact(String actor, String verb, String target), which returns a string. c. List the basic verbs you would like our system to support: eat, pickup, drop, smash, sleep, drink, shout, talk, leave, goto, examine, give, throw, wield d. List synonyms for those verbs: eat OBJ = devour, digest, bite, chew, consume pickup OBJ = get, take, grab, steal, swipe, lift drop OBJ = release, let go, discard, throw away smash OBJ = bash, destroy, hit, decimate sleep = rest, pass out, hibernate, snooze, go to bed drink OBJ = chug, swallow shout OBJ = yell, scream talk STRING = say, speak goto NAMEOFLOCATION = enter examine OBJ = lookat, inspect give OBJECT to PERSON = pass throw OBJECT = toss wield OBJ = grab Emotes smile at PERSON frown at PERSON e. Plan the user interface for world builders. What methods will you need World to provide to allow you to build or extend the world? We need a public boolean IsValid(String username, String password) method that checks if a user's password and username is valid. We need a public String[] getArrayOfActions() method which gets the array of possible actions that a user can perform. We also need an public String interact(String username, String verb, String object) method. We need broadcast(String) to deal with emote actions. */