chapter 4


observations in Blue Cluster spring 1990

examples from the life stories of the fishes


Sixty fourth and fifth grade students and 2 teachers used Playground 3.0 over a 6 week period in spring ‘90 .   The teachers and most of the children had been using the Macintosh with standard applications, including HyperCard,  for several years.   Throughout previous months, Blue Cluster students had further instruction in HyperCard scripting. For Playground, Children had 2 directed lessons of approximately 30 minutes per week followed by a working session of some 45 minutes.  In addition children could devote portions of their independent work time.  Typically this resulted in an additonal 45 minutes.  


This classroom focused on a year long “Oceans” curriculum which was the basis for creating simulations of animal behavior and life cycles.   Teacher's examples are remarkably good matches of Playground to the grade level and to the curriculum.    Marine biology lessons typical of what can be found in fifth biology textbooks[1]  had been studied throughout the earlier part of the school year.  The children observed some of these behaviors directly in the aquariums in their classroom, they went on a whale watching field trip, and they watched science television programs including videodisc footage they had available in their classroom[2].  


Teacher B.J. Conn had transformed three lessons into stories with a set of characters in Playground vocabulary.   As we had seen in the third grade, stories provided a strong context both for planning programming and for judging the results of programming.  Playfields either animated the expected behaviors or did not, and this gave students some notion of what was working and what was not.  The real lessons for us turned out to be in these teacher designed examples themselves, and in students interpretations of them.   Individual student's efforts were less ambitious in nature during these short seven weeks.


Students came to their Playground lessons well prepared as vocabulary and basic concepts of Playground had been introduced in advance of work on the computer.  Vocabulary lessons familiarized children with Playground words, giving them a chance to memorize and drill their spelling.  Teachers used vocabulary during the class day to exercise word use.


Pretend "Playfields" were created on the bulletin board with cardboard Players.  Playground script was written with magic markers on poster cards of agent scripting panes. Playfields were created in this manner with the whole class, step by step.  The process of developing and working with posterized images from Playground menus, playfield and scripting windows, helped teachers to literally get a handle on the structure and interrelationship of these user interface elements.  


The teachers compared agents within Players to different senses which had different jobs to do.   Eyes have the job of seeing, they do not do the job of hearing, and ears hear but do not see.   There is an understanding about the separation of behavior into parts.  The brain takes the information from the senses and makes decisions about it.   The Scriptor was introduced as  the brain of the players.  The brain uses scripts for making choices.


An Example:   Mother and Baby Whale


           Lesson 4

Once upon a time there was a whale who lived in the ocean just off of the Pacific coast.  It is the time of year when the whales migrate down to Mexico to mate and to give birth to their babies who were conceived the year before.  It is a long trip.  The whale can not stay under the water too long. Like all mammals the whale must breathe, so from time to time it must come to the surface.  The whale spends his days swimming up to the surface of the water for air and then swimming down to the ocean bottom.  The whales favorite food is krill.


Lesson 5

The trip for the whales is a very long one.  The whales must eat many many krill each day to keep up their strength.  As they eat they are able to grow and mature.  They begin to fill out and both their height and width begins to increase to show that they are growing. The krill are aware of their predator.  They swim up and down in a very random way without any real protection.  They know when the whales are over them that they can not get away and are soon to die.  It is important that the krill are aware of their population.


Lesson 6

It is important that the krill are aware of their population and know when to give birth.  They do not want their population to become extinct. 

Soon after arriving at their favorite spot in Mexico, the whale gives birth to a baby whale.  The baby whale follows his mother everywhere.  He eats what she eats, and can imitate the sounds that she makes.  The whales use these sounds to locate one another under the surface of the water.  When the baby is big enough, the mother and her baby begin the trip back to Antartica.


This example seemed particularly well matched to most of the students.  The whole class had gone out on a field trip on a boat on a whale watch.  They understood that the whale has to come to the surface to breathe and dives for 3 to 4 minutes and resurfaces to breathe with a regular pattern the observors can clock with their wristwatches.  They understood about the general patterns of whale migration which has all the whales going  in one direction in the winter to have their babies in the warm Mexican waters and then in the other direction in the late spring with the new babies to return to the food rich Artic and Antartic.  Children could sympathize with the mother and the baby whale.  


In terms of programming, what is nice about this example is its careful separation of into independent dimensions. While tackling most of the types of behavior kids will need to construct a complete life cycle, no one player has a complete set of behaviors.  Within each of these three characters, there are several behaviors, but the behaviors do not interfere or conflict with each other.  This makes handling the notice conditionals much simpler, because children do not have to be concerned about conflicts between agents attempting to accomplish similar actions. Yet, all the important concepts are introduced. 


The basic Mother Whale has 10 agents: timepasses, breathing,  foodfinder, myfood, eat, aging, death, motherwhale, whale.  Her action is to go up or down in response to a clock.   The whale never moves towards food, if she happens to overlap a Krill player, she eats it.  Not bothering to chase food avoids a conflict with the action of going up and down to breathe and dive.  Aging & Death remove the image of whale from the playfield. one agent handles position, another width and height, another removes the player from the playfield.  


The Baby Whale has 8 agents in all, finds his mother, follows her, eats krill, and grows larger.


All the life cycle action is segregated off into the Krill that move back and forth kind of randomly.  The Krill uses one agent to swim randomly, and an additional two agents to swimup or swimdown if below the bottom or above the surface.  The Krill clone themselves with one agent, and remove themselves with one agent.  There are 11 Total agents in all in the Krill.


Challenges for this playfield included transfering the cloning scripts learned for the Krill to the Whale mother so that she could actually have her baby on the Playfield.   Another challenge was to improve the movement of the mother so that she didn't just bob up and down like a yo-yo.  Nearly all the children figured these two out, and it made a nice progression of difficulty.


Clock driven Actions in the Mother Whale

Here is our clock again.   This is the agent script in the whale that will notice when he has been under water long enough.  The whale will use the agent that keeps track of time to help her know when a certain amount of time has passed to will move toward the surface and then back to the ocean bottom.


timepasses (Agent)

  cell value < 60

  increment cell value by 1

   set cell value to 0

  This  agent will keep track of our breathing.  It will show time passing.


This is a much more satisfactory clock than the one used in Yellow Cluster, which put all the actions and a conditional into one sentence.   As Blue Cluster started later in the year followed our experience in Yellow Cluster, we were able to change the clock to a different structure more similar to that recommended by diSessa in Turtle Geometry.


Breathing is the only agent who changes the Whales position, moving up and down relative to the "timepasses". clock.   This is no different than the style seen in many examples throughout in Yellow Cluster, where we can see that it was solidly comprehensible to 9 year olds.   Fourth and Fifth grade children were successful too.   


breathing (Agent)

  timepasses < 30

  move toward one player whose name = 'surface'

  move toward one player whose name = 'oceanbottom'

  This agent will watch the time and know when it is time to go to the surface to breathe or to swim to the bottom.


a lesson on the whale diving & breathing in accord to a clock:




B.J. Allen-Conn(teacher):


"Good, Move towards one player ... "


student: "

 .... whose name equals surface."



B.J. Allen-Conn(teacher):


"otherwise.."[gesturing from up to down]


student: "move towards one player whose name equals ocean bottom."




B.J. Allen-Conn:   

"Lets look at the clock and see if it works.   So right now if we run it we can watch the clock.  Right now if the clock is less than 12, what's it going to do?"


student: "swim to the surface "




BJ. Allen-Conn:  "... so there he is at the surface breathing and what's he doing now?"


class: "Going back down to the bottom"


BJ. Allen-Conn:  "So he's made a dive. "


a work session:




Stacy Bacola & Alexia Aleman have been assigned to work together as partners for the duration of the Playground project this year.    Typically one girl uses the mouse to point while the other types.   This requires a great deal of coordination and they are often at cross purposes, which they find enormously funny, a source of hilarious mistakes.


 Alexia Aleman  "...Would you!"


Stacy Bacola   "..It's o.k., It's ocean ... isn't it?.!!"


Alexia Aleman  "Go to the top."


      "It works! Stacy!"








Nested Clocks

A second clock is used for "aging", set in motion by "timepasses" clock.   This achieves a slow counting, adding one every 40 ticks of the timepasses clock.  For this reason, "aging" looks for the condition of timepasses = 40, and when this is true, adds 1 to itself.  This is different than the timepasses clock, which increments only when it is less than 40.


aging    CELL VALUE = 4

  timepasses = 40

   increment cell value by 1

  This clock notices time passing and with every 40 ticks will add one to her aging



A third agent which is the action of "death", is in term set in motion by "aging".  It's condition looks similar to the clocks, but rather than incrementing its agent, its action is to remove the player from the playfield.




  aging = 5

  remove me from the playfield   

  This agent notices the mother whales aging and when her aging becomes greater than a given number, removes her from the playfield


"Aging" does not need to reset itself to 0, because that would be nonsensical to the idea of aging.   Some people refer to this as a counter rather than a clock, distinguishing between things that have one action of continuous counting, from things that have a second action of restarting the count from zero.


We feel that the children should be able to understand this at a very deep level because by this age they have been rehearsing "regrouping" concepts for years, using manipulatives to reinforce math learning. They have been drilling their multiplication throughout this class time, and all we are saying here is count how many multiples of 40 have gone by.  The notion of clocks within clocks is very powerful, and very amenable to Playground's spreadsheet style.   We want to evolve this into something very straightforward so that it can be a major building block children can use and reuse.  


Finding other Players & Collections of Players

Using your senses and your brain to find groups of things by their characteristics


Finding Players by their general characteristics is a powerful programming concept.  Sorting by characteristics is very comprehensible to elementary school children.  They have been doing sorting since the first grade when they take off their shoes and throw them into a big pile, then come up with words to describe different characteristics, then sort the shoes by those characteristics into many little piles.


Both this year and last year, B.J. did a number of similarly physical lessons with her class in advance of playground to exercise them in using their senses and their brains.  Three different kinds of sand were to be divided into 2 groups, by a characteristic describable with a single word, like size, redness.  It was quickly evident that there were hundreds of good words and that dividing them was a matter of personal opinion. 


This year children emphasized other senses particularly aural senses distinguishing distinctions in sounds.  This was coupled with learning about the meaningful sounds produced by undersea animals.


In one exercise the kids were given tin cans with an object inside of them.  The cans were in sets of two with the same object. Rattling the cans produced a distinctive sound.  The objective was to find your partner.  In the cacophony, strategies about finding sounds were posed. Some kinds of sounds were more distinctive than others.  A discussion about the  recognizable qualities of sound ensued, and strategies about producing sounds "taking turns".


Later in the year, the class experimented with a sonar range sensor from a kit for high school students.  We had converted it to HyperCard and provided a sound output.  Higher pitched sounds were assigned to the echoes from closer objects, and lower pitches from far away objects.  One child at a time was blindfolded and given the range finder.  Four children played the part of food fishes out in the ocean, standing stationary to simplify the exercise.  From the slow smiles creeping over their faces one could observe that they were encountering a mesmerizing call to concentration.


An acoustical scientist who records animal sounds in the wild, Bernie Krause, paid a visit to the classroom just prior to Playground lessons.  As he played recordings, he told stories about the context in which the recorders were made, and speculated openly with the children about the meanings of the sounds.  Children were particularly interested in knowing more about how sea mammals help each other, which they had heard was so.  Bernie corroborated and elaborated the stories the children knew.  He described the specific sounds and the variety of sounds the animals made.  He described the kinds of information about the environment that the animals had, including the sensitivity of sonar in dolphins.  "If you are in the water with dolphins", he said, "you feel little pin pricks all over your body, it doesn't hurt, but they are actually seeing what is inside of you.  This way they know if an animal is hurt, and in what way it is hurt, and they can tell this to each other."


The information from the senses is used in meaningful ways both to communicate to others, and for oneself to decide to take actions about.  Throughout the year, as the children did their book based research and writing about animals, their teachers emphasized animals sense, brains, and actions. How can students describe these internal mechanisms using words.  Children's own brains were using information from their senses automatically and unconsciously to determine what to do.  Could they describe what they were noticing?  Could they describe what actions they took in response to what they were noticing? 


Behaviors involving sense, brain, and action could be described as little stories.  The Eating Story could be thought of in these three parts.  The first agent is our sense agent to see all  the food in the playfield, this then should be our food collector, in this example called "foodfinder".   This agent looks and gathers every player who has a food agent and stores the information in its cell value.  It will look like a list of player names. The second agent is the brain agent, and it looks at all of the players in anemones and decides on which of these are the food that is important to it.  It is called myfood.  This agent will choose all the food players in foodfinder that is important to it and stores the information in its cell.  The third agent is the action agent, he will decide that if a player that is in myfood Overlaps him, he will eat it and Grow larger.


foodfinder    CELL VALUE: 4 players: krill1, krill2, krill 3, krill 4  

   set cell value to every player in foodfinder who has an agent named food

 This is the agent in the whale that will look for and gather every player who is food.  This is the SENSE agent.


myfood   CELL VALUE: 4 players: krill1, krill2, krill 3, krill 4    

    set cell value to every player who has an agent named krill

   This is the BRAIN agent.  It looks at the information provided by the sense agent and decides which of all of the food that it sees , is his food


  myfood overlaps me

  increment width by 1; increment height by 1: set cell value to true

  This agent will recognize that his food is overlapping him and it is time to EAT.  The whale will grow a little bit with each of his meals.


Finding Players by their general characteristics is a more powerful programming style than establishing specific relationships with propernames or unique identifiers.   The specific one-to-one relationship of Bob to Mary does not permit substitutions in case of disaster.  In biological simulations it would not do for the predator to die as soon as he has eaten the one prey he knows about, when he may be surrounded by food.  Last year we experienced no end of trouble with the statement “eat player whose name = food”.


Specific one-to-one relationships may be required from time to time, such as when the predator wants to maintain a focus of attention on the target prey, or on a mate.  This can always be handled by the right sequence of notices.  There is no need to establish "hard-wired" one-to-one relationships.  The Mother Whale does not require any specific one-on-one relationship to her food.  She knows that she eats Krill.  The whale in the ocean opens her mouth and swims forward to engulf great amounts of krill.  The whale reacts to food by growing larger.  By taking advantage of the “Overlaps me” condition, a specific one-on-one relation will occur as the playfield animates.  We are championing this kind of use of general relationships for beginning programmers, to avoid bad habits that leads to inflexible code or force lots of messy work arounds.  Although we do see professional programmers often prefer one-to-one relationships to achieve faster computation, they do so paying a price in flexibility, they know that they may need to build in additional structures to account for sometimes needing to switch the object of attention.


In common usage, in english, people are unconsciously sloppy when they say something like "get some lunch", about whether they mean a specific lunch, or whether the person they are addressing is assumed to be able use their own heads and get something appropriate to eat.  Similarly, everyone's lunch is referred to by the same name, the "lunch". We always know what we mean in common sense of the context.  Users want to say "chase the food", meaning one food object but out of hundreds of possibly good choices. Through common sense a sensible choice should be made, like the nearest one, or the easiest one to get.  This year our Player's names are no longer unique so every player could have the propername "food" if that is what the user wanted to call the players who were the prey fish.  Last year we had no end of difficulty with students calling one Player "food", then duplicating the food, and being surprised that the computer did not recognize the duplicates as having the name "food".


It is odd to give the prey the name of food, or even the characteristic of food.  It is doubtful that the prey considers itself someone else's meal. But it is a typical and very easy way to create names.   As the children are busy programming their predator, they do not see that there are two points of view, the prey as well as the predator.  The predator looking at the prey certainly does think of it as having the characteristic and the name of food.  But this is internal to the predator, in the brain of the predator, it is a private name.  Each point of view generates a different description or label.  The internal agents inside the predator might indeed have names like "food", but the characteristics they would be looking for are things like  “smaller than me, looks like a fish, the black fish which taste better than the orange ones”.


B.J. sought to capitalize on personal experience with the exercise of “my friends” and my best friend.  One’s friends might be selected by some criteria like “4th grade”.  It seems reasonable that your best friend might be selected from all of your friends by some special additional criteria -- even “lives closest to me” .  The proper name of your best friend is not “best friends but “Alexis or something, they won’t call themselves “my bestfriend”.  


Eventually every player has the characteristics of food, so that becomes an insufficient distinction.   In this example the Krill required an additional characteristic of “ krill" which resolves the lack of distinction.  This is not necessarily a wrong thing.   Should children be able to realize this, it could be a good  learning experience in the effective use of criteria..


inclusive & exclusive sets:

Up to now, children had effectively been finding all the food, not including the food-finding player himself, and this had been facilitated by a simple script form.   However, to determine exactly how many players like oneself and including oneself populated the playfield, required  understanding that there was a difference between inclusive and exclusive sets.  Some different vocabulary was available to be able to say this in Playground's language.


Krill player


allkrill     CELL VALUE: 3 players: krill1, krill2, krill3

  : set cell value to every player in the universe

                    who has an agent named krill

   This is our SENSE agent. This agent is important because we can look at it and know when our krill population is too low.


This approach B.J. used to set birth limits was by collecting and counting all the players like oneself, and if there were too few, then reproduce.     The teacher found herself explaining inclusive and exclusive sets, together with playground’s hasty language for differentiating them: “every player in the universe” meant including oneself.   Again, we were struck with surprise at the level of understanding teacher and students sustained at this topic, as well as with the inadequacy of Playground’s representations for supporting this requirement.  Perhaps anything the teacher takes extra time to guide and to reinforce is effective.  This agent keeps track of every other player in the universe (this will also include himself) who has an agent named krill.


krill   CELL VALUE:   3

: set cell value to the number of players in allkrill

  This is the agent that gives the krill the agent of being a krill


morekrill   CELL VALUE  22

  (the number of players in allkrill) < 3

    make a clone of me

 :    set cell value to age




  set allkrill to every player in the universe who has an agent named krill; set heading to a random number

  At birth you immediately know how many other krill are in the universe

Example 2:   The Life Cycle of a Fish





         An ambitious and exciting simulation was a life cycle.  Each behavior required several agents with different kinds of scripts. This was the second year B.J. had brought a life cycle to her students.  The programming was much cleaner, both in appropriateness for her children as well as in Playground style.  Looking ahead to the current year, BJ. again is evolving these life cycles. The significant adjustments in curriculum can occur from schoolyear to schoolyear, so we will have three versions of this life cycle to observe.


This is the story of a little fish who has just been born.  She lives with other fish that are like her.  These fish will often stay move together as a group for protection.  They are always on the lookout for their predator, the shark.  As a young fish she is always hungry and looking for food.  She is a carnivore too.  her favorite food is small black fish.   These small black fish are plant eaters.


The little fish spends most of her days swimming around looking for food.  She is always on the watch for her enemy the shark through and when he comes near she quickly changes direction to get away from him.   The little fish eats about 6 small black fish a day before she will stop eating.  After eating this many fish she is no longer hungry.  She will move to the ocean bottom and rest.  While she is resting, she is growing and she is also growing older.  As time passes, she will again become hungry and will leave the ocean bottom in search of food.  She can do this many times in her lifetime.  After a year or two have passed it will be time for her to give birth to a baby.  She will only have one baby.   When she finds her mate, she will become pregnant.  She will have only one baby.  Her baby will follow her everywhere until he is big enough and old enough to be on his own.  More time will pass and the little fish will begin to get old.  She will no longer be able to hunt for herself.  She is no longer a predator and must move to the ocean bottom for protection.  She is getting ready to die.  Time will pass and she will slowly begin to shrink because she is not able to feed herself.  Eventually she will die and be eaten by one of the scavengers of the ocean.


emerging styles of organizing behavior


What we are able to observe happening in these examples is the emergence of Styles of organization of Behavior. It is finally in this life cycle example that we have a sufficient level of complexity.  Distinctly different types of agents recur in regular relation to each other : clocks, use of true/false "flags", relationships to things with characteristics, actions.  As complexity and sheer number of agents increases, so too does the likelihood of conflicts, things wanting to happen at the same time that shouldn't or can't.  A level of understanding about nasty conflicts and how to avoid them is developing. Understanding and controlling complexity is one of four typical difficulties for new programmers[3].  We are enthusiastic to have such a rich source of material to study in this example, in how it was developed by the teacher, and in how it was received by students.



Types of Structures


Little Stories

Now that we have worked so hard to break everything down into the smallest similar bricks, now we want to turn around and use these same pieces to build different kinds of units, which in turn become components in other kinds of units.  Not dissimilar to house construction, builders are empowered by relying on known relationships and known mechanisms, but built out of the same pieces they have recourse to recreate for themselves.  We have seen different types of agents, and certain configurations of these types in previous examples.  In this example these configurations all reappear side by side in one player.


Each of these configurations we are calling little stories.  They each require similar structures -- agents who look for other players, collections or groups of other players.  One agent who selects the one from that group, one action with conditions which prevent it from clobbering other stories actions. There is not a single action agent.


orchestrating between stories:

The Life Cycle of a Fish has twenty seven user defined agents for the main fish character alone.  But, these are grouped into 5 little stories: Eating, Resting, Fleeing, Reproducing, Growing old.  To orchestrate these five stories, we see the use of different clocks as we have seen before.  In addition to clocks, we see "flags" being employed to signal amongst these stories.  A "flag", like a flagman, signals when it is safe for others to go, and when others must stop.   Also various conditions external to the Player are used, such as the proximity of another Player, or the value of some characteristic of the other Player such as it's size..



The three Clocks are Eating, RestClock, MyAge, Gestation.   None of these clocks run freely as internal tickers, independent of anything else.  In this Playfield, we see much more sophisticated and biologically realistic use of clocks. The "Eating" clock only counts when "Hungry" and overlapping food.  This clock is really more a measure of the fish's level of hunger satiation.  Restclock only counts when near the bottom and no longer "Hungry".  The "MyAge" clock used by both Reproducing and Death counts multiples of Restclock.  This twist gives aging a more realistic influence of the relative health of the fish which eats more.  The "Gestation" clock is triggered by the flag "Pregnant", which itself is set when the fish's "MyAge" is 12 -- which we remember is dependent on health of the fish -- and when fortuitously overlapping a mate.   Then Gestation counts up to 10, and resets itself to 0. 



The Flag agents have values which are either true or false.  They check for a variety of conditions, and then other agents need only consult them, rather than repeating the noticing of the conditions they watch for.  Myhunger in the Eating Story, and Healthy in the Growing old story are flags.  Both MyHunger and Healthy are consulted by Eating, Resting and Growing Old.  There gets to be confusion about where to put noticing of the flags.  Matingtime is another flag which is not consulted by others and so MatingMove which only checks MatingTime could presumably compete with EatingMove, RestMove.


external conditions

Some other possible conflicts are avoided by careful management of both internal and external conditions.  MatingMove is set up not to interfere with SharkMove which flees the predator because each occurs at a different time in the fish's life, as determined by the MyAge clock. Sharkmove does check the Healthy flag so it does not compete except when fish is dying and hence no longer eating or resting.  Mating does move toward a mate and overlap a mate so presumably this could compete with EatingMove which moves toward and overlaps a prey, but perhaps the probability of prey within the same proximity is low.


Here is a printout of part of the screen during the first part of the clownfish's life.  The initial numbers are zeroes.  Healthy and Hungry flags are both true, so only the Eating story is happening to start.  All other stories are waiting.  The fish begins to meander around.  If he overlaps a blackfish, his Eating Clock increments. In this example, the blackfish has no script, to emphasize the behavior of the Clownfish and make work easier.  If the Blackfish had his script, he would disappear when the Clownfish overlaps him.



Note that the fish meanders around, he doesn't swim toward his food.  If he happens to overlap it, he eats it.  This attained more realistic movement at the cost of efficiency.  Eventually, the fish bangs around enough to be full.


After Eating has reached a certain number, then MyHunger flag is set to "full", and the Resting story begins.  The fish does his Restmove and goes to the bottom.  


When he is near the bottom, his RestClock counts.




When RestClock reaches the value of 12, SetEating resets the Eating Clock and this resets the MyHunger Flag to "hungry".


When MyAge reaches 12, Matingtime becomes true.  Notice that by this age, the fish has eaten and eaten and grown and grown to be much larger than we saw at first.


Overlapping a mate when Matingtime is true sets Pregnant flag to true.



Pregnant flag being True makes Gestation Clock start counting.




When Gestation Clock reaches 8, then the fish clones itself.  Here we see two babies, because as soon as the fish had one baby, she got pregnant again and had a second baby




During the entire time that Matingtime is true, the fish's action of swimming towards her mate is active.   This action is conflicted with the action of Eating, which is to meander.    There are no Notices watching to see that these two actions trade off.  The system was to provide a blending of actions, in case that the user had forgotten to specify this, but here the move toward the mate overwhelms the meander downwards when "Full" in the Eating story.  This ensures that the fish remains overlapping her Mate, and will have many babies until the user drags her away.   By dragging her over some Blackfish, the Eating counter can be incremented.



After holding the Clownfish over the Blackfish until Eating reaches 8, and MyHunger has been set to "Full", the fish can be dragged to the bottom, to increment the RestClock.  When the RestClock reaches 12, MyAge will be incremented to 13, and then Matingtime will no longer be true.


When the age of 19 is reached, the Aging Story begins.  The fish settles to the bottom and starts shrinking.   Aging takes top priority, no further mating, eating, resting, or fleeing will occur.





If we move the shark over the fish at this point, she will remove herself from the Playfield, her image and her script are erased.




Here are 3 of the 5 stories side by side to emphasize the similarities and differences in the types of agents. 


Eating Story                               Resting Story                             Fleeing Story

Two agents of collection, the first is a plural which gathers every player who meets the criteria, the second is a singular which picks the one that is nearest. 


food                                                                                                                                        predators

  set cell value to the player  who                                                                              set cell value to every player who

         has an  agent named blackfish                                                                                        has an agent named shark


myfood                                                                                                                                  mypredator

  set cell value to the player in                                                                                   set cell value to the player in 

         food who is nearest to me                                                                                                predator who is nearest to me


Here is the Flag "MyHunger".  Resting and Fleeing Stories do not use a Flag.  Note that "MyHunger" checks for the Flag "Healthy" in the Aging story.  It also checks within the eating story for the Eating Clock.



  (eating <= 6) & (healthy = true)

   set cell value to ‘hungry’

 set cell value to ‘full’


"Eating" and "RestClock" are both clocks which increment based on external conditions.   They both check the MyHunger Flag.  Eating runs when MyHunger is Hungry, and RestClock runs when MyHunger is Full.


Both clocks are reset to zero when the conditions have been met.  Restclock can be reset within itself.  Eating must be set by a separate agent which "pushes" the zero value on it when different conditions are noticed.  This was necessary in this version of Playground because the agents are all if/then/elses, and if you need a different condition you cannot have it.   In the next version, Playground 3.5, this could be done within one agent.  Eating also has the action of incrementing the width and height.


eating                                           restclock

(myfood overlaps me) &                         ((the distance between thebottom and me) < 20)

(myhunger = ‘hungry’)                                        & (myhunger = ‘full’)

 increment cell value by 1;                      increment cell value by 1

         increment width by 1;                                 resetting to 0 when greater than 12

         increment height by 1                      

                                                     set cell value to 0


 restclock >= 12

 set eating to 0


All stories have moves.   The move agents check the Flag Healthy is True.  This gives the Aging story top priority when Healthy is false.  Eatingmove and Restmove both check the MyHunger flag, and just as with the Eating and RestClock, they go when the flag is opposite, so Eating is happening when Resting is not, and vice versa.  Eating and Fleeing stories moves also check for some unique external condition.


eatingmove                                    restmove                           sharkmove

  (myhunger = ‘hungry’) &                     (myhunger = ‘full’)               ((the distance between mypredator and me) < 50)

(        top < 200) & (healthy = true)                    & (healthy = true)                            & (healthy = true)

  set heading to a random integer         move toward thebottom      set maxspeed to 50; move away from predator

         between 0 and 360; move forward

set heading to a random integer             set maxspeed to 20

         between 270 and (360 + 70);

         move forward


Here is the script for the last two stories of the five stories in the fish's life.   These are the Reproducing Story and the Aging Story.


Aging                                                                Reproducing

Again, we find two agents of collection which find mates in the reproducing story.  The Aging story makes use of other players which have already been located by the Fleeing Story, the predator.



                                                                          set cell value to every player who has

                                                                              an agent named clownfish


                                                                          sex = ‘female’

                                                                          set cell value to one player in possiblemates

                                                                              whose sex = ‘male’


Each story has one than one clock. There is MyAge and Matingtime.  MyAge is a multiple of Restclock, so Age increases every 12 ticks of the RestClock, and as we recall, the Restclock only goes when the fish is Full and Resting near the bottom.  This means that Age is relative to the health of the fish.   It would seem to be inversely related to the health of the fish, which is peculiar, but some kind of interdependency makes sense.   Matingtime checks MyAge.   The Age which has been selected is such that it will not interfere with the Aging Story, so it doesn't bother to check the Healthy flag.


myage                                                             matingtime

  restclock = 12                                                 (my age > = 10) & (myage < 12)

 increment cell value by 1                                   set cell value to true




     Each story has a flag, "Healthy" and "Pregnant", dependent on MyAge so that they do not conflict.

healthy                                                              pregnant

  my age < 15                                                   (my mate overlaps me)

                                                                              & (sex = ‘female) & (myage = 12)

  set cell value to true                                         set cell value to true

  set cell value to false                                       set cell value to false


Each has a Move.  And each move checks to see if it's own story's flag is true.

growingold                                                         mating

  healthy = false                                                matingtime = true

  move toward thebottom;                                   move toward mymate

      grow to width 30, height 20


The Aging story is finishes with a final action, removing Player from Playfield.



  (healthy = false) &

      (mypredator overlaps me)

  remove me from the playfield


The Reproducing Story is considerably more complicated, and has almost a second story embedded in it about gestation.  Gestation is another Clock which is set off by the Reproducing Flag being true, or "pregnant".  It counts up to 10 and resets itself.      gestation

                                                                          (pregnant = true) & (cell value < = 10)

                                                                           increment cell value by 1

                                                                          set cell value to 0


When Gestation Clock reaches 10, birth happens, and the fish makes a duplicate copy of itself.      birth

                                                                          gestation = 10

                                                                         set cell value to a random integer between 1 and 2.

                                                                              make a clone of me


The Duplicate Copy will look at a special "init" agent which runs one time only at the birth of the duplicate copy.  It sets the new values for the Duplicate or Clone to make it small.  It also uses a random number to set the sex of the Clone.  The random number was generated by Birth Agent.  It could have been set by a separate gene agent, but this limits the number of agents.


                                                                          birth = 1

                                                                         set sex to ‘female’; set eating to 0;

                                                                              set myage to 0; set area to 400; s

                                                                              set pregnant to false; set gestation to 0

                                                                        set sex to ‘male’ ; set eating to 0;

                                                                              set myage to 0; set area to 400;

                                                                              set pregnant to false; set gestation to 0


These agents are not involved in the story, but are identifying characteristics in the fish.


                                                                         cell value: ‘female’




         When Growing Old is True, no other story is true.

            Eating could be True, When Growing Old is False,

            Fleeing could be True, When Growing Old is False, and Predator is Close

            Reproducing could be True, When age is right

            Resting could be True, When Eating is False, When Growing Old is False,

                                                 & Predator is not Close


Difficulties & Collisions


No Emergent Behavior

One source of discovery learning through playing with simulations is observing surprising emergent behavior.  Nonetheless, no surprises emerged from children’s struggles to accomplish a reliable animation.  This has been blamed variously on Playground for running too slow, classroom competition for computer time,  tediousness of Playground work process -- all adding up such that the children rarely had time to sit back, observe and modify.   Simulations were never run long enough to have surprising results.   But even if there had been that time, it is doubtful the Playfield ecologies children developed would have survived long enough nor been adaptable enough to do anything surprising.     Even though children were creating life cycles by copying the teachers model as a guide, it was too difficult for children to trim the values and conditions of their agents, even to modify the behavior of only a few generations.  The models we prototypers provided to the teachers were poorly matched to Playground, demanding contorted english phrasing and running up against system agent timing errors in Playground 3.0.  Teachers had to adapt simpler forms that were easier for children and more reliable..



Articulating conditions Difficult


Senses, Actions, Brain Metaphor versus Action, Notice, Collection Agents

The "senses, brain, actions" metaphor used by Blue Cluster amply describes the flow of control, the chain of cause and effect moving from seeing some other player to doing something about it.  First they described the characteristics that were noticed, universally something like the characteristic of "food". Then they thought about the mental sorting of food into categories of myfood, then they created a third agent to move toward myfood.


But the side effects of senses-brain-action is to program from the point of view of the player --imposing that view on the whole playfield, even on the other players, giving them the characteristic of "food".  Collection Agents like "food collectors" or even "food collecting" sound ridiculous in the Action Agent sentence "Move toward food collectors".


We had not provided very much time to work out appropriate ways to handle these matters with teachers.  New collection functions had been implemented in January only two months before the start of experiments.  These provided a uniform range of sorting possibilities for groups of players as well as single players.  Our recommended conventions encouraged first to create a sentence describing the condition involving other players.  "When near Food -- Go towards Food" ; "When overlapping Closet, change costume".  This all important first step motivates what you want to do and suggests appropriate names for the Agents of Collection.  We recommended successive sorts, from general criteria for Agents collecting Groups, to unique criteria such as largest, smallest for Agents selecting One single player. 


It was not possible to sustain our model in the classroom.  Neither the teachers nor the children felt comfortable with it. It was unrealistic because users still have to stop and back up to re-consider and plan from the perspective of the player and this comes out looking like the "Sense, Brain, Action" metaphor.  Also, the distinction between unique and general criteria for single player or a group of players seemed more like an arbitrary guessing game than an important mathematical concept.



thoughts on sustaining the local view

One way to combat this is to further support the local view by keeping the user away from the script for as long as possible.  The user, looking at the playfield, is indeed thinking about actions and the conditions that cause them.  The user could point at a player, or lasso a group of players, which are the ones his player has noticed.  This selection could automatically decompose into a separate agent or two which for the time being do not need to be named by the viewer.  These could have default names in the script like mygroup1, mygroup2., myotherplayer1.  


Renaming as "Find & Replace" in all Dependent Agents

If we insist upon users creating names for agents, then we must support renaming.  We must admit that the user needs to script from the point of view of the inside of one agent looking out one at a time.  Later, programming inside a different agent, and looking back at how he is going to use the cell value of the agent, he may want to rename it.  Likewise, this may occur when changing point of view from one player to the next.  Support for renaming needs to track down dependencies in a manner similar to Find & Replace spelling correctors.  Currently, renaming is too dangerous because the user is likely to miss correcting all dependencies. 


Noticing is an Inconsistent Metaphor

Now that we have so successfully transmitted the notion of noticing, users want to apply it in a common sense manner.  "Notice food and move toward it".  There are ways in professional programming languages which permit this kind of sentence, but they are confusing for new programmers.  In our intent to make it flat and readable like a spreadsheet, we have broken one thought that could be expressed in one complicated sentence into two sentences.  That seemed innocent enough, but in practice these two sentences seem peculiarly redundant. It seems contorted to have the "real noticing" going on in an agent of collection, while making an extra step of checking its existence in a Boolean.  For example,  one agent of collection is called food, and then a second agent would say, notice food exists, move toward the food that is nearest to me.  In this schoolyear, teachers rejected the exists test as too ridiculous. Instead, examples tend to have distance tests "notice the distance between the predator and me < 50", "move away from predator".  Without existence tests, playfields are in danger of errors if no players did exist.  In the following year, teachers did adopt the test for existence, but still argue that this should be an automatic function of the computer.  The question is what is the computer to do to indicate the error of having nothing to move towards?  In an earlier version we tried having it do nothing, but this misleads users.



Debugging techniques for approaching a non-functioning if/then/else were not taught and children did not come up with their own experiments.  Many fifth graders used “some other player overlaps me” as a condition-- which often had a misspelling or incorrect reference, looking for a player that didn't exist.  Although we intended each small piece of code, perhaps even every line of code, to have its own value -- it simply wasn't feasible with the size of our scriptor panes.


Non-exclusive conditions in the more complex playfields resulted in multiple actions colliding with each other in confusing ways.   To debug these, we recommended setting up true/false flags, converting all numerical counters to true/false flags, and stepping through one step at a time, observing what was happening.  Adult Playground users typically tested each action separately in an empty playfield to convince themselves that each action worked.  A single condition known to work would be used, again in isolation.  It was simply too tedious in the classroom to get children to do this.  Adults serving as aides in the classroom wound up debugging in this manner when things got confusing.  Sometimes the errors were so buried that the Playfield had to be taken out of the classroom and debugged prior to the next class.  Errors would be discussed with the teacher, who could then work with the child to address them.


Planning  & Representations of Organization: 

Another thing that compounded difficulties for children were limited availability or practice of visual representations of organization.  Children never wrote down anything on a piece of paper for the purpose of planning their programming activities.  They did write plenty on worksheets provided by the teacher, but this was universally after completion of an activity.  This utter lack of planning aids amazed us, because we cannot do without them.  The children were curious about the peculiar Dr. Kay’s demonstration of how to jot down ideas on paper in words and diagrams.


WYSIWYG Print-Outs: 

The children had no experience with the notion of reviewing the program by printing it out on a piece of paper such that the whole thing can be spread out on the table at once.  This is such standard programming practice that is unthinkable novices should prefer never to have to resort to such an endeavor.  Teachers and children saw no relation between the agent script they were typing in the panes on the screen, and the more conventional structured programming text only print out.  This is another proof of the importance of WYSIWYG or "What You See Is What You Get".  Teachers combated this for themselves and their teaching examples by producing screen dumps with Capture@ or Exposure@[4].  However, again they were foiled logistically in the classroom because of the slowness of printing and log jams when 15 children send to the printer at once.



Visual Programming approaches would help

Visual programming may simplify understanding mechanisms and make debugging them easier.  Manipulatives have proven their value for reinforcing math understanding and experience suggests it is equally applicable to programming instruction.  Visual programming should be able to extend the experience with manipulatives.  We had hoped the teachers would create these things, and they did.  Donna DiBernardo was successful in conveying a better understanding  of the angle of a  Player's “Heading” by preparing a special playfield using a compass wheel.


Several different ways to move were contrasted and given to children to play with the clownfish example.  X or Y could be set directly and incremented X + 1.  Set Heading and Move Forward is like the logo turtle. In logo experience, it is reputed to be easy and powerful for children to work with.  But Blue Cluster was dissatisfied with the mechanical effect of the movement.


Compass wheel exercises of Heading and Headings between two Random Numbers.

Donna's lesson reviews and exercises children's understanding of Heading, the direction in which the player will move.  "What would the heading of the fish approximately be if you wanted to move toward anemone 1? Its heading should be about 120.  Once the fish had reached its destination and you wanted it now to go to anemone2, what would its new heading be?  270."  Once children developed a feel for the compass directions, they could pick a range of compass directions which would satisfy the general direction for movement, through which the fish would be able to vary it's path.  The computer will continuously choose a different random number between any two numbers that the children specify on the compass.  Varying the  Heading of the fish from tick to tick makes a reasonably believable swimming movement.


Visualizing Nested Clocks

Something like Donna's compass might have helped to visualize nested clocks.  Children have years of school work drilling number “regrouping”, which is integral to learning to add.  Interlocking cycles are part of old wisdom and reappear in many guises as gears, timetables.  These patterns emerge clearly for us only with strong representation -- representations which we did not have available to children.  The children had difficulty visualizing the phase relationship of the two clocks which were true at the same time.  How many ticks of the clock will she be a multiple of 10 and a multiple of 4?  Two copies of Donna’s compass wheel could represent each clock.   During one and only one tick both needles would be pointed in exactly the same direction, and would have indicated  the confluence of timing events .

We had hoped teachers would create these kinds of playfields to visualize lessons.  But the next step for us would be to have these teacher's tools packaged for easy transfer to use in any child's playfield.  This would require engineering work that is beyond our current plans for Playground prototypes, but is demonstrated in other prototypes we have seen.  This would make groups of players more useful.  It takes teachers a great deal of time to create these.


Visualizing Agent List Organization

It is hard to see the overall organization in so many agents.  One technique is to use the agent list browser as a kind of primitive outline or menu.  It’s organization can be in a way meaningful to the user.  The list of agent names were initially presented alphabetically, but no one liked that, so user created agents and system provided agents were segregated into two alphabetical lists.  Then B.J. requested system agent “name” at the top of the list.  Selecting names being attentive to their alpha numeric location could achieve proximity in the list.  Hence we see names of the form: swim, swimup, swimdown, or Growing Old instead of Aging. This silliness has been dispensed with this year by the addition of a minor outlining capability which allows users to structure their own list, creating almost whatever organization they desire.


"Writing Mathematical Sentences"

The fifth grade experience was vastly different from the 3rd grade experience in that children were facile with text, typing, and following directions.   They had recourse to reviewing scripting language and steps in their manuals which had been prepared for them by their teachers.  They occasionally even availed themselves of the on-line text window.  The first lessons went quickly, and introduced children to the hands-on experience of creating playfields and players and scripts.

Transfer from classroom work in mathematics and language was weaker than we imagined.  No consciousness of internal classification strategies or internal labels was brought to programming, although children are experts at private names and labels for each other when they are out on the real playground. Children did not bring their math skills to Playground.



The Most Complex Program Children of this age have written?

This life cycle may be the most complex program children of 10 and 11 have ever written.  Each behavior required several agents with different kinds of scripts. Children were handling 27 if/the/else agents in their principle character  There were another 5 to 6 agents in about 4 types of sustaining characters.  In addition, each character was duplicated or "cloned" and often small modifications were made to distinguish clones from each other. Typically the most elaborate playfields could only sustain about 20 players total before performance slowdowns encouraged children to reduce populations -- but we believe children could easily have handled greater numbers of Players. We would like to claim this as the most complex program children of this age have ever sustained.   Adjusting for differences between languages, it is safe to say it is comparable with other experience.  In Adele Goldberg's work with Smalltalk and children, a typical program size and complexity involved 5 to 10 modifications to a construction with 5 or 6 conditional elements for 12 year olds.[5]  In Seymour Papert’s Logo work, similar numbers were typical.[6].  More recent work with LogoWriter, longer programs may have been attained.

[1]  Several  sources, including: the regular Science Textbook  used in this classroom for 4th & 5th grade from D.C.Heath, which defines and describes "behavior" and "communication" in animals and also describes the undersea ecosystems of the coral reef and the kelp forest.  The specific information on clownfish-anemone symbiosis was provided from additional books written for children.  B.J. gave me these references.

[2] As part of the support for this project, Apple pressed a videodisc from stock footage of Monterey Bay California ecosystems made available from Sea Studios which is associated with the Monterey aquarium. B.J. Conn made her own selections with assistance from Sea Studios staff and Stanford University Professor Chuck Baxter at Hopkins Marine Station

[3] Du Boulay, in Novice Programming, edited by Soloway &

[4] Capture and Exposure are two different commericially available "screen grabbing" programs which provide more functionality than the built-in Macintosh "control-shift 3" by itself.  They allow the user to indicate the size of the area to grab, and assist with saving.

Exposure, 1989 Preferred Publishers Inc. Memphis TN

Capture, Mainstay, Agoura Hills, CA

[5]  Goldberg, Adele. p 4

[6] Harel, Idit  “Children As Software Designers  An Exploratory Study”, Paper presented at the Logo ‘86 International Conference, July 10, 1986.  Media Technology Lab Massachusetts Institute of Technology, Cambridge, MA Spring ‘86 draft   -- This has subsequently turned into a book called The Children Designers, The MIT Press 1991