alice.kareltherobot
Class PhilosopherWorld

java.lang.Object
  extended by edu.cmu.cs.dennisc.pattern.DefaultReleasable
      extended by edu.cmu.cs.dennisc.pattern.AbstractElement
          extended by edu.cmu.cs.dennisc.pattern.DefaultInstancePropertyOwner
              extended by org.alice.apis.moveandturn.Element
                  extended by org.alice.apis.moveandturn.Composite
                      extended by org.alice.apis.moveandturn.Scene
                          extended by alice.kareltherobot.KarelWorld
                              extended by alice.kareltherobot.PhilosopherWorld
All Implemented Interfaces:
edu.cmu.cs.dennisc.codec.ReferenceableBinaryEncodableAndDecodable, edu.cmu.cs.dennisc.pattern.Nameable, edu.cmu.cs.dennisc.pattern.NameChangeListenable, edu.cmu.cs.dennisc.pattern.Releasable, edu.cmu.cs.dennisc.property.InstancePropertyOwner, edu.cmu.cs.dennisc.property.PropertyOwner, org.alice.apis.moveandturn.ReferenceFrame

public class PhilosopherWorld
extends alice.kareltherobot.KarelWorld

A simple world in which four philosophers will think and eat together.

Author:
Joseph Bergin

Field Summary
 
Fields inherited from class alice.kareltherobot.KarelWorld
INFINITE
 
Fields inherited from class org.alice.apis.moveandturn.Scene
AMBIENT_LIGHT_BRIGHTNESS_PROPERTY, AMBIENT_LIGHT_COLOR_PROPERTY, ATMOSPHERE_COLOR_PROPERTY, GLOBAL_BRIGHTNESS_PROPERTY
 
Fields inherited from class org.alice.apis.moveandturn.Composite
COMPONENTS_PROPERTY, DEFAULT_DURATION, DEFAULT_HOW_MUCH, DEFAULT_SPEED_STYLE, DEFAULT_STYLE, RIGHT_NOW
 
Fields inherited from class org.alice.apis.moveandturn.Element
NAME_PROPERTY
 
Constructor Summary
PhilosopherWorld()
           
 
Method Summary
 void run()
          Execute the Think and Eat task of the four philosophers Run four philosophers together - competing for the forks.
 void setTheStage()
          Set up the philosopher situation Add four philosophers to the world and the "forks" they will use.
 
Methods inherited from class alice.kareltherobot.KarelWorld
addDecorations, addRobot, cameraFollow, cameraFollow, cameraStayFocusedOn, draw, getCamera, moveCameraTo, moveCameraTo, placeBeepers, placeWallEastOf, placeWallNorthOf, readWorld, readWorld, saveWorld, saveWorld
 
Methods inherited from class org.alice.apis.moveandturn.Scene
addDefaultModelManipulation, addKeyListener, addMouseButtonListener, getAmbientLightBrightness, getAmbientLightColor, getAtmosphereColor, getGlobalBrightness, getKeyListeners, getMouseButtonListeners, getOwner, getScene, getSGComposite, getTransformation, removeDefaultModelManipulation, removeKeyListener, removeMouseButtonListener, setAmbientLightBrightness, setAmbientLightBrightness, setAmbientLightBrightness, setAmbientLightColor, setAmbientLightColor, setAmbientLightColor, setAtmosphereColor, setAtmosphereColor, setAtmosphereColor, setGlobalBrightness, setGlobalBrightness, setGlobalBrightness, setName, setOwner
 
Methods inherited from class org.alice.apis.moveandturn.Composite
addComponent, clearComponents, createOffsetStandIn, createOffsetStandIn, createOffsetStandIn, createOffsetStandIn, createOffsetStandIn, createOffsetStandIn, createOffsetStandIn, createOffsetStandInIfNecessary, delay, findAllMatches, findAllMatches, findAllMatches, findAllMatches, findAllMatches, findFirstDescendantNamed, findFirstMatch, findFirstMatch, findFirstMatch, findFirstMatch, findPathsToAllDescendants, getActualReferenceFrame, getBooleanFromUser, getComponentIterable, getComponents, getDescendant, getDoubleFromUser, getGlobalSimulationSpeedFactor, getIntegerFromUser, getLookingGlass, getName, getPointOfView, getSGReferenceFrame, getStringFromUser, print, removeComponent, setComponents, setGlobalSimulationSpeedFactor, transformFromAWT, transformFromAWT, transformToAWT, transformToAWT
 
Methods inherited from class org.alice.apis.moveandturn.Element
getElement, isComposedOfGetterAndSetterProperties, toString
 
Methods inherited from class edu.cmu.cs.dennisc.pattern.DefaultInstancePropertyOwner
accessListPropertyListeners, accessPropertyListeners, addListPropertyListener, addPropertyListener, decode, encode, equals, fireAdded, fireAdding, fireCleared, fireClearing, firePropertyChanged, firePropertyChanging, fireRemoved, fireRemoving, fireSet, fireSetting, getInstancePropertyNamed, getProperties, getPropertyNamed, isEquivalentTo, lookupNameFor, removeListPropertyListener, removePropertyListener
 
Methods inherited from class edu.cmu.cs.dennisc.pattern.AbstractElement
accessNameListeners, addNameListener, removeNameListener
 
Methods inherited from class edu.cmu.cs.dennisc.pattern.DefaultReleasable
accessReleaseListeners, addReleaseListener, release, removeReleaseListener
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PhilosopherWorld

public PhilosopherWorld()
Method Detail

run

public void run()
Execute the Think and Eat task of the four philosophers Run four philosophers together - competing for the forks.

Specified by:
run in class alice.kareltherobot.KarelWorld

setTheStage

public void setTheStage()
Set up the philosopher situation Add four philosophers to the world and the "forks" they will use.

Specified by:
setTheStage in class alice.kareltherobot.KarelWorld