Objects and Design
Objects and Design CS 2340
Popular in Course
Popular in ComputerScienence
This 0 page Class Notes was uploaded by Alayna Veum on Monday November 2, 2015. The Class Notes belongs to CS 2340 at Georgia Institute of Technology - Main Campus taught by Staff in Fall. Since its upload, it has received 11 views. For similar materials see /class/234140/cs-2340-georgia-institute-of-technology-main-campus in ComputerScienence at Georgia Institute of Technology - Main Campus.
Reviews for Objects and Design
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 11/02/15
Class AGObject This class creates instances of both takeable and nontakeable objects objects that can be taken by an AGPlayer object ie kitten knives hammer etc Class instances store what room or player contains it Instances also send messages to the world object when prompted by the aforementioned objects ATTRIBUTES Class variables CharCollection Instance variables accepted aObjContainer inside myVerb obj Stats myVerb specialCollection specialChar container hasContainer takeable surface surfaceContainerList tempCollection tempDict hasSurface whatHoldsMe aWorld indirectCollection volume W accept quotPasses this method to surfaces methodquot addBehavior adds this behavior to this charquot contain Adds object to container container quotMethod returns the room currently containing the AGObjectquot doVerb Tells instance to do the argument drop Removes object form instance s container getBehavior quotreturns the behavior Whose rule corresponds to the one passed inquot makeContainer quotCreates a container for class instancesquot makeNotTakeable quotMakes object nontakeablequot MakeSurface quotCreates a surface to place other objects on makeTakeable quotMakes object takeablequot on quotPlaces this object on an object that has a surfacequot pickUp quotPicks up object and places it into intance s container Same as contain method quot sent verbHandler verbMatch do when do acce ptO bj ect checkContainment event getAll getBehaviorEvents getContainer getDescription getFirstLevel getIndirectCollection getLimit getSomeName getSurface checked getSurfaceLimit AGObject cont d quotReturns whether or not an object has been sent to this class instancequot quotPasses valid verbs from the vocabulary to verbMatcherquot Method sets what the AGObject is to do when a verb from the simple vocabulary is passed to it quotPerforms do block based on when blockquot PRIVATE METHODS quotSets accept to truequot quotChecks to see ifthis object has a containment and if so prints it out quotNoti ed when an event has occurredquot quotReturns all that this object contains or is on its surfacequot quotgets all the behavior events of this characterquot quotReturns the container and it s contentsquot quotReturns the short descriptionquot quotGets the rst level only if its a surfacequot quotReturns the indirectCollection of this instancequot quotreturns the limit of this containerquot quotGoes through the objects surface collection as well as the objects containers collection searching for the object that corresponds to the name someName and returns that object or false otherwisequot quotReturns surface object of instance In another method I to see if instance hasSurfacequot quotreturns the surfaceLimit of this objectquot getTempCollection getTempDict getVerbDict getW orld has hasBeenAccepted hasContainer hasSurface in indirectVerbMatchandzdo isTakeable makeContainerActorwonder outquot name processAGEvents case processEvents reInit setAcceptO bject setContainer setIndirectCollection setName setSurfaceLimitznumber AGObject cont d quotReturns the objects tempCollectionquot quotReturns this temps dictionary quotReturns the verb dictionary for that instancequot quotReturns the world this object belongs toquot quotChecks this objects containersurface for someObjquot quotReturns boolean as to whether of not object has been accepted quot quotBoolean returns whether or not container has a container quot quotReturns a boolean as to whether of not instance has surfacequot quotputs this instance self into objectquot Sent to the instance Block get the player object the world and can do anything it wants quotReturns boolean as to whether of not object is takeablequot quotchecks to see if this object has a containment and if so prints it quotReturns the name of the objectquot quotUsed to process AGDaemon events of this object should in it was in a surfacecontainerquot quotUsed to process the events of this objectquot quotUsed to initialize the verb de nitionsquot quotUsed to set the acceptance value of objectquot quotSets the room currently containing the objectquot quotReturns the indirect Collection of this instancequot quotSets the name of the AGObjectquot quotsets the limit of this objects surfacequot Team Name CSKhwar Mo ammad39 S K an gte713m Mo ammacf Z K an gte714m Qaurav K anna gte769m Pawn nga gte391v CRC Cards for design Class AGCharacter Responsibilities Collaborators The character has to know where he is in the game It has to be able to move to different sections in the game It should be able to interact with the player and objects AGRoom AGWorld Class AGPlayer Responsibilities Collaborators It has to play the game It has to know where it is in the game It has to be able to interact with the other characters It has to keep a track of objects that has and should be able to use them AGContainer AGRoom Class AGWorld Responsibilities Collaborators It has to start the game AGPlayer It has to know that current state of AGRoom the game InterfaceHandler It has to be able to include AGObject characters in the game and interact AGCharacter with the player WordMatcher CRC Class AGObject Responsibilities Collaborators It has to know where it is in the AGContainer game ie the location AGRoom AGWorld It has to be able to interact with the player when it wants to use it Class AGRoom Responsibilities Collaborators It has to keep track of all the objects AGWorld in the room AGObject It has to know what characters are AGCharacter in the room at a particular point in AGPlayer the game It has to know about the other AGRooms attached to it CRC Class InterfaceHandler Responsibilities Collaborators It has to display the UI AGWorld It has to show what the user types and also the feedback from the WebPlay game It has to show what is going on in the game Class WebPlay Responsibilities Collaborators It has to make the game playable over the web InterfaceHandler It has to cater for multiple players players playing over the net Class WordMatcher Responsibilities Collaborators It has to recognize the text that the AGWorld user inputs Uses given rules to match the input Class AGDaemon Responsibilities Collaborators Interact with objects that are not part of the world Start the objects Stop the objects AGOb j e ct CRC Class AGInteractivePlayer Responsibilities Collaborators Talk to the characters Interact with the other characters AGCharacter Class AGC ontainer Responsibilities Collaborators Allow objects to contain things It should be able to add objects It should be able to drop objects It can contain containers as well Rejected Classes ClasslAGIndirectObject Responsibilities Collaborators It has to enable indirect objec to recognize actions being done 0 them OlaK Ynteracti on Responsibilities ollaborators Responsible for the interac 39 between the player all the objects all the characters and the containers It will have to determi A ayer GCharacter GOb j e cts CRC ClassWr Responsibilities Collaborators It has to make the objects tak or not takeable It has to enable the objects to t other objects bject ClaWoryList Responsibilities Allaborators It will have to keep an acco of all the objects with the players It will have to add the objec are picked up It will have to re that are dispo e the objects CIaSSWHandung Responsibilities Collaborators Process the input from the p r layer Determine if he used a verb Determine what class should the verb be applied to Determine the behaVi ClassMcription Responsibilities Collaborators It has to assign descriptions g A oom descriptions names to the GCharacter characters objects players an Player rooms AG 39ect CLASS DESCRIPTIONS Class Name AGObject Every object will have a unique name a description and a long description This class represents all the objects that are being used in the game The player would be able to take and use these objects and these objects will also interact with the characters These Objects would be placed in certain locations in the game These objects would know how would they be used and where actually would they be used These Objects will thus support a simple vocabulary that is some basic words that will trigger different behaviors and also a advanced vocabulary that will also trigger these events but based on the synonyms of the actual verbs Class Methods named This method will give the different objects their actual names by which they will be identi ed in the program Instance Methods description This message will be give the object a short description longdescription This message will give the object a long Description that will describe the object in more detail verbMatchd0 This method is for the verbs that can be used on the AGObject by the user For different verbs the AGObj ect will do different things verbHamller This method is for the handling of synonyms of the verbs that were matched in the verbMatch After the synonym is recognized the AGObject will do what it was supposed for the original verb getDescription This method will return the description getDictionary This method will return the dictionary getLongDescription This method will return the Long Description accept The parameter for the method is It is used to put something on the surface on an object that has makeSurface doVerb The parameter is a verb object It tells you to do the argument of a particular verb indirectVerbMatchandd0 This method is called when something gets put into something container returns the AGRoom This method will enable the AGObject to know which Room is it contained at any point in the game This method will return the AGRoom which is the container for the AGObject setPlayer aPlyer This method make the aPlayer the associate AGPlayer object ie this AGObject will belong to the aPlayer and will be in his inventory whereby he can also use it setRoom aRoom This methods will make the aRoom as the associated AGRoom object for the AGObject The reason being that now the AGObject will belong to the AGRoom sent If this method is called with the object name as the parameter then it will enable objects to be added to the other objects such that the newly added objects are not in the end but also on the toffees u eat setWorltl39 aWorld This method will make the aWorld as the current AGWorld object being associated with the AGObject destroy This will destroy the AGObject and remove it from the game such that it will never be represented again in the game makeTakeable Thie method takes in a C le for parameters Ths will enable the AGObject to take other objects in it so that they become associated makeNotTakeable The parameter for this method in an Object They will remove the associate of the object with the message so that it contaic makeSurface This method will take in the object name as the parameter This will enable them to put stuff onto them and min u not pusing or doing whatever with ur perverted mentality Class Name AGRoom Every room will have a name a description and a long description The game will contain multiple rooms and the rooms by itself can be in other rooms and attached to other rooms These rooms would have objects in them and they will also know what are the characters present in the room at a given time in the game While the AGPlayer is in the room it can have certain objects that can only be used in this room on certain characters Class Methods named This method will assign the AGRoom an actual name that will be used in the game new This will initialize everything making a clean AGRoom Instance Methods description This method will give the AGRoom a short description that will be displayed longDescription This method will give the AGRoom a long description that give a detailed description when the AGRoom is looked upon roomAt direction This method will return the room which is at the direction getDescription This method will return the description getLongDescription This method will return the long description initialize This initialize everything such that AGRoom does not have anything associated with it anymore to direction attach aRoom This method will attach another AGRoom to the current AGRoom at the speci ed position contain This method will add the speci ed AGCharacter or the AGObject to the AGRoom objects This method will return a list of all the AGObjects that are contained in the AGRoom when the method is called in the game characters This method will return a list of all the characters that are present in the AGRoom at the time when the method is called has This method tells you if the AGRoom has the speci ed AGObject AGCharcter or the AGPlayer in it or not processEvents Executes the when do block for all objects and characters in the room currentRoom This method returns the current room that the player is in Class Name AGCharacter Every character will have a name a character and a long description The characters would be able to interact with the objects that are used on them and they will also interact with the user The characters will know where they are in the game at a certain time These characters will have varying degrees of behaviors associated with them Such as there would be varying degrees of violent behavior for the AGCharacter troll depending on the ag block being set in Class Methods named aString This will assign a name to the AGCharacter that will be used to identify it new This message will initialize the AGCharacter Instance Methods container This message will return the AGRoom the AGCharacter is residing in at the moment description asString This method will assign to a description object a short de nitions destroy This will kill the current AGCharacter object such that its not able to use it in the game die This will change the status of the AGCharacter to daed such that the description changes and you are able to see the descrption of your family ag variable value properties This method will change the behavior for AGCharacter The degree of the change is also sent in the method as the property initialize This method will initialize the variables and properties associate with the AGCharacter getBlockDictionary This method will return the BlockDictionary getDescription This method will return the description getLongDescription This method will return the long description longDescription aString This method will assign the long description to the AGCharacter Thus if the player looks at it or in other appropriate circumstances the detailed description is shown name This will return the name of the current AGCharacter named This method will assign a name to the AGCharacter getPlayer This method will return the current player ie MyPlayer associated with the game setPlayer aPlayer This method will set the aPlayer to the AGCharacter such that it is associated with the AGCharacter Thus this AGCharacter will belong to the AGPlayer and not the AGRoom setRoom aRoom This method will set the aRoom to the AGCharacter This will associate it to the AGCharacter to the AGRoom instead of the AGPlayer setWorltl39 aWorld This method will associate the aWorld to the AGCharacter when conditionBlock d0 executionBlock This method will determine what the AGCharacter will do The condition block that is passed to will determine the behavior conditions and based on that will determine what is action that will be taken by the AGCharacter Class Name AGWorld The world will have a name It will start the game by adding all the Rooms and de ning the starting point of the game The AGWorld class will also end the game and tells the player what is actually going by sending the output Thus the AGWorld will also have the information for the current game that is what state is it in The class will also send feedback to the AGPlayer through the InterfaceHandler It will also process the message that it will receive from the InterfaceHandler ClassMethods named This will assign the AGWorld a name that will be used to identify it new This will initialize the AGWorld Object start This will basically start the new game as all the lists are initialized and everything is cleared Instance Methods add aRoom This method takes in the aRoom as the parameter as adds to the AGWorld so that it becomes part of the game initialize This method will initialize the UI and the collection of the stored object so that a completely new AGWorld is available name This method returns the name of the AGWorld that is being used for the game named aString This method will assign aString as the name to AGWorld so that it can be identi ed nextRoom aRoom This method will be used when the AGPlayer moves from one room to another room myRoom is assigned aRoom making it the current AGRoom print aString This method send feedback to the user as the interface is set to the aString This string will then be displayed on the UI for the AGPlayer processCommaml39 message This is the processing that is required for the game when the message comes in from the InterfaceHandler webstart This will start the web related part of the game Whereby a user would be able to start a web game webstop This will stop the web related UI for the adventure game quit This method will quit that is end the game and the program eXits Class Name AGPlayer This is the player that is actually playing the game It will interact with the objects pick them use them drop them and travel in different rooms The players can interact with the character also and will know where he is in the game at a certain point Class Methods named aString This will assign a name to the AGPlayer which will be used to identify the player in the game This will make a new instance of the AGPlayer intilializes all the things that need to be Instance Methods container This will return the current AGRoom that the player is in initialize This method is used for initializing the current AGPlayer object getInventmy This method meant that you returen the glossary removeObject aObject This method will remove the object aObject from the inventory name This method will return the name of the current AGPlayer named aString This method assigns the name to the current AGPlayer pickup aObject This method will add the AGObject to the inventory of the AGPlaper so that he knows that he has and can use it setRoom aRoom This will set a room from the current list for the current AGPlayer Class Name WordMatcher This is the basic class that would be interacting with the AGWorld so that it can handle the stuff that is being entered by the user This two main methods for the class are addRule that takes in a string and match that also takes in a string Based on a speci c set of rules the WordMatcher will be performing different tasks Instance Methods addRule This method takes in a String as the parameter After taking in the string the method will parse the String based on the rules that have been defined in respect to the game After parsing it the relevant tokens will be stored in a data structure match This method takes in a String as the argument This string would be the one that needs to be matched with the initial collection If the match is successful then this message will be returned and depending on the situation in the game other things could be performed Class Name AGContainer This class will serve as the parent class for AGRoom AGPlayer and AGObj ect As all these three classes have the ability to contain sutff in them the class will let them contain the methods Instance Methods pickup The parameter for this method is an AGObject This method will enable the concerned AGObject to pick up stuff This will add to the inventory for the player contain This method takes in an object or a character This will add the objects to the AGContainer When this method would be called on a Object it will add the object to it so that they can become associated drop This method takes a AGObject parameter This will remove the association of the AGObject with the related AGObject AGRoom or AGPlayer giveList This method takes in either AGPlayer AGObject or AGRoom as the parameter It will look up what are the associated objects with the concerned objects and then return them as an Ordered Collection Class Name AGDaemons This class is responsible for the characters that are not part of the world The Daemons are basically objects and they will understand stepDo startTicking and stopTicking messages from the AGWorld Thus the class would enable messages delivered to the Daemons so that they can be started and stopped Before AGDaemons to be used it would be pre requisite that the Daemons are initialized with a ag ths would determine their characteristics Instance Methods This method will make a new instance of Daemons so that they can be used initialize This method will initialize all the attributes that are related to the Daemons stepDo As the Daemons are called upon they will be step messages such that they are told what they need do after every turn The parameter would be a block startTicking This will take the name of the Daemon as the parameter and tell the Daemon to start itself stopTicking This will take the name of the Daemon as the parameter and tell the Daemon to stop itself Class Name WebPlay This class deals with the web playability that is being provided by the game The class will containt methods and code that will enable the game over the net using the UI Instance Methods initialize This will basically set all the variables attributes that are associated with the class They will be set to their default valuies open This method will open the webPlay for communication so that it can be used for a game over the intemet RODENTS OF UNUSUAL SIZE Muntaqa Peracha gteS79t Shehzad Ashfaq gte871m Bharti Agarwal gteOS9X Robert Schierholz gte 1 63m NOTE Bold and Italics represent new changes made since M5 CRC Class AGEvent Responsibilities Collaborators Performs an event when the user AGObject enters the correct verb followed by its object Also checks for indirect verbs CRC Class AGCharacter Responsibilities Collaborators Checks its events to be performed AGPrePlannedEvent Handles user setup of characters AGRoom Manages interactions when player AGPlayer queries it CommandParser Manages Talking between Player and Character Class AGObject Responsibilities Collaborators Handles user setup AGWorld Helps in the handling of events AGEvent CRC Class AGSurface Responsibilities Collaborators Handles user setup AGWorld Helps in the handling of events AGE vent Supports layering of objects AGObject CRC Class AGC ontainer Responsibilities Collaborators Handles user setup AGWorld Helps in the handling of events AGE vent Supports containment of objects AGObject CRC Class AGPlayer Responsibilities Collaborators Moves itself throughout the world AGRoom Query character AGObject PicldTake Drop Put objects CommandParser Handles actions Class AGPrePlannedEvent Responsibilities Collaborators Handles the character s events AGCharacter Setups the events CRC Class AGRoom Responsibilities Collaborators Adds objects AGObject Adds characters AGCharacter Adds Daemons AGDaemon Accesses objects CommandParser Accesses characters Setup the layout Handles all the when do blocks Class AGWorld Responsibilities Collaborators Prints to the UIWebUI ServerGameAction Adds rooms to the game AGRoom Creates the player AGPlayer Passes commands to parse through CommandParser Starts the game in normal or web UIToPlay UI AGDaemon Quits the game from normal or web Tells daemon when a turn has occured CRC Class CommandParser Responsibilities Collaborators Parses user input AGWorld Able to add rules to the vocabulary AGPlayer Allows player to interact with WordMatcher character AGCharacter Class ServerGameAction Responsibilities Collaborators Sets up the web UI AGWorld Displays everything on the web Passes commands to the game CRC Class UIToPlay Responsibilities Collaborators Sets up the UI window AGWorld Displays everything on the UI Passes commands to the game Class WordMatcher Responsibilities Collaborators Checks for valid user input CommandParser AGCharacter CRC Class AGDaemon Responsibilities Collaborators Can start and stop ticking AGWorld Realize when a turn has occurred AGRoom Handles user setup CRC Class AdventureWonder Responsibilities Collaborators Update a view in a mvc manner AGWorld Get information about room to be AGPlayer displayed CRC ClasmUI Responsibilities Collaborators Generic class to interact wit ServerGameAction and UIToPla Calls the appropriate UI to disp ServerGameAction UIToPlay ClasMbClass Responsibilities CollaboratorS39 Performs the verb actions der ding AGEvent on the verb passed in CommandParser CRC Clasmlnteraction Responsibilities CollaboratorS39 AGWorld AGDaemon AGCharacter AGPlayer Generic class to interact wit AGPlayer and AGCharacter Handles interaction between AGDaemon and AGWorld
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'