Building Virtual Worlds

Moshell - Fall 98

Lecture 21: Cellular Automata and Models of Animals
This lecture contains the remaining pieces of Monday's lecture which began with trees, and moved into graph grammars for roadmaps. We discuss the idea of Cellular Automata as models of complex processes in a two or n-dimensional space. Then we move on to the issues of controlling the behavior of virtual animals.

Cellular Automata

John Von Neumann was perhaps America's greatest mathematician. Among the many questions he asked and answered, was this one: "Can machines reproduce themselves?"

To formalize the question he had to operate in a domain where "machine" had a precise mathematical meaning. It wouldn't do to ask a question about whether robots could hold drills and soldering irons, and make another robot. This was an engineering question and Von Neumann was a mathematician.

Von Neumann invented a new kind of space. Imagine an infinite checkerboard. Each cell contains an identical copy of a very simple machine - in fact, it is a finite state machine. Its state set consists of  N (some finite integer) of states. Its input consists of the states of all its immediate neighbors (4 or 8 of them). It lives in discrete time, and its next state depends on its current state and the inputs (neighbors' states.)

Here's a trivial example of a cellular automaton (CA) that models a forest fire.

Initial state: 1
Rule: From state 1, if any neighbor is in state 2, change to state 2.
From state 2, change to state 3 (ashes).

A wave of "2" (fire) will run across the grid - but only if it is initiated by a spark of 2. A field of all-1 will stay happily green-grassy forever. Or perhaps you put in a rule that says that 3->4, 4->5, ....19->1. The grass has grown back again.

Von Neumann's CA was much more complex, and modeled a Turing Machine - that is, a universal computer. But that's another story. We'll tell a bit of it, in class.

Life is a cellular automaton almost as simple as the forest fire. Its rules are as follows:

Initial state: 0 everywhere except for a few 1 locations.
Rule: From state 0, if precisely 3 neighbors are 1, become 1.
From state 1, if 2 or 3 neighbors are 1, stay 1; otherwise, return to 0.

This very simple CA produces amazingly rich and complex behaviors. A free simulator is available at www.mathcs.sjsu.edu/faculty/rucker. I will demonstrate this software in class.

Query 21.1: What is the smallest stable pattern in Life?
Query 21.2: Why is a 3x3, 4x4, 5x5 or any larger square of turned on cells, unstable?
Query 21.3: What is a glider?
Query 21.4: What is a pentomino, and what is the most productive pentomino in Life?

Query 21.5: Von Neumann's simulation of a Turing Machine depended on defining wires and signals that flowed down them. Define a set of states and transition rules which make it possible to transmit a signal down a wire, such that the signal arrives at the other end in Order(n) steps for a path of length n, and the wire is capable of transmitting another signal after the first one has passed through. (HINT: The forest fire will help you.)

21.5 was easy. Here's a hard one.

Query 21.6: Design a CA which supports two identical wires' crossing one another. It will probably be necessary to have rules which discriminate between neighbors' states "north and south" versus "east and west". Refer to the neighbors as 0..7, where 0 is East, 1 is Northeast, etc. The wires won't have to cross diagonally; only NSEW directions are allowed.

Why do Cellular Automata Matter? We're looking for simple ways to model complex phenomena, and CA are easily understood and implemented. It is possible that we might even have a "CA physics" to serve as the internal representation for virtual worlds someday. Edward Fredkin at MIT is pursuing such a dream in a slow, methodical fashion. (He offered Moshell a GRA job to work on this problem in 1971, and is still working on it today.)

Artifical Life

A-life is not Artificial Intelligence (AI). AI has pursued a "top down" approach to making computer software mimic intelligent behavior, where "top down" means based on abstract ideas and logical models of the problem space. Douglas Hofstadter (Indiana U.) says the following attributes describe intelligent behavior:

"Essential abilities for intelligence are certainly:

- to respond to situations very flexibly; to take advantage of fortuituous circumstances ...
- to find similarities between situations despite differences which may separate them;
- to draw distinctions between situations despite similarities which may link them;
- to synthesize new concepts by taking old concepts and putting them together in new ways;
- to come up with ideas which are novel."

Now, which of these things can a cockroach do? We don't think of roaches as intelligent, but they are certainly effective survivors. They respond to situations flexibly (because their bodies can bend); they take advantage of fortuitous circumstances such as a waffle falling under the desk. The rest of those goals, they don't worry about.... but in the long run, they do solve the problems. They distinguish between good bets and bad bets, and skip the bad ones (as a species, not as individuals.)

There's a simple distinction between AI and A-life: A-life forms are playing to survive, in a simulated environment. They don't have to deal with language, pass Turing tests ("mimic a human over a chat-link so that you fool a live human"), or do any abstract reasoning. They just have to be alive next week.

Animats

Animals can be simulated at about the same level of detail as our Lindenmeyer plant models, with about the same kind of fidelity. Of course plants' single interesting act is to grow, whereas animals have to find food, mates, and shelter, as well as avoiding predators.

In class I presented a model of the ANIM system developed by Ken Perlin and Athomas Goldberg, at New York University.  In ANIM there are two layers - an Animation Controller and a Behavior Controller.

In the Animation Controller, each "channel" controls one degree of freedom of the model (e. g. an elbow joint.) Each channel's value is represented by a real number. These chennels can be thought of as vertical columns in a matrix; in the horizontal rows are groups of behaviors. Any given row contains a set of mutually exclusive behaviors. The lowest row is the highest priority, or most dominant, behavior because it's the last one to influence the value flowing down a channel, before it goes out to control the avatar's degrees of freedom.

In a cell in this chart is a "filter" - a piece of software which can accept the value sent down from filters above it in the column, and either add it, ignore it or otherwise consider its nput values when computing the output value for this degree of freedom. This model allows ANIM to fluently combine together motions such as walking, with other motions such as carrying an object in one's hands, scratching one's ear, etc.

I also discussed how an essentially similar model could be used for the Behavior Controller except that the degrees of freedom are not controlling joint angles of an avatar. Instead they are controlling the levels of "endogenous variables" - that is, real numbers that represent parameters such as hunger, fear, boredom. These state variables in turn are used to select specific behaviors that run at any given time - which in turn move the animal's joints and cause things to happen.

Query 21.7: ANIM's methods for controlling endogenous variables seem like they could be used in role playing games such as Dungeons and Dragons. Describe a simple D&D scenario in which a player's attributes (charisma, strength, etc.) change over time, and how their levels might be used to release specific behaviors of an avatar playing a "Non player character" in an online adventure game.

Back to the course index
Back to the course syllabus
Back to the previous lecture
Onward to the next lecture