WEEK: 12
Active: April 4th - April 10th
Work Due: April 11th @ 9:00AM

More Examples of Things Interacting

I want you to examine the next two examples to figure out how I am doing what I am doing.

Re-Generating Happy Faces

The following example has “bouncing happy faces”. But, when two of the run into each other, one is deleted. When a happy face is deleted, two more are re-generated. This occurs until an upper-threshold of the number of happy faces is reached.

[ Code Download ] [ View on GitHub ] [ Live Example ]

Too Many PacMans

In the next example, the sketch creates 100 “PacMan-like” objects. These move only along cardinal directions (north, south, east, or west). After some random amount of time, each object can randomly choose another of those four directions to travel.

If, a PacMan runs into another PacMan that is blocking his path, then he waits until he chooses a new direction, or the blocking PacMan moves out of the way.

[ Code Download ] [ View on GitHub ] [ Live Example ]