JavaSpace SimulationWrite a set of classes that define the behav.docx

This preview shows page 2 - 4 out of 8 pages.

JavaSpace SimulationWrite a set of classes that define the behavior of different objects in our space simulation. You are given starter code that, when complete, runs a simulation of a space with many objects moving around in it. Different kinds of objects will behave in different ways and you are defining those differences. In this world, some beings propagate their species by infecting others, which transforms the other objectinto the original object's species.ObjectivesInheritanceBackgroundAs with previous assignments, there is starter code for you todownload here. These files must be in the same folder as the files you create.The class SpaceItem is the super class for the other objects inour simulation. It has one method that must be overridden (the getMove() method). There are public methods as well as protected methods that your subclasses will inherit and you'llbe able to use (protected means that they are available to the subclass implementation, but not to clients).There are also useful enum definitions in SpaceItem.On each round of the simulation, each object is asked what action it wants to perform. There are four possible responses,each with a constant associated with it.Constant
DescriptionAction.MOVEMove forward one square in its current direction���Action.LEFTTurn left (rotate 90 degrees counter-clockwise)���Action.RIGHTTurn right (rotate 90 degrees clockwise)���Action.INFECTInfect the object in front of you���The getMove() method is passed an object of type SpaceItemInfo. This is an object that provides information about the current status of the object. It includes four

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture