Download Bowden_BL_T_2014

Transcript
Brian L. Bowden
Figure 3.1: Actor UML Diagram
Chapter 3. Sofia.Micro Features
18
Figure 3.2: World UML Diagram
removing itself or another actor, changing direction, etc. This follows an approach similar to
how a greedy algorithm works where the actor makes the best local decision in order to try to
solve a global problem. This style of writing actors is less restrictive than the programmableactor-style since students just need to focus on writing how an actor should respond at each
individual step, rather than how they should respond over the entire program. These types
of actors can usually be identified by an overridden method that appears in every actor (and
world), in the case of Greenfoot and Sofia.Micro, this is the act() method.
Sofia.Micro employs both types of actors and worlds that are commonly used for these
microworlds, namely actors and programmable actors, and worlds and programmable worlds.
Like in the Greenfoot model, each actor has an act() method that is called during each tick
of the global clock. Students can extend the appropriate actor and override the act method
to create behaviors for the actors.The programmable actor extends the Actor class and uses