0% found this document useful (0 votes)
201 views206 pages

Prog W Agents

Michael David Travers Submitted to the Program in M edia Arts and Sciences, School of Architecture and Planning in partial fulfillment of the requirements for the degree of doctor of Philosophy at the Massachusetts institute of technology.

Uploaded by

rohrhuber8366
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
201 views206 pages

Prog W Agents

Michael David Travers Submitted to the Program in M edia Arts and Sciences, School of Architecture and Planning in partial fulfillment of the requirements for the degree of doctor of Philosophy at the Massachusetts institute of technology.

Uploaded by

rohrhuber8366
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 206

Programming with Agents:

Michael D avid Travers

New metaphors for thinking about computation

Bachelor of Science; Massachusetts Institute of Technology, 1986 Master of Science in Visual Studies; Massachusetts Institute of Technology, 1988 Submitted to the Program in M edia Arts and Sciences, School of Architecture and Planning in partial fulfillment of the requirements for the degree of D octor of Philosophy at the Massachusetts Institute of Technology June 1996 Massachusetts Institute of Technology, 1996 All Rights Reserved

Author: Program in M edia Arts and Sciences M ay 3, 1996

Certified by: M arvin M insky Professor of Electrical Engineering & Computer Science Toshiba Professor of M edia Arts & Sciences Thesis Supervisor Certified by: Mitchel Resnick Assistant Professor of M edia Arts & Sciences Fukutake C areer D evelopment Professor of Research in Education Thesis Supervisor Accepted by: Stephen A . Benton Chair, D epartmental Committee on Graduate Studies Program in M edia Arts and Sciences

Programming with Agents:


Michael David Travers
Submitted to the Program in M edia Arts and Sciences, School of Architecture and Planning on M ay 3, 1996 in partial fulfillment of the requirements for the degree of D octor of Philosophy at the M assachusetts Institute of Technology

New metaphors for thinking about computation

Abstract
C omputer programming environments for learning should make it easy to create w orlds of responsive and autonomous objects, such as video games or simulations of animal behavior. But building such w orlds remains difficult, partly because the models and metaphors underlying tra d iti o n a l progra m m i ng l a ngu ages are n ot p arti c u l arl y su ite d to th e task . T h is d issertati o n i n v estigates n e w m eta p h ors, e n v iro n m e nts, a n d l a ngu ages th at m a k e p ossi b l e n e w w a ys to cre a t e progra ms -- a n d , m ore bro a d l y , n e w w a ys t o t h i n k a b o u t progra ms. In p art i c u l ar, i t i ntro d u c es th e i d e a of progra m m i ng w ith age nts as a m e a ns to h e l p p e o p l e cre ate w orl ds i n v o l v i ng resp o nsi v e , i n t era c t i ng o b j e c ts. In t h is c o n t e x t , a n age n t is a si m p l e m e c h a n ism i nte n d e d to b e u n d ersto o d thro ugh a nthro p o m orp h i c m eta p h ors a n d e n d o w e d w ith c erta i n lifelike properties such as autonomy, purposefulness, and emotional state. C omplex behavior is achieved by combining simple agents into more complex structures. W hile the agent metaphor enables ne w w ays of thinking about programming, it also raises ne w problems such as interage n t c o n f l i c t a n d n e w t asks su c h as m a k i ng t h e a c t i v i t y o f a c o m p l e x so c i e t y o f age n ts understandable to the user. To explore these ideas, a visual programming environment called Live W orld has been developed that supports the creation of agent-based models, along w ith a series of agent languages that operate in this w orld.

Thesis Supervisors: M arvin M insky Professor of Electrical Engineering & Computer Science Toshiba Professor of M edia Arts & Sciences Mitchel Resnick Assistant Professor of M edia Arts & Sciences Fukutake C areer D evelopment Professor of Research in Education

Doctoral dissertation committee

Thesis Advisor: M arvin M insky Professor of Electrical Engineering & Computer Science Toshiba Professor of M edia Arts & Sciences

Thesis Advisor Mitchel Resnick Assistant Professor of M edia Arts & Sciences Fukutake C areer D evelopment Professor of Research in Education

Thesis Reader: Pattie Maes Associate Professor of M edia Technology Sony C orporation C areer D evelopment Professor of M edia Arts & Sciences

Thesis Reader: A lan Kay Apple Fellow A pple C omputer

Acknowledgments

The ideas in this thesis w ere shaped by a lifetime of learning from other people and other w ork. There is room here to only thank some of them: M arv i n M i nsk y h as b e e n m y a d v isor a n d age nt pro v o c ate ur for a l o ng ti m e . H is u n i q u e w ay of seeing the w orld constantly kept me on my toes. M itch Resnick w as my other advisor and provided invaluable assistance in actually getting this w ork focused and finished. Pattie M aes and W hitman Richards also provided a great deal of good advice and encouragement. A lan Kay got me started on this path of inquiry w hen he began the V ivarium project at MIT a n d A p p l e i n 1 9 8 6 . Si n c e t h e n h e h as pro v i d e d c o nsist e n t su p p ort a n d i nsp ira t i o n f or m y research over the years. A nn M arions vision w as at the nucleus of this project, and she and the rest of the people involved at A pples Learning C oncepts G roup get my heartfelt thanks for thinking in nonstandard directions and encouraging others to do the same. The N arrative Intelligence reading group provided a suitably underground context in w hich subversive ideas could flourish. W hile many w onderful people participated, I have particularly benefited from the conversation and friendship of A my Bruckman, M arc D avis, W arren Sack, and C arol Strohecker. The original V ivarium group at the M edia Lab provided the initial gro w th medium for this w ork. The lifeforms making up the ecology included M argaret M insky, Steve Strassman, D avid Levitt, A llison D ruin, Bill C oderre, Silas the dog, N oobie the chimera, numerous fishes, and the autonomous blimp. M ore recently the people of the Epistemology and Learning G roup have made me feel at home and helped me through the home stretch. Special thanks go to those w hose w ork and advice have had a great deal of influence on my o w n ideas, including Edith A ckermann, H enry Lieberman, H al A belson, Seymour Papert, A ndy diSessa, and Phil Agre. L i v e W o r l d , l i k e a n y l a rg e p i e c e o f s o f t w a r e , w a s b u i l t o n t h e s h o u l d e rs o f o t h e r programmers. In this case the giants include Ken H aase, A lan Ruttenberg, and the M acintosh Common Lisp team in its various incarnations at Coral, Apple Computer, and D igitool. T h a n ks a lso go to a l l w h o h e l p e d m e o ut b y re a d i ng drafts a n d gi v i ng m e fe e d b a c k a n d encouragement, including Paul Pangaro, A my Bruckman, D avid M ankins, Linda H ershenson, M arcio M archini, and others.

D e e p est t h a n ks go t o m y fri e n ds w h o h e l p e d t o k e e p m e t oge t h er a n d p ush m e a l o ng t h r o u g h t h i s p r o c e ss: D a v i d M a n k i n s a n d J o h n R e d f o r d , w h o h a v e b e e n m y fr i e n d s a n d sometime housemates for more years than any of us w ould like to admit; A lan Ruttenberg, my partner in hacking, resistance, and exile; and A my Bruckman, w ho raises common sense to an art form. T h a n ks t o t h ose orga n i z a t i o ns w h o pro v i d e d f i n a n c i a l su p p ort f or m y w ork , i n c l u d i ng A pple C omputer, Toshiba, and the M itsubishi Electric Research Laboratory. Last a n d m ost, th a n ks to Li n d a , T a n y a & F orth c o m i ng. A fa m i l y w h at a c o n c e pt.

Table of Contents 1
1.1 1.2
1.2.1 1.2.2 1.2.3 1.2.4 1.2.5

Introduction
LiveWorld: an Animate Programming Environment Examples of Animate Systems
Video G ames and Animation Animal Behavior Models G raphic Layout and Interactive C onstraints Blocks W orld Putting it All Together

15
18 20
20 20 20 21 21

1.3
1.3.1 1.3.2 1.3.3 1.3.4

Influences and Inspirations


Society of Mind C ybernetics, Ethology, Situated A ction C onstructivism and C onstructionism Interactive C onstruction Environments

22
22 23 24 25

1.4
1.4.1 1.4.2 1.4.3 1.4.4

Overview of the Thesis


A nalysis of M etaphors for Programming Agents and A nimacy The Live W orld Programming Environment Agent-Based Programming

26
26 26 27 27

2
2.1

Metaphors and Models for Computation


Theories of Metaphor
The C ontemporary Theory of M etaphor D ead M etaphors The Metaphorical N ature of Scientific U nderstanding Formalization and Metaphor 2.1.1.1 The C onduit M etaphor 2.1.2 2.1.3 2.1.4 2.1.1

29
30
31 31 34 35 37

2.2
2.2.1 2.2.2 2.2.3

Metaphors in Programming
The Idea of C omputation M etaphors M ake C omputation Tangible M etaphoric M odels for C omputation

39
39 40 41 42 43 47 48 50

2.2.3.1 The Imperative Model 2.2.3.2 The Functional Model 2.2.3.3 The Procedural M odel 2.2.3.4 The O bject Model 2.2.3.5 The C onstraint M odel

2.2.4

Interface M etaphors

53

2.3

Conclusion

54

3
3.1 3.2

Animacy and Agents


Introduction The Realm of Animacy
The Perception of C ausality The D evelopment of A nimism as a C ategory Frame w orks of U nderstanding A nimacy and the Representation of A ction C onclusion: the N ature of A nimacy

57
57 58
58 60 62 63 65

3.2.1 3.2.2 3.2.3 3.2.4 3.2.5

3.3
3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6

Animacy and Computation


Animism at the O rigins of Computation Animacy in Programming Body- and Ego-Syntonic M etaphors A nthropomorphism in the Interface Animate Metaphors in Artificial Intelligence C onclusion: C omputation Relies on A nimate M etaphors

66
68 69 71 72 73 75 77

3.3.2.1 The Little-Person M etaphor

3.4
3.4.1

Agent-Based Programming Paradigms


Principles of Agent-Based Programming 3.4.1.1 Purpose, G oals, and C onflict 3.4.1.2 A utonomy 3.4.1.3 Reactivity

77
78 79 80 81 81 81 82 82 83 83 84

3.4.2

Computational Realizations of Agents

3.4.2.1 Agent as Process 3.4.2.2 Agent as Rule 3.4.2.3 Agent as Enhanced O bject 3.4.2.4 Agent as Slot and V alue-Producer 3.4.2.5 Agent as Behavioral C ontroller 3.4.3 Agents and N arrative

3.5

Conclusion

86

4
4.1 4.2

LiveWorld
Overview of LiveWorld Design
G eneral G oals A W orld of Lively O bjects

89
89 90
90 90

4.2.1 4.2.2

4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4. 2. 1 0

Spatial Metaphor and D irect Manipulation Prototype-based O bject-oriented Programming Improvisational Programming Parsimony Metacircularity G raphic Realism and Liveness Learning Path Rich Starting Environment

91 92 93 95 95 95 96 97

4.3
4.3.1 4.3.2 4.3.3 4.3.4

Box Basics
Boxes Form a H ierarchical N amespace Inheritance, Prototypes and C loning The Basic Box D isplay Theatrical Metaphor

98
98 98 99 100

4.4
4.4.1 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7

Interface Details
Selection M e n us M ouse O perations Cloning Inheritance Interestingness Box Si z es and Positions

101
101 102 103 105 105 106 106

4.5
4.5.1 4.5.2 4.5.3 4.5.4

Language Extensions
A c c essors for B o x es M essage-Passing w ith ask M eth o ds Relative Box Reference

107
107 107 108 110 110 110 111 112

4.5.4.1 Self 4.5.4.2 B o x p aths 4.5.5 4.5.6 D emons G lobal O bject

4.6
4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6

Specialized Objects
A nimas and Agents Specialized Slots C omputed Slots Se nsors Multimedia O bjects K-lines

112
112 113 113 115 116 117

4.7
4.7.1 4.7.2

Miscellaneous Issues
Shallow vs. D eep Cloning Internal Frames

117
117 118

4.7.3 4.7.4 4.7.5

D eleting Boxes Install and D einstall Protocol Error H andling

119 120 120

4.8
4.8.1 4.8.2 4.8.3

Some Unresolved Issues


M ultiple V ie ws of A ctors U niform Interfaces H ave a D o w nside C loning and D ependent O bjects

121
121 122 122

4.9
4.9.1 4.9.2 4.9.3 4.9.4 4.9.5 4.6.6

Relations to Other Work


Boxer and Logo Self Alternate Reality Kit Rehearsal W orld gora IntelligentPad

123
123 124 124 125 125

4.10

Conclusion

126

5
5.1

Programming with Agents


Simple Agent Architectures
Simple Agents 5.1.1.1 Simulating Concurrency 5.1.1.2 H andling Conflict 5.1.1.3 Presenting C onflict Situations to the U ser 5.1.1.4 Behavior Libraries 5.1.2 5.1.3 G oal Agents A Comparison: Teleo-Reactive Programming 5.1.1

127
127
127 128 129 132 133 134 136

5.2
5.2.1 5.2.2

Dynamic Agents
O vervie w Structures

139
141 143 143 144 145 148 148 148 149 150 150 151 151

5.2.2.1 T asks 5.2.2.2 Agents 5.2.2.3 Templates 5.2.3 C ontrol 5.2.3.1 A ctivation and Expansion 5.2.3.2 C ycles 5.2.3.3 Success and Failure 5.2.4 Special Tasks 5.2.4.1 C ombining Tasks 5.2.4.2 C ontrol Tasks 5.2.4.3 Primitive Tasks

5.2.4.4 Internal Special Tasks 5.2.5 D omain Tasks and Templates: Examples 5.2.5.1 N umerical C onstraints 5.2.5.2 G eometry 5.2.5.3 Behavior 5.2.6 Conflict 5.2.6.1 Slot Conflict 5.2.6.2 G oal Conflict 5.2.7 D etermination

152 152 153 154 156 156 156 157 157

5.3
5.3.1 5.3.2 5.3.3 5.3.4 5.3.5

Interface
Top-Level Tasks A uto-tasks and Locks The Agent D isplay C ontrolling W hen and H o w Agents Run Agent D isplays and Storyboards

159
159 159 160 160 162

5.4
5.4.1 5.4.2 5.4.3 5.4.4 5.4.5 5.4.6 5.4.7 5.4.8

Additional Examples of Agent Systems


A Video G ame A Physical Simulation A M ore C omplex G raphic C onstraint Problem A Creature in Conflict A n A nt A Recursive Function A Scripted Animation B UILDER in the Blocks W orld

166
167 168 169 170 171 173 174 175

5.5
5.5.1 5.5.2 5.5.3 5.5.4

Discussion
D A as a Procedural Language D A as a Behavioral C ontrol System D A as a C onstraint System D A and A nthropomorphism

176
177 178 179 181 181 182 182 183 184

5.5.3.1 Related W ork 5.5.4.1 Creation of Agents 5.5.4.2 Agents, Tasks, and Templates 5.5.4.3 Are Agents Too Lo w-level? 5.5.4.4 V ariants of A nthropomorphic M apping

5.6

Summary

184

6
6.1 6.2

Conclusions
Summary and Contributions Related Work

187
187 188

6.2.1. 6.2.2. 6.2.3.

KidSim Agentsheets ToonTalk

188 189 189

6.3
6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6

Directions for further research


W hat C an N ovices D o w ith Agents? C an Agent A ctivity Be M ade M ore U nderstandable to the U ser? C an Agent Systems Be M ade M ore Po w erful? C an Agents be O rgani z ed in D ifferent W ays? C an the Environment Be Agents A ll the W ay D o w n? Agents in Shared W orlds

190
190 191 192 192 194 195

6.4

Last Word

195

Bibliography

197

Chapter 1

Introduction
W e propose to teach AI to children so that they, too, can think more concretely about mental processes. Seymour Papert (Papert 1980)

T h e c o m p u t er is a n e w m e d i u m f or t h o ugh t a n d e x pressi o n , ra d i c a l l y d i f f ere n t fro m traditional media in its dynamism, interactivity, and flexibility. A universal device, the computer can be used to create dynamic interactive models of any conceivable process, mathematical, biological, or w holly imaginary. If w e learn the w orld by constructing it, no w w e have at hand a medium that enables w orld-building as an everyday learning activity. Theories about ho w the w orld w orkssay, the la ws of physics, or the behavioral patterns of animalsw ill no longer be mere dry abstractions but instead form the basis for concrete, visible simulations that can be observed, tinkered w ith, and inhabited. C omputational environments that permit this sort of activity ought to be extraordinarily po w erful mental tools, w ith the potential to transform ho w we think and learn. But expressing ideas in this ne w medium is difficult, and its potential as a learning tool still largely unreali z ed. The fundamental skill needed to express dynamic ideas in the interactive medium is programmingthe ability to tell the computer w hat to do and ho w to do it. W hat you can express (and, more subtly, w hat you can conceive of w anting to express) depends upon the tools available. The problem is that current programming tools are rather limited in w hat they offer in the w ay of expressive capabilities. W hile the computer c a n b e m a d e t o d o j ust about anything, given enough time and expertise, w hat can be done readily d e p e n ds u p o n th e languages and tools offered by the programming environment. This is especially true for young or novice programmers, w ho have a limited ability to build up their o w n abstractions and tools, and so must depend on those that the environment already supplies. C omputers w ere first developed to solve mathematical problems and still bear the marks of their history. C ertain modes of thought and w ays of structuring activity are w oven into the w ay w e think about computers, modes w hich are not necessarily the only or best w ays of coming t o gri ps w i t h t h e p o t e n t i a l o f t h is n e w d o m a i n . T h e n a m e c o m p u t er i tse l f re f l e c ts t h is c o m p u t a t i o n i s o n l y a p a rt o f w h a t c o m p u t e rs d o n o w , a n d t h e y m i g h t b e t t e r b e c a l l e d information manipulators or dynamic media machines. Indeed, at the consumer level, this is w h a t c o m p u t ers h a v e b e c o m e . Pe o p l e are n o w a c c ust o m e d t o d e v i c es t h a t w h i l e l a b e l e d computers are really video games or virtual reality engines or simulations of cities. But programming, w hich is the only level of use in w hich the full po w er of computation as an intellectual tool can be realized, is still centered around traditional models of computation. At this level, a computer is seen as a device for performing mathematical calculations, or executing a sequence of rote operationsnot as a dynamic w orld in w hich lifelike activity can take place. W hile the computer itself has gone through radical transformations as it penetrates into society at large, the languages, tools, and concepts used to program them have stayed pretty much the same.

As a result, a young programmer w ho might imagine building a dynamic w orld of interacting o b j e c ts (sa y , a v i d e o ga m e or a si m u l a t i o n o f a n a n t c o l o n y), w i l l b e f a c e d w i t h n u m ero us obstacles that stand in the w ay of bringing the vision into reality. Some of these w ill be inherent in the complexity of the task, and may not be possible to eliminate, but others w ill be due to the l a c k o f pro p er e x pressi v e t o o ls. F or i nst a n c e , f e w e x t a n t progra m m i ng e n v iro n m e n ts f or novices support even so basic a facility as the ability to create multiple graphic objects that can move simultaneously and independently w hile interacting w ith each other. M ore fundamentally, the languages that the environments provide are often not suited to such tasks, because they re l y o n m o d e ls o f c o m p u t a t i o n t h a t are n o t p art i c u l arl y su i t e d t o t h e c o n tro l o f d y n a m i c behavior. I h a v e c o i n e d th e term a n i m ate syste m to d escri b e th ese sorts of d y n a m i c w orl ds th at involve multiple active and interactive objects. A nimate systems are simulated dynamic w orlds that contain multiple independent but interacting graphic actors. I chose the term because its connotations include animals, animation, and the mind or soul (or anima). T h is th esis d escri b es a search for a programming paradigm suitable to the control of behavior in animate systems. The languages used for programming are defined, enabled, and limited by their underlying models and metaphors. W hile computer science strives to w ards formal definitions of its subject m a t t er, t h e pra c t i c a l t ask o f u n d erst a n d i ng c o m p u t a t i o n a l e n t i t i es re l i es o n t h e i n f orm a l technique of borro w ing terminology and structure from more familiar domains via metaphoric mappings. M etaphorically-structured models are so pervasive that sometimes they are hard to se e . C o nsi d er t h e n o t i o n o f a c o m p u t a t i o n a l o b j e c t , a n u n d erst a n d i ng o f so m e stru c t ure i nsi d e t h e c o m p u t er t h a t re l i es, i n su b t l e w a ys, u p o n o ur e x ist i ng k n o w l e dge o f p h ysi c a l objects. T w o examples of more obvious metaphors are the program-as-a-recipe metaphor that is ofte n use d to c o n v e y to b egi n n i ng progra m m ers th e i d e a th at th e c o m p uter is fo l l o w i ng a sequential list of instructions, and the spreadsheet metaphor that allo ws business people to fit a form of fu n cti o n a l programmi ng i nto a fami l i ar me d i um. T h ese meta p h ors pro v i d e p o w erfu l frame w orks for the understanding and construction of complex systems. U n f ort u n a t e l y , m a n y i f n o t m ost re a l- w orl d t asks d o n o t e asi l y f i t i n t o t h e c o n c e p t u a l fra m e w orks su p p l i e d b y t h ese c o m m o n m e t a p h ors. T h is is tru e b o t h f or t h e t asks f a c e d b y professi o n a l progra m m ers ( w h o m ore ofte n th a n n ot are fa c e d w ith th e task of d esign i ng a program that w ill function as part of a larger mechanical system, and thus must spend most of i ts t i m e r e a c t i n g t o a n d c o n tr o l l i n g e v e n ts i n a w o r l d o u ts i d e t h e f o r m a l d o m a i n o f t h e programming language) and the programs that children w ould like to create if only they could (for instance, video games w ith interacting objects). Fe w languages make tasks like these easy, b e c a u s e t h e m o st i m p o rt a n t a s p e c ts o f t h e t a s k s u c h a s m u l t i p l e a u t o n o m o u s o b j e c ts , re a c t i v i t y , a n d go a l-d ire c t e d b e h a v i orh a v e n o d ire c t re prese n t a t i o n i n t h e u n d erl y i ng metaphor. This is not to say that such systems cannot be built using existing tools, only that building them requires a good deal of mental contortion that may be beyond the abilities of novice programmers. S o w e s e e k n e w m o d e l s a n d m e t a p h o rs f o r c o m p u t a t i o n t h a t c a n e n a b l e n o v i c e progra m m ers to b u i l d d y n a m i c m o d e ls of b e h a v i or. If o ur i nterest is i n su p p orti ng a n i m ate syste ms, th e th o ught th at th e progra ms to b u i l d su c h syste ms c a n b e b ase d o n m eta p h ors of l ife a n d m oti o n is p arti c u l arl y attra cti v e . A nthro p o m orp h i c m eta p h ors are use d for te a c h i ng 16 Introduction

novices ho w to visuali z e the operation of a computer, and they are common in the informal discourse of programmers. But such usages are restricted to the margins of the field, and are c o nsi d ere d so m e w h a t d isre p u t a b l e . Is i t p ossi b l e or d esira b l e t o bri ng t h e m e t a p h or o f a program as a living thing back into the foreground, and to make greater use of it? W hat qualities of programming will change if we try to look at it in animate terms? T h ere are m a n y asp e cts of th e a n i m ate d o m a i n th at c a n b e usefu l l y m a p p e d o nto computational activity. The human ability to sequentially follo w simple instructions w as used as the basis for the Turings theoretical machine. M ore recently, the object-oriented programming p ara d igm m a k es use o f t h e m e t a p h or o f m essage-p assi ng as t h e b asis f or stru c t uri ng t h e activity of programs that are divided up into a collection of communicating objects. As w e shall se e , a d egre e o f a n i m ism , e x p l i c i t or i m p l i c i t , is prese n t i n a l m ost a l l w a ys o f orga n i z i ng computational activity. Agent-based programming is my term for programming languages and environments that are e x p l i c itl y gro u n d e d i n a n i m ate m eta p h ors. A n agent , a s w e s h a l l u s e t h e t e r m , i s a n y component of a program or system that is designed to be seen as animate. The term agent suggests a variety of attributes that have not generally been built into the underlying metaphors o f progra m m i ng; a ttri b u t es su c h as p urp ose f u l n ess, a u t o n o m y , a n d t h e a b i l i t y t o re a c t t o outside stimuli. In other w ords, agent-based programming builds upon and extends the implicit animism of computation. Instead of the standard metaphor of the computer as an animate yet mechanical instruction follo w er, w e substitute the metaphor of the agent that can initiate action autonomously in order to achieve a goal. C ollections of agents w ork together to create complex behavior. The general idea of an agent as a component of a larger system is inspired by M arvin M inskys Society of M ind theory (M insky 1987), although the purposes to w hich agent-based programming puts them is different. Thinking of program components in animate terms suggests a variety of ne w techniques for describing program activity to a user. If an agent has an explicit goal, the state of the agent can no w be made available to the user in a meaningful w ay, through anthropomorphic interfaces. G oals and satisfaction provide the conceptual tools for thinking about inter-agent conflict, an important issue in a system w ith distributed control. A w orld of autonomous agents pursuing g o a l s a n d c o m i n g i n t o c o n f l i c t w i t h o n e a n o t h e r s u gg e sts t h a t p r o gr a m a c t i v i t y c a n b e re prese nte d i n th e form of n arrati v e , w h i c h tra d iti o n a l l y d e a ls w ith m oti v ate d a ctors, th e ir efforts to reali z e their goals, and their successes, failures, and conflicts. A g e n t - b a s e d p r o gr a m m i n g i s a n a t t e m p t t o d e s i g n t o o l s a n d f i n d n e w c o n c e p t u a l f o u n d a t i o ns f or progra m m i ng t h a t are m ore su i t a b l e t o t h e t ask o f c o nstru c t i ng a n i m a t e syst e ms. Progra m m i ng h as b e e n sa i d t o pro v i d e us w i t h a n e n t ire l y n e w w a y o f t h i n k i ng, sometimes called procedural epistemology th e stru cture of k n o w l e dge fro m a n i m p erati v e p o i nt of v i e w ( A b e lso n a n d Sussm a n 1 9 8 5). O n e go a l of th is th esis is to pro v i d e a fri e n d l y criti q u e of th e e x isti ng forms of pro c e d ura l e p iste m o l ogy , a n d a n atte m pt to i m pro v e u p o n them. C all it an investigation into animate epistemologya n e x a m i n ati o n of th e w a y w e th i n k about the animate w orld, ho w computation makes use of this w ay of thinking, ho w it fails to, and ho w it might do better.

Introduction

17

1.1

LiveWorld: an Animate Programming Environment

A ny programming environment designed to support the construction of animate systems has to offer some basic w orld-modeling capabilities, and offer them in a readily accessible form. It m u st s u p p o rt t h e s i m u l t a n e o u s a n i m a t i o n o f m u l t i p l e o b j e c ts . It m u st s u p p o rt o b j e c t autonomy; in that objects can be seen as operating under their o w n control rather than under the control of a central program. The objects must be able to sense their environment, w hich will consist mostly of other animate objects. L i v e W o r l d (s e e f i g u r e 1 . 1 ) i s a p r o gr a m m i n g e n v i r o n m e n t d e s i g n e d t o s u p p o r t t h e construction of animate systems. W hile Live W orld itself is not based on agents, it is a tool that facilitated the development of the agent-based programming techniques, and as its name implies, w as designed to support a feeling of liveness, a quality difficult to define but a crucial part of establishing the context for agent-based programming. A live environment is one in w hich there are a lot of simultaneous activities going on, both at the direct command of the user and as a result of autonomous agent activity. U sers can interact w ith autonomous objects, and change t h e i r a g e n ts w h i l e t h e y a r e r u n n i n g . T h e f e e l o f L i v e W o r l d s e ts t h e st a g e f o r a g e n ts , b y providing a w orld in w hich they can act. O ne goal of Live W orld is to provide a w orld w here computational objects of all kinds can be readily manipulated. A nimate systems are built out of a diverse set of components, and it is i m p ort a n t t o h a v e re l a t i v e l y e asy-t o-use t o o ls t h a t su p p ort cre a t i o n a n d c o m b i n a t i o n o f a variety of object types. Live W orld is built around a prototype-inheritance object system w hich a l l o w s o b j e cts to b e e asi l y c l o n e d (c o p i e d) a n d m o d ifi e d . O b j e cts are re prese nte d as h i erarc h i c a l l y n est e d b o x es, a l l o w i ng stru c t ures o f v ary i ng d egre es o f c o m p l e x i t y t o b e manipulated as single units. C omplex objects can be assembled by cloning simpler objects and dropping them into a container object: for instance, a sensor or behavior can be added to an animal body in this w ay. The system is intended to be a construction kit for animate systems, allowing simulations to be built out of components from libraries.

18

Introduction

Figure 1.1: The Live W orld environment.

Introduction

19

1.2

Examples of Animate Systems

The idea of animate systems has its origins in the V ivarium project, initiated by A lan Kay w ith the mission of developing environments for simulating animal behavior. M y w ork on this project led to a number of systems for modeling animal behavior in soft w are. O ne goal of the prese n t w ork is t o e x t e n d so m e o f t h e i d e as d e v e l o p e d f or si m u l a t i ng a n i m a ls i n t o n e w a p p l i c a t i o n d o m a i ns. Ea c h o f t h ese d o m a i ns i n v o l v es a c t ors a n i m a t e d b y age n ts, b u t e a c h generates a some w hat different intuitive idea about w hat an agent is and ho w they should w ork together. M y o w n implicit purpose in designing Live W orlds agent systems w as to see if I could fi n d a n age nt-b ase d progra m m i ng fra m e w ork th at c o u l d su bsu m e a n d u n ify th ese d i v erge nt notions of agent.

1.2.1

Video Games and Animation

T h ese t asks pro v i d e b asi c t ests o f t h e i n t era c t i v e gra p h i c e n v iro n m e n t . N o n e o f t h e m require very complicated agent systems. V ideo games require that objects be able to sense each other and trigger actions appropriately; this can be done by relatively simple forms of agents. O b j e cts m ust b e a b l e to b e cre ate d a n d d e l ete d , a n d th e user m ust b e a b l e to i ntera ct w ith objects w hile they are active. Simple video games dont require goal-driven agents, although m ore c o m p l e x o n es m ight i n c l u d e c h ara cters th at p ursu e go a ls, w h i c h bri ngs th e m i nto th e realm of animal behavior.

1.2.2

Animal Behavior Models

T i n b e rg e n s d r i v e - c e n t e r e d m o d e l o f a n i m a l b e h a v i o r ( T i n b e rg e n 1 9 5 1 ) , i n w h i c h a h i erarc h i c a l n et w ork of dri v es c o nst it ut e d t h e c o ntro l syst e m of a n a n i m a l , w as o n e of t h e ancestors of the Society of M ind theory and provided a basis for Live W orlds predecessor, the A gar a n i m a l b e h a v i or si m u l a t i o n e n v iro n m e n t (Tra v ers 1 9 8 8). Li v e W orl d s age n t syst e ms provide a similar level of functionality in a more flexible, general and coherent framework. In animal behavior models, agents correspond to basic drives, both general and specific. So m e e x a m p l es of a n i m a l tasks are: surv i v e , fi n d-fo o d , ori e nt-a w a y-fro m-pre d ator or run . D rives are at best temporarily satisfied and are al w ays in some degree of conflict. That is, an animal might have multiple top-level drives such as eating, cleaning, and mating, all of w hich are to some degree unsatisfied at any one time, and they cannot in general be pursued simultaneously. Even the top-level goals of survival and reproduction, dictated by evolution, w ill be in tension w ith each other. The satisfaction condition or goal of a drive cannot be easily m o d e l e d as a B o o l e a n pre d i c ate , si n c e it m a y b e satisfi e d to v ari o us d egre es (i . e . th ere is a continuum of levels of hunger-satisfaction bet w een starving and satiated). A nimal goals w ill usually not be satisfied by a single operation, but w ill require an iterated effort to achieve a final st a t e . F or i nst a n c e , t h e go a l b e a t t h e w a t eri ng h o l e w i l l re q u ire a seri es o f m o v e m e n t operations to be achieved.

1.2.3
20

Graphic Layout and Interactive Constraints


Introduction

A n oth er d o m a i n usefu l l y v i e w e d i n a n i m ate terms is th at of gra p h i c l a y o ut pro b l e ms, or m ore bro a d l y t h e t ask o f m a i n t a i n i ng re l a t i o nsh i ps a m o ng gra p h i c o b j e c ts u n d er c h a nge . Interactive constraint systems have been applied to such problems in the past. As discussed in s e c t i o n 2 . 2 . 3 . 5 , c o n str a i n ts m a y b e u s e f u l l y v i e w e d a s a n a m a l g a m o f d e c l a r a t i v e a n d pro c e d ura l i n f orm a t i o n: a c o nstra i n t b o t h st a t es a c o n d i t i o n t h a t sh o u l d b e h e l d tru e , a n d contains procedures for changing the w orld to make it true. This provides yet another model for age nts. O n e go a l of th e Li v e W orl d age nt syste m , th erefore , is to sh o w th at age nt-b ase d p r o gr a m m i n g i s a u s e f u l t e c h n i q u e f o r b u i l d i n g i n t e r a c t i v e gr a p h i c c o n str a i n t s y st e m s . Li v e W orl d is p art i c u l arl y su i t e d t o e x p l ora t i o n i n t h is d o m a i n b e c a use o f i ts i n t egra t i o n o f graphic objects and agents. Agents in constraint problems take a different form than those in animal behavior domains. I n a c o n str a i n t p r o b l e m , g o a l s a r e e x p e c t e d t o b e s a t i sf i e d s i m u l t a n e o u s l y r a t h e r t h a n sequentially. G oals are expressions of allo w able final states rather than ongoing needs. Even if constraints are implemented as agents, the role of action is less dominantw hereas the actions of animals are necessarily limited by their physical constraints, the actions of a constraint agent can be essentially arbitrary. The ability to solve graphic layout problems opens up the potential for Live W orld to define its o w n interface behavior using agents. For instance, the constraint that a box be big enough to display its annotations could be reali z ed by means of appropriate agents and goals, rather than special purpose internal code. This sort of interface metacircularity could serve to make a more integrated and flexible environment (see 4.2.7).

1.2.4

Blocks World

The blocks w orld is a classic artificial intelligence micro w orld domain, and one used in Society of M ind to illustrate agent operations. W hile little AI is required to implement these examples, they do require one capability that has been absent from some of the earlier efforts at agent-based programming. In particular, to w er-building requires the sequential achievement of goals, a requirement w hich is not found in constraint problems nor in most simple animal b e h a v i or pro b l e ms. T h e pre c ursors t o Li v e W orl d s age n t syst e ms, su c h as A gar (Tra v ers 1988) and Playground (Fenton and Beck 1989), did not have any real support for sequencing, w h i c h l e d t o so m e frustra t i o n . T h e b l o c ks w orl d pro v i d es a t est o f t h e a b i l i t y o f t h e age n t system to handle sequential tasks that require control state.

1.2.5

Putting it All Together

T h e pro b l e m d o m a i ns m e nti o n e d p ose a d i v erse set of tasks, b ut th e re a l c h a l l e nge is to develop an agent-based programming system that allo ws simple solutions to the problems using a si ngl e p ara d igm . T o d o so , w e h a v e t o e x tra c t t h e c o m m o n e l e m e n ts fro m t h ese d i v erse problems and use them as the basis for the design of the system. The common element w e seek is, of c o urse , th e agent . A ll the problems above suggest solutions expressed as collections of simple, cooperating, task-based, goal-directed modules. The challenge is to design a single agent system that can express these solutions. Introduction 21

1.3

Influences and Inspirations

A number of po w erful ideas have informed this research and the designs that gre w out of it. This section sketches out this background of ideas and situates the present w ork in relation to them.

1.3.1

Society of Mind

T h e c o n c e p t o f age n t use d h ere d eri v es fro m M arv i n M i nsk y s So c i e t y o f M i n d (S O M ) th e ory ( M i nsk y 1 9 8 7). S O M p i ctures a m i n d as a c o l l e cti o n of i ntera cti ng age nts, w h i c h are d efi n e d o p erati o n a l l y as a n y p art or pro c ess of th e m i n d th at b y itse lf is si m p l e e n o ugh to understand. The mind is thus seen as a collection of simple entities, each w ith their o w n goals but someho w connected so that their actions are coordinated. The w ord agent has obvious a n i m ate c o n n otati o ns. W h i l e age nts are se e n as m e c h a n isms, th e y are m e c h a n isms th at are s e e n i n l o o s e l y a n t h r o p o m o r p h i c t e r m s , h a v i n g a p u r p o s e a n d ( p e r h a p s) a d e gr e e o f autonomy. Agents serve many different purposes: some have representational or perceptual functions (s u c h a s apple o r red), oth ers are pro c e d ura l (build, find-place). St i l l o t h ers are b ase d o n a w ide variety of AI methodologies including neural nets, frame-based representations, and G PSstyle goal follo w ers. Because agent is defined so loosely, and there are many different kinds, it is probably un w ise to say much about agents in general. For our purposes, procedural agents are of the greatest interest. These, more so than others, are described in highly animate terms: Y o ur grasping agents w ant to keep hold ; add must call for other agents help (S O M , p202 1 ) . T h e i d e a o f p r o c e d u r a l a g e n ts c l e a r l y d e r i v e s fr o m t h e c o m p u t a t i o n a l n o t i o n o f a pro c e d ure , a n d l i k e pro c e d ure i n v o c a t i o ns c a n b e se e n as h i erarc h i c a l b ure a u cra c i es t h a t perform complex tasks by parceling them out from top to bottom. But unlike procedures, they also can have desires and are otherw ise anthropomorphi z ed. In M inskys terminology, agent has a dual term: agency . If agent is any understandable part of the mind, then agency is any assembly of parts considered in terms of w h at it c a n a c c o m p l ish as a u n it, w ith o ut regard to w h at e a c h of its p arts d o es b y itse lf. W ith these definitions, agent and agency are to be seen as dual terms for the same thing, age nt m e a n i ng a m e c h a n ism si m p l e e n o ugh to b e u n d ersto o d i n m e c h a n i c a l terms, w h i l e agency indicates the same mechanism but viewed in functional or intentional terms.
I recycled the old w ords agent and agency because English lacks any standardi z ed w ay to distinguish betw een vie w ing the activity of an agent or piece of machinery as a single process as seen from outside, and analy z ing ho w that behavior functions inside the structure or agency that produces it (Minsky 1991).

The distinction bet w een these t w o vie ws or levels of analysis is crucial to M inskys attempt to b u i l d a n e w meta p h or system for d escri b i ng mi n ds. H o w e v er, th e meta p h ori c ma p p i ng is some w hat unclear. In other domains of research, agent has come to mean the very opposite of w h at M i nsk y i nte n ds: th at is, age nt (rath er th a n age n c y ) n o w usu a l l y m e a ns a se m iintelligent program as seen from the outside. This terminological confusion is unfortunate. H ere, w e w ill use agent to mean any process or component that is intended to be understood from 22 Introduction

an animistic perspective. W hat it means to understand something in this w ay is discussed in C hapter 3. The animate systems that Live W orld can build are much simpler than human minds, and incorporate only the most basic parts of S O M . For instance, none of the representational ideas are implemented, other than a w eak version of K-lines (see section 4.6.6). N onetheless S O M has functioned as a key stylistic inspiration for agent-based programming. I vie w Live W orld as a step to w ards building implementations of S O M , if only in that the availability of agent-based programming environments for children might encourage the development of appropriate styles of thinking and programming.

1.3.2

Cybernetics, Ethology, Situated Action

T h e t ask o f si m u l a t i ng a n i m a l b e h a v i or w as t h e go a l o f m y f irst e ff orts i n age n t-b ase d programming. Modeling animals led to a new set of perspectives about the nature of intelligence. The intelligence of animals necessarily manifests itself in the form of behavior and interaction w ith th e ir e n v iro nme nts, rath er th a n th e a b i l ity to so l v e symb o l i c pro b l ems. A t th e time th is project began, the main stream of artificial intelligence research had rather little to say about t h e s e i ss u e s . I n st e a d I w a s i n s p i r e d b y w o r k s fr o m c y b e r n e t i c i sts , e s p e c i a l l y V a l e n t i n o Braitenbergs book Vehicles (Braitenberg 1984), w hich illustrated a series of ideas about control b y e n c a psu l a t i ng t h e m i n si m p l e cre a t ures m a d e u p o f se nsors, m o t ors, a n d n e uro n-l i k e c o m p o n e n ts. M y f irst e f f ort a t a n e n v iro n m e n t f or a n i m a t e syst e ms, Bra i n W orks (Tra v ers 1988), w as based on this book. A nother source of inspiration w as the w ork of ethologists, scientists w ho studied animal behavior in the w orld. N iko Tinbergen, one of the founders of this field, developed a general t h e ory o f b e h a v i ora l c o n tro l (T i n b erge n 1 9 5 1) t h a t f orm e d t h e b asis o f m y se c o n d syst e m , Agar (Travers 1988), w hich w as based upon an idea of agent derived from Tinbergens drive centers and w as more oriented to w ards producing simulations of actual behavior. A t this time, several groups w ithin the AI community w ere becoming dissatisfied w ith the standard approaches to controlling action and developing alternatives very much along these lines. In particular, Rod Brooks w ork w ith robots (Brooks 1986) (Brooks 1991) and the w ork of Phil Agre and D avid C hapman (Agre and C hapman 1987) (C hapman 1991) w ere influences o n m y o w n w ork . T h is sc h o o l o f t h o ugh t , w h i c h h as b e e n l a b e l e d t h e si t u a t e d a c t i o n movement, is still controversial w ithin AI. This movement has generated a good deal of critical reflection w ithin AI, w hich can only be to the good. From a constructive standpoint, ho w ever, the techniques of situated action have had demonstrated successes only in limited domains. It i s n o t c l e a r h o w t o e x t e n d t h e s e a p p r o a c h e s , w h i c h r e l y o n h i g h l y s p e c i a l i z e d c o n tr o l m e c h a n isms, t o t h e k i n ds o f ge n era l c a p a b i l i t i es t h a t A I h as stri v e n f or. H o w e v er, f or t h e purposes of this thesis, that is enabling the construction of autonomous and reactive creatures in interactive environments, they have a clear utility. U niting these three strands of research is the idea that understanding intelligence requires t a k i ng i n t o a c c o u n t t h e re l a t i o nsh i p b e t w e e n a n i n t e l l ige n t cre a t ure a n d i ts e n v iro n m e n t . Intelligence, then, is located not so much in the head, but in the relationship betw een the mind Introduction 23

and the w orld. Ive found this simple idea intriguing if not absolutely convincing. It has value as a n a ltern ati v e p ersp e cti v e o n th i n k i ng a b o ut m e nta l pro c esses (so m e of th e e p iste m o l ogi c a l implications are discussed further in section 2.1.4). H o w ever, this approach to thinking about intelligence is quite appropriate for the task at hand, that is, designing animate environments and progra m m i ng syste ms for th e m . T h is task re q u ires th at th e e n v iro n m e nt a n d th e m i n ds a n d age nts b e c o-d esign e d a n d w ork togeth er. T h e l esso n for progra m m i ng e n v iro n m e nts is th at w hat you w ant your programming language to do depends on the environment in w hich it w ill operate.

1.3.3

Constructivism and Constructionism

The constructionist approach to learning (Papert 1991) underlies the design of Live W orld and the general frame w ork of my research. C onstructionism derives its name as a variant of the k i n dre d psy c h o l ogi c a l sc h o o l o f constructivism. T h e c o n s t r u c t i v i s t v i e w o f l e a r n i n g a n d development (Piaget 1970) presents an image of these processes as both active and creative. It is active in that it is primarily a process of spontaneous development, in w hich the learner must discover kno w ledge rather than having it delivered from the outside by a teacher. It is creative i n t h a t t h e pro c ess o f l e arn i ng i n v o l v es b u i l d i ng stru c t ures o f k n o w l e dge w i t h i n t h e m i n d , structures w hich are original creations, at least relative to the learner. C onstructio n ism sh ares the spirit of constructivism, but extends it by emphasi z ing that learning can be aided by building actual material objects in the w orld. The process of construction then takes place in both the m i n d a n d th e e xtern a l sh are d w orl d . B oth a p pro a c h es to l e arn i ng e n c o urage th e l e arn er to assume an active and creative role rather than be a passive recipient of information, and both are opposed to the more prevalent educational philosophy w hich they label instructionism , in w h i c h l e arn i ng is se e n as a pro c ess i n w h i c h st u d e n ts p assi v e l y re c e i v e i n f orm a t i o n fro m teachers. 1 C o nstru c t i o n ism a p p l i e d t o t h e use o f c o m p u t ers i n e d u c a t i o n resu l ts i n t h e i d e a t h a t students should be able to use the computer as a construction medium. The implications are that the computational medium should be flexible: like a piece of paper, it ought to support a number of different modes of use, levels of skill, and target domains. It also implies that the l o c us o f c o n tro l sh o u l d b e t h e st u d e n t ra t h er t h a n t h e c o m p u t er, as o p p ose d t o t h e m ore instructionist versions of educational computer use, in w hich the model is for the computer to present the student w ith a structured series of lessons and qui z z es. The constructionist philosophy underlies the development of Logo, Smalltalk, Boxer and r e l a t e d p r o gr a m m i n g e n v i r o n m e n t s f o r l e a r n i n g . T h e L i v e W o r l d e n v i r o n m e n t t o o i s c o nstru cti o n ist i n ori e ntati o nit pro v i d es a c o m p utati o n a l m e d i u m th at m a k es a v ari ety of computational objects available to novice programmers, and encourages experimentation and i m pro v isa t i o n . O n e i m p ort a n t asp e c t o f t h e d esign is t o m a k e a l l asp e c ts o f Li v e W orl d s o p era t i o n a n d a l l re l e v a n t c o m p u t a t i o n a l o b j e c ts a c c essi b l e t o t h e user t hro ugh a d ire c t-

1 See section 2.1.1.1. The distinction betw een instructionism and constructionism directly parallels the distinction between the conduit and toolmaker images of language use.

24

Introduction

manipulation interface. This also allo ws some elements of the construction process to take place through spatial manipulation of parts. Beginning programmers in Live W orld can build systems simply by copying, dragging, and combining parts via direct manipulation. C o nstru c t i o n ism h as so m e t i m es b e e n o v eri n t erpre t e d t o m e a n t h a t t h e c o m p u t a t i o n a l e n v iro n m e n t sh o u l d i n i t i a l l y b e a c o m p l e t e l y b l a n k sl a t e , e m p t y so t h a t i t e v e n t u a l l y b e populated solely by the creations of the user. Live W orld takes a looser approach to constructionism, providing kits of parts and examples that can be copied and modified. Indeed its prototype-based object system emphasi z es this mode of use (see section 4.2.10). This form of constructionism more realistically reflects ho w real-w orld learning takes place, and makes it p ossi b l e f or st u d e n ts t o t i n k er w i t h c o m p l e x syst e ms t h a t t h e y c o u l d n o t e asi l y b u i l d fro m scratch. A c o n str u c t i v i st p h i l o s o p h y a l s o u n d e r l i e s t h e st u d y o f m e t a p h o rs f o r c o m p u t a t i o n p r e s e n t e d i n C h a p t e rs 2 a n d 3 . T h i s m e t h o d o f t h i n k i n g a b o u t h o w p e o p l e t h i n k a b o u t c o m p u t a t i o n i s b a s e d u p o n t h e v i e w t h a t t h e k n o w l e d g e o f b o t h e x p e rts a n d n o v i c e s i s individually constructed, w ith metaphor being a fundamental construction technique. The fact th at o ur m o d e ls of c o m p utati o n are c o nstru cte d l e a ds to th e p ossi b i l ity th at th ere c o u l d b e different w ays of understanding computing that w ould provide po w erful alternative points of vie w . This premise underlies the attempt to construct an approach to programming centered around the idea of agents. By explicitly designing a language around a po w erful metaphor, the activity of programs can be vie w ed from a ne w and useful perspective. C o nstru cti v ism a n d c o nstru cti o n ism are ra d i c a l i d e as. C o nstru cti v ism forc es us to ackno w ledge that learning is a creative process and that kno w ledge is constructed rather than received. C onstructionism suggests that this process takes place not only inside the heads of individuals, but involves interaction w ith the material and social w orlds. Both imply a great deal of freedom and the possibility of alternative epistemologies. This thesis is an attempt to explore some of these possibilities for the domain of programming.

1.3.4

Interactive Construction Environments

If constructionism is a philosophy of learning, interactive computer environments provide b o t h t h e w orl ds a n d ra w m a t eri a l w h ere c o nstru c t i o n c a n t a k e p l a c e . A f e w progra m m i ng environments that w ere designed to support construction have already been mentioned. But there are other examples of interactive soft w are that, w hile not providing as po w erful generalpurpose programming tools as Logo (Papert 1980) or Smalltalk ( G oldberg and Robson 1983), su c c e e d i n cre ati ng h igh l y i ntera cti v e v irtu a l w orl ds w h i c h are c o nstru cti o n ist i n th e ir o w n fashion. These include interactive constraint systems such as Sketchpad (Sutherland 1963) and T h i ngLa b (B orn i ng 1 9 7 9), spre a dsh e et progra ms (i n terms of w i d espre a d a d o pti o n , th e m ost su c c essfu l v ari ety of c o nstru cti v ist c o m p utati o n a l m e d i a), a n d so m e v isu a l c o nstru cti o n k its such as H ookup (see section 2.2.3.2). W hat distinguishes these systems is their ability to create a virtual w orld of reactive objects t h a t o p era t e a u t o n o m o usl y a c c ord i ng t o ru l es t h a t t h e user c a n c o nstru c t a n d c o n tro l . A n i m p o rt a n t g o a l o f L i v e W o r l d w a s t o e n a b l e t h i s s o rt o f c o n str u c t i o n . T h e l i v e n e ss o f Introduction 25

Live W orld extends not only to being able to build simulations of living animals, but to having the computational medium itself be lively and reactive. There is no w a large body of soft w are, mostly aimed at children, that presents w orlds in w hich limited forms of construction take place. Examples are mostly in the form of games such as Si m C ity , Pi n b a l l C o nstru cti o n K it, a n d T h e In cre d i b l e M a c h i n e . T h ese syste ms ge n era l l y prese nt a f i x e d set of o b j e cts t h at o p erat e a c c ord i ng t o f i x e d ru l es, w it h t h e user gi v e n t h e a b i l i t y t o arra nge t h e o b j e c ts i n t o n e w c o n f igura t i o ns. A s su c h , t h e y are n o t as ge n era l or flexible as the other environments mentioned, but provide inspiration due to their high degree of liveliness and their ability to provide rich and habitable worlds.

1.4

Overview of the Thesis

T h e b o d y o f t h is t h esis is i n f o ur c h a p t ers. T h e f irst t w o are pri m ari l y c o n c e p t u a l a n d analytical, while the last two are more technical and describe implemented software.

1.4.1

Analysis of Metaphors for Programming

C h a p t er 2 is a n a n a l ysis o f h o w m e t a p h or syst e ms are use d i n t h e u n d erst a n d i ng a n d construction of computation and programming languages. The object of the chapter is to find a w ay of thinking about the informal conceptual underpinnings of a field w hose kno w ledge is m ore c o m m o n l y d escri b e d i n m a t h e m a t i c a l f orm a l isms. It f irst gi v es a bri e f o v erv i e w o f contemporary metaphor theory, then applies the theory to the analysis of a number of different mo d e ls or p ara d igms for programmi ng. By me a ns of th is a n a l ysis w e c a n re v e a l some of th e hidden assumptions that underlie the concept of computation and the languages w ith w hich w e approach it.

1.4.2

Agents and Animacy

C h a p t er 3 c o n t i n u es t h e t ask o f t h e pre v i o us c h a p t er b y e x p l ori ng a p art i c u l ar t y p e o f metaphor that employs some form of anthropomorphism or animism. A nimacy is seen to be, in i tse l f , a b asi c c a t egory f or d e a l i ng w i t h t h e w orl d , w i t h ro o ts d e e p i n i n n a t e p erc e p t u a l pro c esses. T hre e re l e v a n t c h ara c t erist i cs o f t h e a n i m a t e re a l m are se l e c t e d f or a t t e n t i o n , b e c a use o f t h e ir c e n tra l i t y t o t h e c o n c e p t a n d b e c a use o f t h e ir re l e v a n c e t o c o m p u t a t i o n: purposefulness, reactivity, and autonomy in the sense of being able to initiate action. A nimism i s s e e n t o b e c e n t r a l t o u n d e rs t a n d i n g a c t i o n , a n d t h u s a l s o c e n t r a l t o u n d e rs t a n d i n g computational activity. The chapter examines the use of animism in programming languages, as w ell as the more explicitly anthropomorphic constructs found in interface agents and artificial intelligence. W e find that most programming languages involve implicit animate metaphors, but an animacy of a particularly limited sort that derives from the original conception of the computer as a device for following instructions.

26

Introduction

At this point, it is possible to more precisely define agent-based programming as an attempt to construct a ne w paradigm for programming that makes computational animism explicit and a t t e m p ts t o e x t e n d i t b e y o n d t h e i n str u c t i o n -f o l l o w i n g m e t a p h o r t o i n c l u d e t h e c e n tr a l pro p ert i es o f a n i m ism re v e a l e d b y o ur a n a l ysis, su c h as a u t o n o m y a n d go a l-d ire c t e d n ess. V ari o us m eth o ds for re a l i z i ng a n a n i m ism w ith th ese pro p erti es i n c o m p utati o n a l forms are explored. Some previous attempts to construct programming systems that operate in this style are examined and critiqued.

1.4.3

The LiveWorld Programming Environment

C h a pter 4 d escri b es th e Li v e W orl d syste m i n m ore d eta i l . Li v e W orl d is a v isu a l o b j e ctoriented programming environment that supports the research into agent-based programming te c h n i q u es. Li v e W orl d pro v i d es th e n e c essary su bstrates for th is w ork , i n c l u d i ng a fl e x i b l e prototype-based object system, a simple t w o-dimensional w orld for computational actors to p erf orm i n , a n d a gra p h i c a l i n t erf a c e t h a t m a k es t h e c o m p u t a t i o n a l o b j e c ts t a ngi b l e a n d accessible to manipulation. W hile Live W orld is primarily a tool to support the main object of research, it is of some interest in its o w n right and a necessary step on the road to developing a n e n v iro n m e n t f or age n t-b ase d progra m m i ng. So m e o f t h e m ore i n n o v a t i v e f e a t ures o f Live W orld are sensors that allo w objects to be a w are of each other, and the integration of a spreadsheet-like interface with animated graphic objects.

1.4.4

Agent-Based Programming

C h a p t er 5 prese n ts a seri es o f age n t-b ase d progra m m i ng syst e ms i m p l e m e n t e d usi ng Live W orld. The first t w o, Simple Agents and G oal Agents, are computationally fairly trivial but serv e t o i l l ustra t e so m e o f t h e k e y c o n c e p ts u n d erl y i ng age n t-b ase d progra m m i ng. T h ese i n c l u d e t h e i d e a o f age n ts as se p ara t e o b j e c ts t h a t c a n b e i n d e p e n d e n t l y m a n i p u l a t e d a n d integrated into a computational actor, the need to handle concurrency and conflict, the idea of using goals as a method to organi z e agent activity, and the use of anthropomorphic icons to convey agent state and activity to the user. The final agent system, D ynamic Agents, illustrates ho w these ideas can function as part of a more po w erful and general programming system. A seri es o f e x a m p l es sh o w s h o w t h e age n t syst e ms c a n i m p l e m e n t syst e ms f or t h e se l e c t e d problem domains.

Introduction

27

28

Introduction

Chapter 2

Metaphors and Models for Computation


It may be that universal history is the history of a handful of metaphors.
Jorge Luis Borges, The Fearful Sphere of Pascal (Borges 1962)

W e have defined agent-based programming as a method of thinking about computational activity that is explicitly organi z ed around animate metaphors. This chapter and the next are attempts to expand this definition by looking closely at both metaphor and animacy and the ro l es th e y p l a y i n stru cturi ng th e c omp utati o n a l d oma i n. W e w i l l se e th at c omp utati o n, l i k e almost all speciali z ed domains of kno w ledge, is founded on a variety of metaphors that relate its str u c t u r e s t o t h o s e o f o t h e r d o m a i n s . T h e d o m a i n o f a n i m a t e b e h a v i o r i s a p a rt i c u l a r l y i m p orta nt so urc e of c o n c e pts a n d v o c a b u l ary for c o m p utati o n , for re aso ns to b e e x p l ore d . Examining the role of metaphor and animacy in detail will both lay the groundwork for designing a g e n t - b a s e d p r o gr a m m i n g s y s t e m s a n d p r o v i d e s o m e i n s i g h t i n t o t h e e p i s t e m o l o g y o f computation and programming in general. O ur u n d erst a n d i ng of a su b j e ct as a bstruse as progra m m i ng is n e c essari l y gro u n d e d i n o t h e r t h i n gs w e k n o w . A n o v i c e l e a r n i n g t o p r o gr a m m u st c o n str u c t u n d e rst a n d i n gs b y bootstrapping them from existing bodies of kno w ledge and skills. Suitable bases on w hich to b u i l d i n c l u d e e x p eri e nti a l l y gro u n d e d syste ms of k n o w l e dge a b o ut th e p h ysi c a l a n d so c i a l w orlds, or more abstract bodies of kno w ledge such as mathematics or economics. U ltimately abstract kno w ledge must be grounded in either innate structures or basic experience. W hile this pro c ess of gro u n d i ng o ut k n o w l e dge t a k es m a n y f orms, t h e ro l e of metaphort h e o v e rt o r implicit description of one thing in terms of anotheris one of the most important. The discourse of programming and programmers is heavily metaphorical, yet the role of m eta p h or i n c o m p uter sc i e n c e is ofte n ign ore d or e v e n v i l ifi e d . T h e form a l prese ntati o n of computer languages tends to hide the necessarily informal methods that w e use to understand them. Thus the purpose of this chapter is to lay an analytical frame w ork for thinking about the w a y s i n w h i c h p e o p l e c o m e t o u n d e rs t a n d c o m p u t e rs a n d p r o gr a m s , a n d t o a rg u e f o r metaphor as a legitimate and necessary tool for this process. This w ill provide background for the follo w ing chapter, w hich takes a look at one particular metaphor or w ay of thinking that is of particular importance to computation, that of animate or anthropomorphic metaphor. In the present chapter, I w ill first outline some general theories of metaphor and particular ideas from these theories that w ill be useful, then move on to look at the role of metaphor in scientific discourse and in computation in particular. A number of frame w orks for programming are analy z ed in terms of the metaphoric structures they impose on their domain and on their users.

Le arn i ng a n e w fi e l d i n v o l v es l e arn i ng a n e w l a ngu age , or m ore pre c ise l y , n e w w a ys of using language. Technical fields in particular deploy everyday terms and usages in ne w w ays, a n d t h e f a c t t h a t w ords w i t h e v ery d a y m e a n i ngs su d d e n l y t a k e o n n e w m e a n i ngs t h a t are related but not identical to their old ones is a source of confusion for both the novice and the professi o n a l . D a v i d Pi m m (Pi m m 1 9 8 7) refers to th e p e c u l i ar m a n n erisms of m ath e m ati c a l discourse as the mathematics register , that is, a particular w ay of speaking w hich must be learned and relies strongly on metaphorical constructs. C omputation, being a relatively ne w and diversified field, does not yet have a single computational register. By looking at some of the metaphors employed in some parts of computational discourse, I hope to understand ho w the d isc o urse of c o m p utati o n is stru cture d . T h is a p pro a c h is so m e w h at c o ntrari a n , i n th e se nse that it deliberately emphasi z es the non-mathematical, metaphorical, and informal aspects of a field that has traditionally structured itself in terms of formal mathematics. By investigating the informal conceptual foundations of computing, w hich I believe in some senses are deeper than the mathematical foundations, I hope to be able to gain insights that w ill permit the design of ne w languages and environments for programming.

2.1

Theories of Metaphor

...metaphor refers to all those processes in w hich the juxtaposition either of terms or of concrete examples calls forth a netw ork of similarities w hich help to determine the w ay in w hich language attaches to the world.(Kuhn 1993, p539).

The term metaphor is used here not in a narro w linguistic sense, but in the sense of rich and complex metaphoric models (Lakoff and Johnson 1980). A metaphoric model is a w ay to structure the kno w ledge of one domain (the target) by mapping onto it concepts and relations from an existing domain (the source) that is already familiar. M etaphor in this sense is not a mere linguistic device used only for the figurative embellishment of otherw ise straightforw ard l a ngu age , b ut a fu n d a m e nta l w a y of l e arn i ng a n d stru cturi ng c o n c e ptu a l syste ms, a p art of e v ery d a y d isc o urse . M etaphors are so pervasive that they are sometimes hard to see. For instance, the common model and terminology of the behavior of electrical circuits is based on a metaphoric mapping to fluid flo w in pipes, w ith voltage mapping to w ater pressure, batteries to pumps, current to flo w , a n d so f ort h . In a l ess t e c h n i c a l a n d l ess o b v i o usl y m e t a p h ori c a l e x a m p l e , t h e A m eri c a n conception of anger is metaphorically derived from the image of a heated fluid in a container, giving rise to expressions like blo w ing off steam and containing his rage (Lakoff and Kvecs 1987). The metaphoric structure underlying such common concepts indicates that metaphoric models are not merely optional stylistic overlays to a fundamentally objective and literal mode of representation. Rather, they are a fundamental mechanism for encoding kno w ledge. M uch of our common cultural kno w ledge is in terms of metaphoric models (Lakoff and Johnson 1980). Since metaphoric processes are a fundamental part of ho w kno w ledge is structured, there can be no hard line dra w n bet w een metaphoric thought and other kinds. From a certain point of view, all thought is metaphoric:
N o t w o things or mental states ever are identical, so e v ery psychological process must employ o n e m e a ns or a n o t h er t o i n d u c e t h e i l l usi o n o f sa m e n ess. Ev ery t h o ugh t is t o so m e d egre e a metaphor (Minsky 1987, p299).

30

M etaphor

If a l l t h o ugh ts are e q u a l l y m e t a p h ori c a l , t h e n m e t a p h or is n o t a v ery use f u l a n a l y t i c category. H o w ever, some thoughts seem to be more metaphorical than others. There is a large space of possibilities lying bet w een the purely literal and the obviously metaphorical. Perhaps the most interesting cases are those in w hich a phrase or thought appears initially to be literal, b u t u p o n e x a m i n a t i o n t urns o u t t o b e b ase d i n m e t a p h or a ft er a l l . W e w i l l se e t h a t m a n y metaphors used in the discourse of mathematics, science, and technology are like this. It w i l l b e use f u l t o d ist i ngu ish t h e c o n c e p t o f a stru c t uri ng m e t a p h or fro m t h e c l ose l y related idea of an analogy ( W inston 1982) ( G entner 1989). Both aim to establish u n d erst a n d i ngs b y t h e cre a t i o n o f m a p p i ngs b e t w e e n d o m a i ns, b u t t h e t w o t erms c o n n o t e different aspects of this cognitive process. A nalogy usually refers to the construction of explicit mappings betw een tw o w ell-established domains, w hereas metaphor is more often implicit. The linguistic form of analogy, the simile, keeps the t w o domains safely separated by using terms s u c h a s like ( l i f e i s like a b o w l o f c h e rr i e s ) , w h i l e m e t a p h o r d r a w s a m o r e i m m e d i a t e connection (life is a journey ). M ore importantly, metaphor often plays a foundational role in t h e est a b l ish m e n t o f n e w , pre v i o usl y u nstru c t ure d d o m a i ns. T h e t w o t erms re a l l y c o n n o t e d iffere nt v i e w s of th e sa m e bro a d c ogn iti v e pro c ess, w ith th e v i e w thro ugh m eta p h or b e i ng more oriented to w ards the foundations of cognition. A nalogies can be po w erful learning tools, but if the thing learned is to become an important part of thinking, it must become integrated into the structures of the mindthat is, it must become a structuring metaphor. O ne dra ws an analogy, but one lives in metaphor.

2.1.1

The Contemporary Theory of Metaphor

M y primary tool for thinking about metaphor w ill be the theory put forth by G eorge Lakoff a n d M ark Jo h nso n (1 9 8 0)(La k o f f a n d Jo h nso n 1 9 8 0) a n d d e v e l o p e d f urt h er b y t h e m , Ev e S w e e tser (1 9 9 0)(S w e e tser 1 9 9 0), M ark T urn er (1 9 9 1)(T urn er 1 9 9 1) a n d o t h ers, a n d m ore r e c e n t l y l a b e l e d t h e c o n t e m p o r a r y t h e o r y o f m e t a p h o r (L a k o f f 1 9 9 3 ) . I n t h i s t h e o r y , metaphor is to be understood as any mapping bet w een normally separate conceptual domains. The purpose of this mapping is to structure an abstract, unfamiliar, or unstructured domain (the target) in terms of one that is more concrete, familiar, or structured (the so urc e). M etaphor is vie w ed more as a basic tool of cognition rather than a special turn of language, a n d m ost c o n c e pts are ge n erate d b y m eta p h ors. T h e e x c e pti o ns are th ose c o n c e pts th at are thought to be perceptual or cognitive primitives, such as u p or cat. Aside from these references t o c o n cre t e p h ysi c a l o b j e c ts a n d e x p eri e n c es, m e t a p h ori c a l u n d erst a n d i ng is t h e ru l e . In La k offs w ords, m eta p h or is th e m a i n m e c h a n ism thro ugh w h i c h w e c o m pre h e n d a bstra ct concepts and perform abstract reasoning (Lakoff 1993). The more narro w ly linguistic meaning of metaphor is called a metaphorical expression to distinguish it from the broader vie w of metaphor as a conceptual mapping.

2.1.1.1

The Conduit Metaphor

T h e c o n t e m p orary t h e ory h as i ts ro o ts i n M i c h a e l Re d d y s w ork o n w h a t h e c a l l e d t h e C onduit M etaphor (Reddy 1993), a detailed exposition of the system of ideas underlying the c o n c e pt of c o m m u n i c ati o n . Re d d y fo u n d th at th ere w as a c o nsiste nt m eta p h ori c a l su bstrate M etaphor 31

underlying talk about communications and ideas. This metaphor w as based on the idea that ideas w ere like physical objects, and that the purpose of language w as to package up ideas for transfer betw een minds. This insight w as illustrated by example sentences like: 1) H e couldnt put his thoughts a cross well.

2) Try t o pack more thoughts into fe w er w ords. 3) I gave him that idea. 4) W e t osse d the ideas back and forth .

The implications of this metaphor are that w ords function like packing crates for meanings, and that writing or speaking is a process of packing, shipping, and unpacking. Language as a w h o l e i s s e e n a s a c o n d u i t f o r tr a n sf e rr i n g m e a n i n gs fr o m m i n d t o m i n d . T h e u n st a t e d implication is that meaning is unproblematically conveyed by language. It further implies that the listener is essentially a passive recipient of meanings generated by speakers. T h ese usages a n d th e ir u n d erl y i ng m eta p h or are so c o m m o n p l a c e th at th e ir c o nti nge nt nature might be hard to see. To better illustrate this, Reddy proposed an alternative metaphor syst e m w h i c h h e c a l l e d t h e T o o l m a k ers Para d igm . T h is m e t a p h or syst e m p osi ts l ist e n ers isolated in cells, w ho transmit and receive crude instructions in the form of blueprints rather t h a n w ords b e t w e e n n e igh b ori ng c e l ls. T o m a k e a n y use o f t h ese tra nsm issi o ns, t h e y m ust
meaning

meaning words words

conduit: words contain and convey meanings

meanings6 meanings1

instructions meanings2 meanings5

toolmaker: words are instructions for constructing meanings

meanings3

meanings4

Figure 2.1: Comparing the conduit metaphor and the toolmakers paradigm (after Fig. 1 in (Reddy 1993)).

32

M etaphor

actively follo w the instructions and construct the described object. N aturally transmission is imperfect in this system, and each recreation of meaning is subject to the interpretation of the hearer. The Toolmakers Paradigm is intended to be a metaphorical representation of a constructivist theory of language, in w hich listeners are active constructors of meanings rather than passive recipients. The existence of an alternate metaphor is a po w erful tool for thinking about alternate th e ori es of l a ngu age . In th e c o n d u it m eta p h or, th e sh ari ng of m e a n i ng is assu m e d to b e th e default case, and any divergence of interpretation is a problem to be explained by faults in the transmission system. By contrast, the Toolmakers Paradigm emphasi z es that shared meanings are achievements, requiring careful coordination and interaction through limited channels of communication. A lthough the conduit/toolmakers example is a po w erful dual metaphor for thinking about constructivist theories of mind, Reddys main concern is to illustrate the pervasiveness of the c o n d u it m eta p h or a n d th e w a y th at it c a n p l a c e a stro ng b i as o n th e ori es of l a ngu age . T h e conduit metaphor plays a dual role in the history of the contemporary theory of metaphor. It stands as an example of a common metaphor w orked out in detail, and as an illustration of ho w linguistic theory itself can be built on and influenced by unquestioned metaphors. Lakoff and Johnson, inspired by Reddys effort, embarked on a more comprehensive effort to analy z e the metaphor systems underlying everyday thought. They summari z e their findings b y e x pressi ng t h e m e t a p h ors as sh ort d e c l ara t i o ns o f t h e m a p p i ng: L O V E IS A J O U R N E Y o r EM O TI O N S ARE S U BST A N CES. A ccording to Lakoff:
M ost people are not too surprised to discover that emotional concepts like love and anger are understood metaphorically. W hat is more interesting, and I think more exciting, is the reali z ation that many of the most basic concepts in our conceptual system are also normally comprehended via metaphorconcepts like time, quantity, state, change, action, cause, purpose, means, modality, and even the concept of a category. These are concepts that enter normally into the grammars of l a ngu ages, a n d if th e y are i n d e e d m eta p h ori c a l i n n ature , th e n m eta p h or b e c o m es c e ntra l to grammar (Lakoff 1993, p.212).

Since computer programming concerns itself w ith many of these same basic concepts, w e should not be surprised to find that metaphors underlie the discourse of computation, and that t h ese m e t a p h ors are v ari a n ts o f t h ose f o u n d i n ord i n ary d isc o urse . T o t a k e o n e e x a m p l e , Lakoffs studies have revealed that the metaphorical representation of events in English involves a b asi c a l l y sp a t i a l m e t a p h or, w i t h st a t es b e i ng re prese n t e d as l o c a t i o ns, st a t e-c h a nge as movement, causes as forces, purposes as destinations, and so forth. This metaphor surfaces in c o m p utati o n thro ugh su c h p hrases as th e pro c ess is blocked or t h e m a c h i n e went into a run state . These usages are so much a part of everyday use that, like the conduit metaphor, they hardly seem like metaphors at all. The vie w point of the contemporary theory of metaphor leaves us w ith t w o points that w ill i n f o r m t h e r e s t o f t h i s a n a l y s i s: f i rs t , t h a t s o m e o f o u r m o s t f u n d a m e n t a l c o n c e p t s a r e structured metaphorically, and second, that it is possible (as the Toolmakers Paradigm sho ws) to gain a ne w vie w point on these concepts by proposing alternate metaphors.

M etaphor

33

2.1.2

Dead Metaphors

W eve seen that some metaphorical structures are so ingrained into our habits of thought a n d l a ngu age t h a t t h e y are v ery d i f f i c u l t t o se e as m e t a p h ors. T h e y ra ise t h e q u est i o n o f w hether such usages are really metaphorical in any meaningful sense. A dead metaphor is o n e th at h as b e c o m e a c o n v e nti o n a l usage or p hrase a n d so h as (a c c ord i ng to so m e th e ori es of metaphor) lost the live mapping bet w een its domains. Falling in love is one examplethe p hrase is so ro ut i n i z e d t h at it d o es n ot re c a l l a n y f e e l i ngs of p h ysi c a l f a l l i ng, a lt h o ugh t h e metaphoric mapping is easy enough to recreate. Kick the bucket is a better example, since its 2 live roots are even more distant . There is w ide diversity of opinion on the question of dead metaphors. A ccording to Black (Black 1962), dead metaphors are not really metaphors at all, but should instead be considered as separate vocabulary items. Lakoff is dubious about the utility of the concepthe believes that most conventionali z ed phrases still retain traces of their origins in living metaphors (Lakoff a n d Jo h nso n 1 9 8 0 , p 5 5). G i b bs ( G i b bs 1 9 9 3) p o i nts o ut th at if a m eta p h or w as tru l y d e a d it w o u l d l ose i ts c o m p osi t i o n a l q u a l i t i es, b u t i n f a c t t h e y st i l l re m a i n . Y o u c a n u n d erst a n d expressions like falling head-over-heels in love even if you had never heard that particular variant of falling in love . Since the mapping bet w een domains can be reactivated to comprehend this sort of novel phrase, the metaphor lives on after all. M e t a p h ors use d i n t e c h n i c a l d isc o urse o f t e n a p p e ar t o b e d e a d . Si n c e t h e t e c h n i c a l meanings of phrases like a blocked process or pushing a value onto the stack, are perfectly clear to experts, their metaphorical origins are often dismissed and ignored. N onetheless the v i e w p o i n t o f La k o f f a n d G i b bs is st i l l use f u l a n d p erh a ps n e c essary t o u n d erst a n d i ng t h e c o n c e ptu a l b ases of te c h n i c a l u n d ersta n d i ng. In th is v i e w , e v e n w h e n te c h n i c a l terms h a v e taken on w hat seems like an unproblematic formal meaning, they continue to maintain a link back to their metaphor of origin, because the mechanisms for understanding are metaphorical at their roots. M etaphors can differ in the degree to w hich they are taken for granted and kept out of consciousness, but are rarely so dead as to completely detach themselves from their origins. A n oth er e xtre m e l y c o n v e nti o n a l i z e d m eta p h or use d i n c o m p utati o n is th e tre atm e nt of memory as space and data as objects that are located and move w ithin that space. The degree of conventionali z ation of these usages is so high that some people get quite annoyed if attention is dra w n t o t h e ir m e t a p h ori c a l u n d erp i n n i ngs. T h e M E M O R Y I S SPA CE m e t a p h or m igh t b e considered dead since it is extremely conventionalized, but it is still alive in Lakoffs sense the mapping bet w een domains is still present and can be generative of ne w constructs, such as the sl a ngy t erm b i t b u c k e t (t h e m y t h i c a l sp a c e w h ere l ost b i ts go) or t h e e n d l ess stre a m o f resp e c t a b l e t e c h n i c a l t erms t h a t re f l e c t t h e m e t a p h or ( garb age c o l l e c t i o n , p art i t i o n , allocation, compacting, and so forth). P e r h a p s transparency is a b e tt er m e t a p h or t h a n d e a t h t o d escri b e t h e c o n d i t i o n o f t h e metaphors underlying technical terminology. They do such a good job of structuring their target

Apparently the phrase derives from the actions of dying farm animals.

34

M etaphor

domain that they seem to disappear, and the lens of metaphor becomes an invisible pane of glas s . T h e q u esti o n re m a i ns as to w h at m a k es p arti c u l ar m eta p h ors a c h i e v e tra nsp are n c y . I sp e c u l a t e t h a t m e t a p h ors b e c o m e tra nsp are n t w h e n t h e y i m p ose a stro ng stru c t ure o n a domain that w as previously unstructured. These metaphors essentially force one to think about the target domain in their o w n terms, to the point w here any alternative w ay of structuring the domain becomes forgotten and almost unthinkable. At this point, the w inning metaphor is ready to be taken literally. Such metaphors have been labeled theory-constitutive metaphors b y s o m e p h i l oso p h ers o f sc i e n c e . T h a t is, ra t h er t h a n si m p l y m a p p i ng b e t w e e n t h e c o n c e p ts a n d v o c a b u l ary o f t w o e x ist i ng d o m a i ns, as c o n v e n t i o n a l m e t a p h ors d o , a t h e ory-c o nst i t u t i v e m eta p h or c a n b e sa i d to create th e stru cture of a n e w d o m a i n , b ase d o n th e stru cture of a n existing one. W h ere o n e t h e ory-c o nst i t u t i v e m e t a p h or is d o m i n a n t (f or i nst a n c e , t h e m e t a p h or o f electricity as the flo w of fluid, or of computer memory as a space), the terms that are brought to the target domain tend to become conventionali z ed and transparent, such as the term current in electrical theory. But not all theories and metaphors are as w ell established as these. Even memory is sometimes vie w ed through alternate metaphors, i.e. as a functional mapping betw een a d d r e ss e s a n d v a l u e s . C o m p u t a t i o n a l d i s c o u rs e s e e m s t o h a v e a p a rt i c u l a r n e e d t o m i x metaphors, as w e shall see.

2.1.3

The Metaphorical Nature of Scientific Understanding

T h e p l a c e o f m e t a p h or i n t h e d isc o urse o f sc i e n c e h as a l w a ys b e e n pro b l e m a t i c . T h e distinction bet w een literal and metaphorical meanings w as first promulgated by Aristotle, w ho grudgingly ackno w ledged the utility of metaphor in poetry but demanded that it be eliminated from the discourse of natural science. Lloyd argues that this dichotomy w as in fact necessary for the creation of a ne w rhetorical territory in w hich metaphor w ould be banned and literalism could flourish:
...the distinction between the literal and the metaphorical...was not just an innocent, neutral piece of logical analysis, but a w eapon forged to defend a territory, repel boarders, put do w n rivals (Lloyd 1989, p23).

So, the domain of science w as in a sense brought into being by the very act of banishing metaphor and other poetic forms of language. Scientific thought w as to be of a form that dealt only with literal truth. D espite Aristotle, metaphors are commonly employed in scientific discourse, particularly in informal and educational settings. W hile scientific rhetoric may aspire to the literal, it cannot avoid the need to bootstrap ne w theories from old concepts using metaphor. Some theories of m e t a p h or i n sc i e n c e re l ega t e t h e use o f m e t a p h ors f or tra i n i ng t o a se p ara t e c a t egory o f e x egeti c a l m eta p h or , b ut as K u h n p o i nts o ut (K u h n 1 9 9 3), e v ery sc i e ntist m ust b e tra i n e d and thus such metaphors are not at all marginal, but instead are a crucial part of the w ay in w hich a scientific field reproduces itself. The question then becomes w hether the exegetical m eta p h ors are l i k e sc affo l d i ng, use d to ere ct a form a l stru cture i n th e m i n d b ut d isc ard a b l e w hen the task of construction is completed, or w hether the structure maintains a live, dynamic relationship to the metaphors that allowed it to be built. M etaphor 35

G iven that metaphor is a part of everyday scientific practice, w hy do most scientists act as literalists, paying little or no attention to metaphor and occasionally expressing hostility to the v ery i d e a o f i n v est iga t i ng t h e m ( G ross a n d Le v i tt 1 9 9 4)? T h e ro o ts o f sc i e n t i f i c rh e t ori c s a d h ere n c e t o l i t era l ism m a y b e so ugh t i n t h e so c i a l pra c t i c es o f sc i e n t ists. T h e pra c t i c e o f science demands the use of a rhetoric that promotes literal rather than metaphoric construals of l a ngu age . Lato ur (Lato ur 1 9 8 7) p a i nts a p i cture of sc i e n c e as a c o ntest to esta b l ish fa cts, a contest that depends as much on rhetorical moves as it does on laboratories. Scientists jockey to make their statements strong, so they w ill be taken as facts, w hile simultaneously w orking to w e a k e n th e state m e nts of ri v a ls b y p a i nti ng th e m as c o nstru cti o ns, h e n c e q u esti o n a b l e . T h e rh e t ori c a l t o o ls f or m a k i ng a st a t e m e n t f a c t u a l La t o ur c a l ls positive modalities ( i . e . , a b a l d state m e nt of fa ct) w h i l e th e to o ls for d o i ng th e o p p osite are negative modalities (i . e . , D r. X claims that [statement of fact]). It is around modalities that w e w ill find the fiercest disputes [Latour, op. cit. , p25]. H ere, since w e are interested specifically in rhetoric rather than ongoing c o ntro v ersi es a m o ng p h i l oso p h ers of sc i e n c e , w e n e e d n ot tro u b l e o urse l v es o v er w h eth er Latours model of science is complete. It does lead us to speculate that the competitive pressure a m o ng sc i e ntists to esta b l ish fa cts w i l l a lso c o ntri b ute to th e ir te n d e n c y to h i d e or stri p th e metaphors from the language. A statement that contains obvious metaphors is w eaker than one that contains either no metaphors or only those so conventionali z ed as to be dead. M etaphor use is not exactly a modality in Latours sense, but it can be seen that similar dynamics might apply and tend to either strip metaphor out of scientific discourse, or disguise it as something else. H o w e v er, n o t a l l sc i e n c e is su ff i c i e n t l y d e v e l o p e d t h a t i t c a n m a i n t a i n t h e pre t e nse o f l i t era l n ess. M e t a p h ors are c o m m o n l y use d t o i n tro d u c e v o c a b u l ary a n d b asi c m o d e ls i n t o sc i e ntifi c fi e l ds: th e ir fu n cti o n is a sort of catachresist h a t is, t h e y are use d t o i n tro d u c e th e oreti c a l term i n o l ogy w h ere n o n e pre v i o usl y e x iste d . (B o y d 1 9 9 3). T h e term c ata c hresis w as introduced by M ax Black in his influential early w ork on the interaction theory metaphor (Black 1962). The interaction vie w posited a dynamic interaction bet w een elements of the t w o linked domains. But Black did not believe that metaphors used in science w ere still interactive, since the meanings of the scientific terms w ere fixed, and that metaphoric vocabulary creation w a s mere c ata c hresis, rath er th a n a pro p er m eta p h or. B o y d d isagre es, h o l d i ng i nste a d th at scientific use of metaphor does double dutyit creates vocabulary to describe a ne w domain, and at the same time makes this ne w domain interact w ith the other domain involved in the metaphor. B o y d t erms m e t a p h ors t h a t are esse n t i a l i n sc i e n c e theory-constitutive m e t a p h ors. H e distinguishes these from metaphors used solely for pedagogic purposes, although these might have been more important earlier in the sciences history. A good theory-constitutive metaphor is a tool that lets a scientist do his job of accommodating language to the causal structure of the w orld or carving the w orld at its joints. 3 H is primary example of a theory-constitutive metaphor is the use of computation as a foundational metaphor for cognitive psychology.

3 A metaphor introduced by Plato in Phaedrus .

36

M etaphor

The use of metaphor in theory formation and change depends upon this open-endedness, especially in young fields. H o w ever, the metaphor persists even as the scientific theory matures a n d t h e p art i c u l ar p o i n ts o f a n a l ogy b e c o m e e x p l i c i t . So m e t i m es c o m p l e t e e x p l i c a t i o n is impossible, but this is not an indication that metaphor is too imprecise to serve as the basis of scientific theori z ing. Rather, it means that metaphors are tools among other tools that scientists use to achieve their goals. M etaphoric interpretation remains open-ended as long as scientific theories remain incomplete.

2.1.4

Formalization and Metaphor

C omputer science contains a strong ideological bias against the recognition of metaphor. Its emphasis on formalism might almost be seen as a technology for making metaphors seem as dead as possible. Formalists naturally oppose metaphor as a particularly insidious form of nonrigoro us th i n k i ng. In c o m p uter sc i e n c e , Edsger D i j kstra h as m a d e h is o p i n i o ns of m eta p h or w idely kno w n:
By means of metaphors and analogies, w e try to link the ne w to the old, the novel to the familiar. U n d er suffi c i e ntl y sl o w a n d gra d u a l c h a nge , it w orks re aso n a b l y w e l l; i n th e c ase of a sh arp discontinuity, ho w ever, the method breaks do w n.... C oping w ith radical novelty requires... [that] one must consider ones o w n past, the experiences collected, and the habits formed in it as an unfortunate accident of history, and one has to approach the radical novelty w ith a blank mind , consciously refusing to try to link history w ith w hat is already familiar, because the familiar is hopelessly inadequate [emphasis added]. ...both the number of symbols involved and the amount of manipulation performed [in complex computations] are many orders of magnitude larger than w e can envisage. They totally baffle our imagination, and we must, therefore, not try to imagine them (D ijkstra 1989).

T h i s v i e w , w h i l e i t s e e m s w i l d l y w r o n g t o m e , i s a t l e a s t gr o u n d e d i n a d e f i n i t e epistemological theory. To D ijkstra, certain domains like computation (quantum mechanics is another example) are so radically ne w that they must be approached w ith a totally blank mind. This theory is basically the opposite of the one w e are developing here, namely that computation, like anything else, is understood in terms of structures defined by mappings from other domains of kno w ledge. In place of metaphor and imagination, D ijkstra advocates the use of formal mathematics and logic. H o w e v er, f orm a l ism d o es n o t re a l l y o f f er a n esc a p e fro m m e t a p h or, f or t w o se p ara t e reasons. First, even formal mathematics is riddled w ith metaphorical terms and concepts, such 4 as the notion of a function having a slope (a p h ysi c a l m eta p h or) or b e i ng w e l l-b e h a v e d (a n a n i m ate m eta p h or). Se c o n d l y , v ery fe w m ath e m ati c i a ns w o u l d c l a i m th at th e use of form a l methods exempts them from the need to use their imagination! A more realistic vie w point on the relationship bet w een metaphor and formalism may be found in Agres claim that the defining characteristic of technical language is that it links together t w o separate domains of reference: the real-w orld domain being formali z ed and the Platonic

These examples are taken from D avid Pimms analysis of mathematical language (Pimm 1987).

M etaphor

37

re a lm of math emati cs (A gre 1 9 9 2) (A gre 1 9 9 6). T h is cross-d oma i n ma p p i ng is esse nti a l l y a metaphorical process in w hich aspects of the real w orld target domain are understood in terms of the formali z ed and w ell-understood source domain of mathematics. Such a mapping w ill al w ays emphasi z e certain parts of the w orld at the expense of others. Aspects that are readily translated into mathematical terms w ill be preserved by the metaphor, w hile other aspects w ill become marginalized . T h e c o n c e pt of m argi ns d eri v es fro m D erri d a s philosophical deconstructions, in particular the idea that metaphors or w orld-vie ws can contain hierarchical oppositions w hich classify phenomenon into central and marginal categories. The phenomenon of marginali z ation w ill cause research programs to organi z e themselves around p art i c u l ar c e ntra l pro b l e ms (t h ose t h at t h e m at h e m at i cs c a n d escri b e) w h i l e p ush i ng ot h er e q u a l l y i m p orta nt pro b l e ms o ut i nto su bfi e l ds, i nto are as for future w ork , or o ut of consideration entirely. Agres solution to this form of intellectual tunnel-vision is to deploy ne w m e t a p h ors a n d m ore i m p ort a n t l y t o d e v e l o p a re f l e x i v e cri t i c a l a w are n ess o f t h e ro l e o f metaphor in technical work. D econstruction is a set of techniques for achieving this sort of a w areness by systematically questioning the dominant oppositions and metaphors that structure a field of kno w ledge. O ne of these techniques, inversion, is to construct an alternate system that inverts the center and margins created by the dominant metaphor, thereby exposing the assumptions of the original metaphor and bringing the previously marginali z ed aspects of the phenomenon to attention. Reddys C onduit metaphor is a good example of such an inversion. Agres project is to deconstruct w hat he sees as the dominant mentalistic metaphors w ithin AI and C artesian-influenced vie ws in general. M entalism is a broad structuring metaphor that p osi ts a n i n t ern a l re prese n t a t i o n a l sp a c e i n b o t h h u m a ns a n d c o m p u t ers, i n w h i c h re prese n t a t i o n a l o b j e c ts d w e l l a n d m e n t a l pro c esses t a k e p l a c e . M e n t a l ism , A gre argu es, e m p h asi z es t h e i n t ern a l m e n t a l pro c esses t h a t t a k e p l a c e i nsi d e t h is sp a c e a t t h e c ost o f m argi n a l i z i ng th e i ntera cti o ns b et w e e n i nsi d e a n d o utsi d e . T o c o u ntera ct th is, h e offers th e a l t e r n a t i v e m e t a p h o r s y st e m o f interactionism , w h i c h e m p h a s i z e s p r e c i s e l y t h e o p p o s i t e phenomena. From the interactionist perspective, the dynamic relationship of an agent and its e n v iro n m e n t is o f c e n tra l i n t erest , w h i l e t h e m a c h i n ery i nsi d e t h e age n t t h a t ge n era t es i ts behavior is secondary. M y o w n pro j e ct c a n b e v i e w e d , l o ose l y , i n d e c o nstru cti v e terms. In th e n e xt c h a pter, I explore use of animism in describing the w orld in general and computation in particular. The language of computation appears to involve both formal mathematical language and a more i nform a l use of v ari o us m eta p h ors, p arti c u l arl y m eta p h ors th at m a p c o m p utati o n o n to th e domain of animacy. W hile neither mode is completely dominant, the use of animism is generally confined to pedagogic or informal contexts, and is in some sense marginali z ed by the strong bias in favor of mathematical formalism that pervades academic discourse. By making animism the central concept of my analysis of programming languages, and designing ne w agent-based languages that incorporate the use of animate metaphors, I hope in some sense to deconstruct the languages of computation. T h e p urp ose o f su c h d e c o nstru c t i o n is t o b e cri t i c a l , n o t d estru c t i v e . C o m p u t a t i o n h as u n q u est i o n a b l y pro v i d e d p o w erf u l n e w c o n c e p t u a l t o o ls f or l a y i ng h o l d o f t h e w orl d . B u t 38 M etaphor

computation has its limits, as its practitioners are constantly forced to ackno w ledge. Some of th ese l imitati o ns ma n ifest th emse l v es i n re l i a b i l ity pro b l ems, brittl e n ess, a n d th e d iffi c u lti es encountered by both novices and experts in expressing simple ideas in the form of programs. Probing the conceptual underpinnings of the metaphors used to construct computation is one w ay to try and understand, and possibly circumvent, these limitations.

2.2

Metaphors in Programming
C omputers are useless; they can only give you answ ers. Pablo Picasso

M e t a p h or p l a ys a k e y ro l e i n t h e d isc o urse o f sc i e n c e as a t o o l f or c o nstru c t i ng n e w c o n c e pts a n d term i n o l ogy . T h e uti l ity of th e ory-c o nstituti v e m eta p h ors d e p e n ds u p o n h o w a c c urate l y th e c o n c e pts th e y ge n erate a ctu a l l y d o c arv e th e w orl d at its n atura l j o i nts , i n Boyds terms. M ore radically constructivist writers have argued over the assumption that such natural joints exist to be found (Kuhn 1993), but most are realists w ho believe at least that the n a t ura l w orl d e x ists a n d h as stru c t ure i n d e p e n d e n t l y o f o ur m e t a p h ors. H o w e v er, i n t h e discourse of computer science metaphor plays an even more central role. H ere metaphors are used not so much to carve up a pre-existing natural w orld, but to found artificial w orlds w hose characteristics can then be explored. The metaphors create both the w orld and the joints along w hich it can be carved. C omputer scientists thus live in metaphor the w ay fish live in w ater, and like fish rarely take note of their medium. Their metaphors tend to become transparent, and so terms that start their c are ers w i t h c l e ar m e t a p h ori c a l ro o ts, su c h as stru c t ures , o b j e c ts , or st a c ks , v ery quickly gather formalized technical meanings that appear to be detached from their origins in the source domain. This phenomenon exists in other fields but is particularly acute in computer systems because the objects involved are so hidden from vie w that the only terms w e have for referring to them are metaphorical. This makes the metaphor dead on arrivalsince there is no truly literal w ay to refer to computational objects, the metaphorical terms soon take on a literal quality. B u t u n d er o ur v i e w o f m e t a p h or, t e c h n i c a l t erm i n o l ogy d o es n o t re a l l y e v er b e c o m e completely detached from its metaphorical roots. In this section w ell take a look at some of the metaphors underlying computation and the diverse set of metaphorical models that underlie progra m m i ng l a ngu ages. A t h e m e o f t h e d isc ussi o n w i l l b e t h e i d e a t h a t a n t hro p o m orp h i c metaphors are often present in computation, in varying degrees of explicitness. This derives from the fact that programs are often concerned w ith action and actors, and that our tools for understanding this domain are grounded in our understanding of human action. This idea is taken up in more detail in the next chapter.

2.2.1

The Idea of Computation

C omputation itself is a structuring metaphor for certain kinds of activity in both people and machines. H uman behavior may be seen as a matter of computing the answ er to the problem of getting along in the w orld, although there are certainly other w ays to look at human activity. M etaphor 39

Similarly, a computer (w hich from a more literal vie w might be seen as nothing more than a c o m p l e x e l e c tr i c a l c i r c u i t) m a y b e s e e n v a r i o u s l y a s s o l v i n g p r o b l e m s , m o n i t o r i n g a n d controlling external devices, servicing its users, simulating a collection of virtual machines, and so f ort h . T h e us e o f t h e t erm c o m p u t a t i o n t o d escri b e t h e a c t i v i t y o f c ert a i n c o m p l e x electronic devices is itself metaphorical, a historical artifact of the computers origins. As an organi z ing metaphor, it privileges certain aspects of the domain over others. In particular, like the mentalistic vie w of the mind, it privileges the formal operations that take place inside the a computer while marginalizing the interactions of the computer with the outside world. H istorically, computation gre w up around the formal notion of a mechanical reali z ation of a m a t h e m a t i c a l f u n c t i o n . A c o m p u t e r w a s s e e n a s a d e v i c e f o r a c c e p t i n g a n i n p u t str i n g , generating an output, and then halting. This model w as perfectly adequate for the tasks that e arl y c o m p uters w ere ask e d to p erform (su c h as cry ptogra p h y) b ut w as stretc h e d furth er b y l ater a p p l i c ati o ns th at c o u l d n ot b e so re a d i l y c ast as pro b l e m so l v i ng . In p arti c u l ar, th e problem-solving model lacked any notion of an ongoing relationship w ith the external w orld. C yberneticists such as G regory Bateson w ere thus impelled to attack the computational model for ignoring feedback relationships (Bateson 1972), and more recently a rebellious faction of the artificial intelligence field has gro w n dissatisfied w ith the problem-solving model of controlling autonomous agents and has proposed alternative models that emphasi z e interaction w ith the w orld (Agre 1995). O f course, despite the limitations of the formal model of computation, computing devices have since been employed in a vast array of applications that involve this kind of ongoing, timeembedded control. A great many more computers are employed as embedded control devices in mechanisms such as cars, airplanes, or micro w ave ovens than as purely symbolic problemsolvers. So the limitations of the metaphor have not, in this sense, proved to be a limitation on practice. H o w ever, they have certainly had their affect on computational theory, w hich on the w hole has had little relevance to the design of embedded control systems.

2.2.2

Metaphors Make Computation Tangible

Ex p l i c i t m e t a p h ors are o f t e n use d t o t e a c h b egi n n ers h o w t o progra m . O n e c o m m o n example, by no w a clich, is to describe the interpretation of a program as similar to follo w ing the steps of a recipe. These instructional metaphors allo w a student to understand the abstruse o p erati o ns of th e c o m p uter i n terms b orro w e d fro m m ore fa m i l i ar d o m a i ns. T h is is a l m ost a necessity for learning about the operations of a system that cannot be directly perceived. Since th e p urp ose of th ese m eta p h ori c m o d e ls is to d escri b e so m eth i ng th at is h i d d e n i n terms of something visible, the source domains are often taken from the concrete 5 physical w orld, such as boxes containing pieces of paper as a metaphor for variables containing values.

5 I dislike the term concrete and its paired opposite abstract in this context, but since they are generally accepted I w ill continue to use them. The reason for my dislike is that they are inaccurate. The process of executing a MOVE instruction inside the computer is just as concrete as t h e a c t o f m o v i ng a block from one box to another: it is not an abstraction, but an actual physical change. The difference is not one of concreteness but of familiarity and accessibility to the senses. I prefer the term tangible (fro m th e Latin tangere , to touch) as a replacement for concrete, because it better denotes the relevant feature of

40

M etaphor

( M a y er 1 9 8 9) sh o w e d t h a t gi v i ng n o v i c es m e t a p h ori c a l m o d e ls o f c o m p u t er l a ngu age interpreters resulted in improved learning compared to a more literal technical presentation. M a y er use d a v ari ety of m eta p h ori c a l m o d e ls i n h is e x p eri m e nts. O n e su c h m o d e l i n c l u d e d mappings such as ticket w indo ws for input and output ports, scoreboards for memory, and a to-do list w ith an arro w marker for the interpreters program and program counter. This model w as presented both as a diagram and a textual description. Students w ho w ere presented w ith the model did better on tests, particularly on problems requiring transferthat is, problems th at i n v o l v e d c o n c e pts n ot prese nte d d ire ctl y i n th e origi n a l i nstru cti o n a l m ateri a ls. F urth er studies sho w ed that presenting the model before the main body of material resulted in students w ho scored higher on tests than those w ho had the model presented to them afterw ards. This supports the idea that familiarity w ith the model aids in the assimilation of the technical content by giving it a meaningful context. So m eti m es ta ngi b l e m eta p h ors c a n resu lt i n i n v a l i d i nfere n c es th at bri ng o v er irre l e v a nt characteristics of the source domain. In one case, students w ho w ere told a variable w as like a box inferred that, like a physical box, it could hold more than one object (Boulay 1989). In a si m i l ar v e i n , st u d e n ts sh o w n t h e se q u e n c e o f assign m e n t st a t e m e n ts L ET A=2; L ET B=A interpreted them to mean (again using the container metaphor) that a single concrete object, 2, is first placed into A, t h e n taken out o f A a n d p u t i n t o B, l e a v i ng A e m p t y . In t h is c ase t h e students w ere overapplying the object and containment metaphors, concluding that 2 h a d t h e property of only being capable of being in one place at one time and thus having to leave A before it could be in B. These sorts of overattribution errors indicate that learning to apply a metaphor is not al w ays a simple matter. In addition to the metaphoric mapping itself, one must also know the limits of its application. O f c o urse a n a ltern ati v e to usi ng c o n crete m eta p h ors for c o m p utati o n is to c h a nge th e c o m p u t er syst e m i tse l f so t h a t i ts o p era t i o ns a c t u a l l y are c o n cre t e (t h a t is, t a ngi b l e). T h is p ossi b i l i t y is d isc usse d i n C h a p t er 4 . Syst e ms w i t h t a ngi b l e i n t erf a c es st i l l m igh t ge n era t e problems of invalid inference from the physical domain, but provide an opportunity for users to debug their metaphoric mapping through interaction w ith the objects of the target domain.

2.2.3

Metaphoric Models for Computation

In this section w e examine some of the common models of programming and the metaphor systems that underlie them. These include: t h e imperative model, in w hich the computer is cast in the role of a sequential instruction follower; t h e functional m o d e l , w h i c h e m p h a s i z e s t h e c o m p u t a t i o n o f v a l u e s r a t h e r t h a n t h e sequential following of instructions;

being accessible to the senses. There is no such substitute for abstract , ho w ever. A bstruse o r obscure , both of w hich essentially mean hidden from vie w , are better, but they have an unfortunate connotation of inherent difficulty or complexity.

M etaphor

41

t h e procedural m o d e l , w h i c h i n t egra t es t h e i m p era t i v e a n d f u n c t i o n a l m e t a p h ors a n d provides a po w erful method of decomposing programs into parts; the object-oriented model, w hich reorgani z es a program around the data that it manipulates, and is deliberately founded on a metaphor of physical and social objects; t h e constraint model, w hich allo ws a programmer to combine procedures w ith declarative information about w hat they do.

T h e a n a l y s i s p r e s e n t e d h e r e i s i n t e rms o f t h e b r o a d m e t a p h o rs u s e d t o e x p l a i n a n d understand programs, and w ill gloss over many of the more formal properties of programming languages. For instance, (Steele and Sussman 1976) presents the fascinating result that many imp erati v e c o nstru cts, su c h as goto, can be easily simulated using only functional constructs given a language that supports recursive high-order procedures. D espite this theoretical result, and many other similar ones that demonstrate that different languages have equivalent formal po w ers, the basic concepts used to make sense of imperative and functional programs remain quite distinct. T h e d isc ussi o n h ere se ts t h e st age f or t h e n e x t c h a p t er, w h i c h e x p l ores o n e p art i c u l ar aspect of metaphorical grounding in more detail (in particular, see section 3.3.2). This is the role of anthropomorphic or animate metaphors in the description of computational activity. This metaphor system is pervasive in computation for historical and practical reasons. In particular, w e w i l l l o o k at agent-based m o d e ls of progra m m i ng, w h i c h are e x p l i c itl y orga n i z e d aro u n d anthropomorphic metaphors.

2.2.3.1

The Imperative Model

O n e o f t h e f u n d a m e n t a l m e t a p h or syst e ms use d t o d escri b e c o m p u t er pro c esses is t h e imperative model. This model underlies most discourse about the hard w are levels of computer s y s t e m s , a n d i s t h e s o u r c e o f s u c h t e r m s a s instruction a n d command . T h e i m p era t i v e metaphor underlies most naive models of computing such as the transaction level model (M ayer 1 9 7 9 ) a n d t h e d e s c r i p t i o n s o f c o m p u t a t i o n f o u n d i n b e g i n n e r s t e x ts . It a l s o f o r m s t h e conceptual basis underlying popular early computer languages such as B ASIC and F O RTRA N . But it may also be found in its earliest forms in Turings and von N eumanns description of the first th e oreti c a l c o m p uti ng m a c h i n es, a n d so is re a l l y at th e v ery ro ot of th e m o d ern i d e a of computation itself. The imperative model captures the notion of the computer as a device capable of sequentially executing simple instructions according to a stored program. The basic elements of this metaphoric model are: 42 a fixed set of primitive actions that the computer is capable of executing in a single step, that perform operations on memory or on I/ O devices; a single active instruction follo w er that reads a program a step at a time and takes an action based on the current step; a progra m t h a t c o n tro ls t h e i nstru c t i o n f o l l o w er, c o nsist i ng o f a se q u e n c e o f st e ps t h a t either specify primitive actions or control-flo w changes; a passive memory that the follo w er can read from and write to; M etaphor

a set of input and output devices.

In the next chapter w e w ill look at the anthropomorphic roots of the imperative metaphor. H ere w e should just notice the emphasis on a single implicit agent, step-by-step activity, and the mechanical nature of each step. In the imperative metaphor, the interpreter is visuali z ed as a sort of person, albeit a rather stupid or robotic person, reading instructions and follo w ing them i n a m a n n er th at c o u l d re a d i l y b e d u p l i c ate d b y m a c h i n ery . Ea c h pri m iti v e a cti o n is si m p l e enough to be executed w ithout any need of further interpretation; no intelligence or kno w ledge is required of the instruction follo w er. W h at sort of l a ngu age is su ita b l e for sp e c ify i ng th e progra m for su c h a c o m p uter? T h is model is called the imperative model because the elements of such languages are commands. If such a statement w ere to be translated into English it w ould be in the imperative mode. They are instructions to the implicit agent inside the computer. A n imperative sentence (i.e., G ive me the p i p e!) h as a n i m p l i e d su b j e ct, n a m e l y th e target of th e c o m m a n d , w h i c h d o es n ot a p p e ar explicitly as a w ord but is implied by the structure of the sentence. Similarly, in an imperative language the subject of the instruction does not appear explicitly but is impliedthe computer itself, or the instruction follower within it, is the implied subject who will execute the command.

2.2.3.2

The Functional Model

If the imperative model emphasi z es control of sequential operations, then the functional m o d e l e m p h a s i z e s v a l u e s , e x p r e ss i o n s , a n d c o m p u t a t i o n i n t h e m a t h e m a t i c a l s e n s e . I n functional languages (i.e. H askell ( H udak, Jones et al. 1991)), the fundamental unit is not an imperative command, but an expression that specifies a value. W hile most languages support functional expressions to some extent, pure functional languages enforce the functional style by having no support for state and no imperative constructs like assignment and sequencing. M ost fu n cti o n a l l a ngu ages su p p ort h igh-ord er fu n cti o ns, or fu n cti o ns th at c a n a c c e pt oth er functions as arguments and return them as values. The functional model uses the concept of a mathematical function as its founding metaphor. Like the imperative model, the functional model w as present at the very start of the history of computing. W hereas the imperative model emphasi z es action, the functional model emphasi z es the results of action, expressed as a functional relation bet w een input and output items. The Turing machine computes a function using imperative operations. In some sense, the joining of these t w o different w ays of thinking in the Turing machine w as the founding act of computer science, and the tw o models continue to be interw oven in various w ays as the field gro ws. F u n c t i o n a l l a ngu ages are f a v ore d as a t h e ore t i c a l t o o l b y c o m p u t er sc i e n t ists, b e c a use fu n cti o n a l progra ms are m u c h e asi er to a n a l y z e th a n th ose th at i n c orp orate state a n d state change. They also permit the use of a variety of po w erful expressive techniques, such as la z y e v a l u ati o n , w h i c h are pro b l e m ati c i n th e prese n c e of state c h a nge . C o n v erse l y , fu n cti o n a l languages do poorly at integrating imperative constructions and state, w hich in turn introduces issues of time, control, and seriali z ation. There have been quite a fe w efforts to graft imperative capabilities onto purely functional languages, but as one paper on the subject put it, fitting action into the functional paradigm feels like fitting a square block into a round hole (Jones and W adler 1993). M etaphor 43

O n e o f t h e m o s t s u c c e ss f u l e n d - u s e r p r o gr a m m i n g t e c h n i q u e s e v e r i n v e n t e d , t h e spre a dsh e e t , uses w h a t is esse n t i a l l y a f u n c t i o n a l m o d e l o f progra m m i ng. Ea c h c e l l i n a spre a dsh e et c o nta i ns a fu n cti o n a l e x pressi o n th at sp e c ifi es th e v a l u e for th e c e l l , b ase d o n v a l u es i n o t h er c e l ls. T h ere are n o i m p era t i v e i nstru c t i o ns, a t l e ast i n t h e b asi c , origi n a l spre a dsh e et m o d e l . In a se nse e a c h spre a dsh e et c e l l pulls i n t h e o u tsi d e v a l u es i t n e e ds t o compute its o w n value, as opposed to imperative systems w here a central agent p ush es v a l u es into cells. 6 In some sense each cell may be thought of as an agent that monitors its dependedu p o n c e l ls a n d u p d ates itse lf w h e n it n e e ds to . A s N ard i (1 9 9 3)( N ard i 1 9 9 3) p o i nts o ut, th e c o n tro l c o nstru c ts o f i m p era t i v e l a ngu ages are o n e o f t h e m ost d i ff i c u l t t h i ngs f or users t o grasp. Spreadsheets eliminate this barrier to end-user programming by dispensing w ith the need for control constructs, replacing them w ith functional constructs. Functional programming lends itself to metaphors of connection and flo w . Functions can be p i cture d as p h ysi c a l d e v i c es, a k i n to l ogi c gates, w ith a n u m b er of i n p ut a n d o utp ut p orts, continuously computing the appropriate values for their outputs given their inputs. Functional composition then is simply connecting up the input ports of one device to the output ports of oth er d e v i c es. T h e n et w ork a cts to c o nti n u a l l y m a i nta i n a re l ati o nsh i p b et w e e n i n p uts a n d o utp uts. Flo w metaphors are straightforw ard to represent graphically, and there have been quite a number of visual programming environments that make use of them, including H ookup (Sloane, Levitt et al. 1986), V ennLISP (Lakin 1986), Fabrik (Ingalls, W allace et al. 1988) and Tinkertoy (Ed e l 1 9 8 6). G ra p h i c d a t a f l o w l a ngu ages l i k e t h ese are esp e c i a l l y w e l l-su i t e d t o b u i l d i ng programs that operate real-time devices or process streams of data. In this context, a program esse nti a l l y o p erates as a fi lter-l i k e d e v i c e , a c c e pti ng a stre a m of d ata , pro c essi ng it a si ngl e element at a time, and producing a corresponding output stream. H ookup, for instance, w as d esign e d t o w ork i n re a l t i m e w i t h stre a ms o f M I D I d a t a t o a n d fro m e l e c tro n i c m usi c a l instruments, w hile Lab V ie w w as designed to handle laboratory instrumentation tasks.

Figure 2.2 (after H ookup). A network for computing centigrade temperature from Fahrenheit. D ata flows left to right.

6 For a longer discussion of pushing/pulling metaphors in multiagent systems see (Travers 1988).

44

M etaphor

Figure 2.2 sho ws an example of a graphic representation, modeled after the appearance of H ookup, of a functional program to convert temperature from Fahrenheit to centigrade units using the formula: C = (F - 32) * 5/9 T h e fl o w of d ata is l eft to right. F u n cti o ns are re prese nte d b y gra p h i c a l sy m b o ls a k i n to those used to represent gates in digital logic. Input and output values are indicated in boxes (input boxes are on the left and supply values, output boxes receive values). In H ookup, the values of outputs are effectively being computed continuously, and so the value in centigrade w i l l u p d a t e i nst a n t a n e o usl y w h e n e v er a n y o f t h e i n p u ts c h a nge . N o t e t h a t t h is prese n ts a some w hat different environment than a standard functional language, in w hich the application o f a f u n c t i o n t o argu m e n ts m ust b e d o n e e x p l i c i t l y . In a H o o k u p-l i k e l a ngu age , f u n c t i o n a p p l i c ati o n is p erform e d a uto m ati c a l l y w h e n e v er a n argu m e nt c h a nges. G ra p h i c d ata fl o w l a ngu ages th us ta k e a ste p to w ards v i e w i ng fu n cti o ns as c o nti n u o usl y m a i nta i n e d re l ati o ns rather than procedures. W hereas regular functional languages do not deal w ell w ith input and output, the dataflo w v ari a nt is a b l e to m o d e l th ese i n th e form of c o nti n u o us stre a ms of c h a ngi ng v a l u es. In th is m o d e l , i n p u t d e v i c es a p p e ar as so urc es f or t h e f l o w o f v a l u es t hro ugh t h e n e t w orks, b u t sources that change their values over time. O utput devices correspondingly are sinks w hich accept a stream of changing values. The mouse icon, highlighted at the center of figure 2.3, is an example of an input device, w ith three separate output flo ws for X, Y , and BUTTON. H o o k u p a lso e xte n d e d th e fl o w m eta p h or to d e a l w ith state . Its d atafl o w m eta p h or w as b ase d l o ose l y o n d igi t a l l ogi c , w i t h f u n c t i o ns re prese n t e d as ga t es. In a d d i t i o n t o st a t e l ess d e v i c es su c h as ga t es, H o o k u p i n c l u d e d d e v i c es w i t h st a t e t h a t f u n c t i o n e d i n a m a n n er analogous to registers in digital logic. A register had a special clocking input that w ould cause t h e c u rr e n t i n p u t v a l u e t o b e c o m e c u rr e n t a n d p r e s e n t o n t h e o u t p u t w i r e . T h i s w a y o f handling state at least made sense w ithin the dominant metaphor of the system. H o w ever, the presence of state also introduces a requirement for sequential control, w hich w as n ot readily su p p ort e d b y t h e m e t a p h or. H o o k u p i n c l u d e d c l o c ks a n d c l o c k a b l e se q u e n c e o b j e c ts t h a t provided some ability to provide sequences of values, but using these to control sequences of events w as a w k w ard.

M etaphor

45

Figure 2.3 A H ookup network to control a bouncing animated figure. It incorporates input from the mouse, output with sound and animation, and internal state registers.

The Playground environment (Fenton and Beck 1989) w as another interactive system and language that w as organi z ed around a functional model but ran into trouble w hen trying to deal w ith tasks th at w ere m ore n atura l l y e x presse d usi ng i m p erati v e c o nstru cts. Pl a ygro u n d , l i k e Live W orld, w as designed to be a platform for modeling w orlds in w hich graphic objects w ere e x p e cte d to p erform a cti o ns. T h e b asi c u n it of c o m p utati o n w as a n age nt th at fu n cti o n e d more-or-less as a functional spreadsheet cell. Slots inside objects w ere agents, and each agent w as i n c h arge o f c o m p u t i ng i ts o w n v a l u e i n a f u n c t i o n a l st y l e (sp e c i f i e d b y m e a ns o f a n e x pressi o n l a ngu age w ith Engl ish-l i k e sy nta x). T h is i n c l u d e d sl ots sp e c ify i ng b asi c gra p h i c i n f o r m a t i o n s u c h a s x a n d y p o s i t i o n a n d s i z e . I n e ss e n c e t h e p r o c e ss i n g o f t h e s y st e m i n v o l v e d a p ara l l e l re c o m p utati o n of a l l c e l ls, w ith th e n e w v a l u e sp e c ifi e d as a fu n cti o n a l e x pressi o n . As might be expected, it w as difficult to express actions using this model. For instance, you c o u l d n ot e asi l y sa y go for w ard 1 0 ste psi nste a d , y o u h a d to sp e c ify se p arate fu n cti o n a l expressions for computing the next values of the x and y coordinates. It w as possible to have a rule for, say, the x cell that set its value to x + 10 continually, and this w hich w ould produce a constant motion in the x direction, and this could even be made conditional, but essentially this model forced the program to be organi z ed around lo w-level concepts like position rather than b e h a v i or. Ev e ntu a l l y th is spre a dsh e et-b ase d progra m m i ng m o d e l h a d to b e a ugm e nte d w ith additional imperative constructs. By dispensing w ith state and control issues, the functional metaphor presents a very simple m o d e l o f c o m p u t a t i o n t h a t c a n b e m a d e re a d i l y a c c essi b l e t o n o v i c es t hro ugh a v ari e t y o f 46 M etaphor

interface metaphors. The lack of state and control drastically simplifies the language and makes th e syste m as a w h o l e m ore tra nsp are nt. B ut Pl a ygro u n d sh o w s th at th ere are fu n d a m e nta l problems w ith the use of the functio na l model as the sol e or primary basis for programming animate systems. The do w nside of eliminating control is that programs that need to take action or exert sequential control are difficult 7 or impossible to construct. For animate programming, w here action is foremost, functional programming seems unnatural in the extreme.

2.2.3.3

The Procedural Model

The procedural model of programming, w hich underlies modern languages like Lisp and Pascal, combines elements of the imperative and functional metaphors w ithin the more po w erful overarching frame w ork of procedural abstraction. The procedural model thus is n ot f o u n d e d directly on a single metaphor, although it lends itself to ne w and po w erful forms of description based on anthropomorphic and social metaphors. U n d e r t h e p r o c e d u r a l m o d e l , a p r o gr a m i s c o n str u c t e d o u t o f s m a l l e r p r o gr a m s o r pro c e d ures. A pro c e d ure c a n b o t h c arry o u t i nstru c t i o ns (l i k e a n i m p era t i v e progra m) a n d return values (like a function). The procedural model introduces the notion that one procedure c a n call a n oth er to p erform so m e task or c o m p ute so m e v a l u e . T h e m eta p h ori c a n d a n i m ate suggestiveness of the term call indicates the beginnings of an anthropomorphic, multiagent vie w o f c o m p u t a t i o n . A pro c e d ure , e n c a psu l a t es as i t d o es b o t h t h e i m p era t i v e a n d f u n c t i o n a l aspects of the computer, is in essence a miniature image of the computer as a w hole. O f c o urse , pro c e d ures i n th e l o ose se nse of th e w ord c a n b e cre ate d i n a n y l a ngu age . W hat procedural languages do is to reify the notion of procedure, so they become objects for t h e user, t h a t c a n b e m a n i p u l a t e d a n d c o m b i n e d i n t o m ore c o m p l e x arra nge m e n ts. So m e beginners languages (i.e. Logo) have a distinct notion of procedure, w hile others (B ASIC , at least in its original form) do not. The availability of named procedures can have an effect on the developing epistemology of the student:
In progra m m i ng c u l t ures l i k e t h ose o f LISP, Pasc a l , a n d L O G O , i n w h i c h pro c e d ures a n d hierarchical structures have been given concrete identity, programmers find powerful metaphors in tree searches and in recursive processes. There is a tendency to anthropomorphi z e, to look at control mechanisms among procedures and w ithin the flo w of procedures in terms of actors or d e m o ns, or o t h er cre a t ures resi d e n t i n t h e c o m p u t er c a p a b l e o f gi v i ng a d v i c e , p assi ng d a t a , receiving data, activating procedures, changing procedures, etc. (Solomon 1986, p. 98).

Pa p ert a lso e m p h asi z es t h e i m p ort a n c e o f pro c e d ures as a t h i n k i ng t o o l . T h e y are a computational realization of what he calls the principle of epistemological modularity, that is, the idea that kno w ledge and procedures must be broken up into chunks that can be called up from the outside w ithout the caller having to kno w about the inside:
Everyone w orks w ith procedures in everyday life ... but in everyday life, procedures are lived and used, they are not necessarily reflected on. In the L O G O environment, a procedure becomes a

7 There are some tricky techniques that allo w functional languages to express imperative constructs ( H enderson 1980) (Jones and W adler 1993), for instance turning actions into representations of actions that can then be manipulated through functions. These techniques are theoretically interesting but do not really affect the arguments here.

M etaphor

47

thing that is named, manipulated, and recogni z ed as the children come to acquire the idea of procedure (Papert 1980, p154).

In procedural languages, control is still essentially imperative, in that there is a single locus of c o ntro l seri a l l y e x e c uti ng c o m m a n ds, b ut i nste a d of a progra m b e i ng a n u n d iffere nti ate d m ass of i nstru ct i o ns, it is orga n i z e d i nt o a m u lt i p l i c it y of pro c e d ures. T h e l o c us of c o ntro l passes like a baton from procedure to procedure, w ith the result that one can see the operation of a program in either single-actor or multiple-actor terms. The procedural model lends itself to an animistic metaphor of little people w ho live in the c o m p u t er a n d c a n e x e c u t e pro c e d ures a n d c o m m u n i c a t e a m o ng t h e mse l v es (se e se c t i o n 3 . 3 . 2 . 1). T h e pro p ert i es o f t h e pro c e d ura l m o d e l t h a t l e n d i tse l f t o a n t hro p o m orp h i z a t i o n i n c l u d e th e m o d u l ari z ati o n of progra ms i nto sm a l l , task-b ase d p arts a n d th e e x iste n c e of a si m p l e y e t p o w erf u l m o d e l f or i n t er-pro c e d ure c o m m u n i c a t i o n t hro ugh c a l l i ng a n d re t urn c o n v e nti o ns. T h e pro c e d ura l m o d e l , th e n , is th e first ste p to w ards a n age nt-b ase d m o d e l of computation. Procedures, like the computer itself, can be approached through any or all of the metaphor systems mentioned thus far: imperative, functional, and anthropomorphic. Since a procedure is as f l e x i b l e a n d c o n c e p t u a l l y ri c h as t h e c o m p u t er i tse l f , i t esse n t i a l l y p erm i ts re c ursi v e application of the metaphorical tools of understanding. But the procedural w orld introduces n e w p o w ers a n d c o m p l i c ati o ns. B e c a use th ere are m u lti p l e pro c e d ures, th e y n e e d to h a v e w a ys t o c o m m u n i c a t e a n d n e w m e t a p h ors t o su p p ort c o m m u n i c a t i o n . In l a ngu ages t h a t s u p p o rt p r o c e d u r e s a s f i rst- c l a ss o b j e c ts , t h e m e t a p h o r i s c o m p l i c a t e d b y t h e f a c t t h a t procedures can create and act on other procedures, as w ell as communicate w ith them. Issues of boundaries and modularity also arise in a w orld w ith multiple actors. Some of these issues are treated by object-oriented models of programming. A lth o ugh pro c e d ures are a nthro p omorp h i z e d, th e y are i n some se nse more p assi v e th a n the metaphor suggests. They w ill only act w hen called from the outside. This, too, derives from the formal Turing model of the computer as a w hole, w hich treats it as a device for computing the answ er to a single input problem and then halting, w ith no interaction w ith the w orld other than the original parameters of the problem and the final result. Real computers are much more likely to be running a continual, steady-state, non-terminating process, constantly interacting w ith external devices. The formal model does not adequately capture this aspect of c o m p u t a t i o n , a n d t h e p r o c e d u r a l m o d e l t o o t e n d s t o m a rg i n a l i z e i t . R e a l p r o c e d u r a l progra m m i ng syst e ms o f t e n , b u t n o t a l w a ys, m a k e u p f or t h is b y e x t e n d i ng t h e m o d e l t o i n c l u d e w a ys t o i n t erf a c e w i t h t h e o u tsi d e w orl d , f or i nst a n c e b y b e i ng a b l e t o sp e c i f y a procedure that w ill execute w henever a particular kind of external event occurs. This is a useful feature, but still leaves control, interaction, and autonomy as marginal concepts relative to the basic procedural model. O ne purpose of agent-based models of programming is to bring these issues to the center.

2.2.3.4

The Object Model

O b j e c t - o r i e n t e d p r o gr a m m i n g ( O O P) i s a n i n t e r e s t i n g e x a m p l e o f a p r o gr a m m i n g methodology explicitly organi z ed around a po w erful metaphor. In O O P, computational objects 48 M etaphor

are depicted metaphorically in terms of physical and social objects. Like physical objects, they can have properties and state, and like social objects, they can communicate and respond to communications. H istorically, O O P arose out of languages designed for simulation, particularly Simula ( D ahl, M yhrhaug et al. 1970) and for novice programming in graphic environments such as SmallTalk ( G ol dberg a nd Kay 1976). In obje ct-oriented simulations, the computational obj ects are n ot o n l y tre a t e d as re a l- w orl d o b j e c ts, b u t t h e y a lso represent re a l- w orl d o b j e c ts. A st a n d ard example is the spaceship, w hich is modeled by a computational object that has properties like position, orientation, a n d mass ; a n d c a n p e rf o r m a c t i o n s l i k e rotate a n d accelerate. T h e object-oriented metaphor explicitly ackno w ledges the representational relationship bet w een c o m p utati o n a l stru ctures a n d re a l- w orl d o b j e cts, a n d e n c o urages th e d e v e l o p m e nt of su c h representational relationships. But because computational objects have properties that are quite different from spaceships and other real-w orld objects, the elements of the mapping must be c arefu l l y se l e cte d so th at, o n o n e h a n d , th e c o m p utati o n a l e l e m e nts are b oth p o w erfu l a n d p a rs i m o n i o u s , a n d o n t h e o t h e r , a s u f f i c i e n t l y r i c h s u b s e t o f r e a l - w o r l d p r o p e rt i e s a n d b e h a v i ors are e n c o m p asse d . In m ost O O P l a ngu ages, o b j e cts are orga n i z e d i nto c l asses or types that make up an inheritance hierarchy. O O P may be vie w ed as a paradigm for modulari z ing or reorgani z ing programs. Rather than e x ist i ng i n a n u n d i ff ere n t i a t e d se a o f c o d e , p arts o f progra ms i n O O P are asso c i a t e d w i t h particular objects. In some sense they are contained in the objects, part of them. W hereas the procedural model offered communication from procedure to procedure, through the metaphor of calling, in O O P, communication betw een procedures (methods) is mediated by the objects. A v ari ety of m eta p h ors th us are use d to re prese nt th e c o m m u n i c ati o n a n d c o nta i n m e nt asp e c ts o f O O P. T h e e arl i est O O P l a ngu ages use d t h e m e t a p h or o f se n d i ng messages t o objects to represent program invocation. O bjects contain methods ( o r b e h a v i ors o r scri pts in so m e v ari a n ts) f or h a n d l i ng p art i c u l ar k i n ds o f m essages; t h ese m e t h o ds are pro c e d ures t h e mse l v es a n d c arry o u t t h e ir t asks b y se n d i ng f urt h er m essages t o o t h er o b j e c ts. O O P languages use constructs like send , ask, o r <== to denote a message send operation. O bjects also contain sl ots th at h o l d state . In ge n era l th e sl ots of a n o b j e ct are o n l y a c c essi b l e to th e m e t h o ds o f t h a t o b j e c tor i n o t h er w ords, t h e o n l y w a y t o a c c ess t h e i n t ern a l st a t e o f t h e o b j e c t is b y m e a ns o f se n d i ng t h e o b j e c t m essages. O b j e c ts c a n h a v e a t igh t l y c o n tro l l e d interface that hides its internal state from the outside w orld. The interface of an object thus acts somewhat like the membrane of a cell. T h ese si m p l e e l e m e n ts h a v e gi v e n ra nge t o a w i d e v ari e t y o f e x t e nsi o ns t o t h e b asi c metaphor, and a correspondingly vast literature on object-oriented methodologies and more recently, object-oriented design patterns ( G amma, H elm et al. 1994). The diversity of such schemes indicates that w hile the basic mapping betw een computational and real-w orld objects may be intuitive and straightforw ard, the ramifications of that mapping are not. In any real O O P system, there are al w ays hard design choices to make reflecting the fact that there w ill al w ays be more than one w ay to carve the w orld up into objects. The history of object-oriented programming sho ws ho w technology that evolved around a particular metaphor can be subject to forces that tend to stretch or violate that metaphor. The M etaphor 49

original simple idea behind O O Pobjects receive messages and decide for themselves ho w to respond to themis complicated by many issues that come up w hen trying to reali z e the idea. O ne complication is the related issues of object types, hierarchies, inheritance, and delegation. M ultiple inheritance, w hile a useful technique, involves quite complicated issues and does not have a single natural formulation. The prototype-based, slot-level inheritance of Framer and Live W orld (see chapter 4) are attempts to deal w ith some of these problems in a more intuitive way. It is k n o w n th at m essage-p assi ng a n d pro c e d ure c a l l i ng are form a l l y e q u i v a l e nt (Ste e l e 1976). Some O O P languages (like CL O S (Steele 1990) and D ylan (A pple C omputer 1992)) try to exploit this by getting rid of the message-passing metaphor and using regular procedure calling to invoke object methods. This has the advantage that method selection can be speciali z ed on more than one object. This technique, w hile po w erful, is some w hat at variance w ith the objectori e nte d m eta p h or as pre v i o usl y u n d ersto o d . B e c a use a m eth o d c a n b e sp e c i a l i z e d o n a n y argument, the method can no longer be seen as associated w ith or contained inside a single o b j e c t or c l ass. H ere w e h a v e a c ase o f t w o m e t a p h ors f or c o m m u n i c a t i o n c l ash i ng a n d combining w ith each other. Proponents of the generic procedure approach point out that it is more po w erful, more elegant, and (in the case of CL O S) more integrated w ith the underlying procedural language. O pponents decry the violation of the object metaphor and the increased complexity of dispatching on multiple arguments. The A ctor model of computation ( H e w itt 1976) w as another important early influence in the development of O O P, and deserves mention here. The name is obviously anthropomorphic, and a variety of anthropomorphic metaphors influenced its development, including the littleperson metaphor (Smith and H e w itt 1975) and the scientific community metaphor (Kornfeld and H e w itt 1981). The A ctor model w as explicitly designed to support concurrency and distributed syst e ms. The object-oriented programming model is a natural outgro w th of the procedural model, and shares a good many of its features. From a broad historical perspective, it can be seen as a further step in the reification and anthropomorphi z ation of parts of programs, necessitated by th e n e e d to m a n age m ore c o m p l e x progra ms a n d d istri b ute d syste ms. Rath er th a n progra ms and data existing in an undifferentiated mass, the various components are organi z ed, managed, and encapsulated. The emphasis as a result is on communication bet w een the no w separated parts of the system.

2.2.3.5

The Constraint Model

T h e c o nstra i n t m o d e l is so m e t h i ng o f a d e p art ure fro m t h e o t h er progra m m i ng m o d e ls c o nsi d ere d so f ar. D esp i t e t h e ir d i ff eri ng m e t a p h ori c b ases, t o progra m i n a l l t h e pre v i o us m o d e ls is t o pro v i d e t h e c o m p u t er w i t h a f u l l y d e t erm i n ist i c pro c e d ure f or c arry i ng o u t a computation. Even functional languages generally have an imperative interpretation so that the progra m m er w i l l b e a w are of th e se q u e n c e of e v e nts w h i c h w i l l o c c ur w h e n th e progra m is executed. C onstraint languages, in contrast, implement a form of declarative programming in w hich only the relations b et w e e n o b j e cts are sp e c ifi e d b y th e progra m m er w h i l e l e a v i ng th e procedural details of ho w to enforce these relations up to the constraint-solving system. As a

50

M etaphor

result, constraint languages require significantly more intelligence in their interpreter, w hose operation is thus harder to understand. H o w ever, from the metaphorical standpoint constraint systems may be seen as a natural extension of the flo w metaphor found in functional languages. In a functional language, flo w is u n i d ire cti o n a l , b ut i n a c o nstra i nt syste m , d ata c a n fl o w i n e ith er d ire cti o n a l o ng a l i n k . T o i l l ustra t e t h is, l e t s re t urn t o t h e t e m p era t ure c o n v ersi o n e x a m p l e o f se c t i o n 2 . 2 . 3 . 2 . In a constraint language, the statement: C = (F - 32) * 5/9 is not only an instruction about ho w to compute C given F, but a general declaration of a relationship bet w een the t w o quantities, so that either may be computed from the other. The constraint system has the responsibility for figuring out ho w to perform this calculation, and thus must have some algebraic kno w ledge or the equivalent. This kno w ledge takes the form of a variety of constraint-solving techniques. The simplest technique, local propagation of kno w n values, is readily expressed through the flo w metaphor. In the functional version of the flo w metaphor, values flo w from inputs along w ires, through devices, and eventually produce output values. In local propagation, values flo w in a similar w ay, but the w ires are bi-directional and input and outputs are not distinguished. There are still computational devices, but instead of having distinguished input and output ports any port can serv e as a n i n p u t or a n o u t p u t (or i n o t h er w ords, i nst e a d o f i m p l e m e n t i ng f u n c t i o ns t h e y implement relations). Such a device w ill produce an output on any port w henever it receives sufficient inputs on its other ports.

Figure 2.4: A constraint network.

F igure 2 . 4 sh o w s a c o nstra i nt-b ase d v ari a nt of th e d atafl o w n et w ork fro m F igure 2 . 2 . In contrast w ith the earlier figure, here data can flo w in either direction along a w ire, so that the value in the centigrade box might have been specified by the user or computed by the netw ork. The arro ws sho w one possible flo w pattern, w hich w ould result from the user specifying the v a l u e of c e ntigra d e . T h e d isti n cti o n b et w e e n i n p ut a n d o utp ut b o x es n o l o nger h o l ds, b ut a ne w distinction must be made bet w een constants and variablesotherw ise the net w ork might c h o ose to c h a nge th e v a l u e of th e c o nsta nt 3 2 rath er th a n th e v a l u e i n th e F a hre n h e it b o x! C onstants are indicated by putting a padlock beside them, to indicate to the solver that it is not to alter those values.

M etaphor

51

This circuit-like metaphor for constraints w as introduced by Sketchpad (Sutherland 1963) w hich w as the first system to represent constraints graphically. The technique w as used as an e x p ository d e v i c e i n (Ste e l e 1 9 8 0) a n d i m p l e m e nte d as a n e xte nsi o n to T h i ngLa b (B orn i ng 1 9 8 6). C o nstra i nt programmi ng ma y b e v i e w e d as o n e p arti c u l arl y simp l e a n d p o w erfu l w a y of 8 combining declarative and procedural kno w ledge. A c o nstra i n t c o m b i n es a re l a t i o nsh i p t o enforce, expressed in declarative terms (i.e., an adder constraint that enforces the relationship a = b + c) w ith a set of procedural methods for enforcing it. In the case of the adder, there w ould b e t hre e m e t h o ds c orresp o n d i ng t o t h e t hre e v ari a b l es t h a t c a n serv e as o u t p u ts; e a c h o f w hich computes a value from the remaining tw o variables O t h er l a ngu ages, m ost n o t a b l y l ogi c progra m m i ng l a ngu ages l i k e Pro l og, h a v e b e e n fashioned along the idea that programs should take the form of declarative statements about relationships. O ne slogan put forth by advocates of logic programming is algorithm = logic + c o n tro l (K o w l ask i 1 9 7 9), w h ere l ogi c re f ers t o a n esse n t i a l l y d e c l ara t i v e l a ngu age a n d control refers to some additional mechanisms for controlling the deductive processes of the language interpreter. The problem w ith Prolog is that it shortchanges both logic and control by attempting to use the same language to specify both. Thus the language does not have the full expressive po w er of logic, because doing so w ould make the imperative interpretation of a logic progra m i ntra ct a b l e . A n d w h i l e Pro l og a d ds so m e c o ntro l c o nstru cts su c h as t h e cut t o i t s declarative language, in general the ability to control the deductions of the interpreter are limited. C onstraint languages have the potential to overcome this limitation, since they separate out the declarative and imperative parts of a program. D eclarations of intent and procedures can each be made in the idiom appropriate to the task, then linked together in a single constraint. ThingLab (Borning 1979) w as organi z ed in this fashion. H o w ever, rather than develop this idea as a programming paradigm, ThingLab, its descendants (i.e. (Freeman-Benson, M aloney et al. 1990)), and constraint-based systems in general evolved in a different direction. A t y p i c a l c o n t e m p orary c o nstra i n t syst e m (i . e . Ju n o-2 ( H e y d o n a n d N e lso n 1 9 9 4)) is designed as a declarative language together w ith a black-boxed constraint solver w hich can so l v e c o nstra i nt syste ms i n th at l a ngu age . T h e user of su c h a syste m c a n sp e c ify c o nstra i nts using a given declarative language, but cannot specify procedures for satisfying them. In other w ords, the imperative side of the equation is given short shrift. The reason this path w as taken is pro b a b l y a d esire f or c o nstra i n t so l v ers t h a t are b o t h f ast a n d t h e ore t i c a l l y tra c t a b l e . A syste m th at p erm its c o nstra i nts to b e b u i lt w ith arb itrary user d efi n e d pro c e d ures w o u l d b e quite difficult to control. C onstraint Imperative Programming (CIP) (Lope z , Freeman-Benson et al. 1993) is an attempt to integrate declarative constraints w ith an imperative programming language. The idea behind CIP is to combine an object-oriented procedural language w ith automatic constraint solving capability that can enforce relations bet w een slots of objects. W hile this is a promising line of

As far as I know this idea was first formulated by Alan Borning (Borning 1979).

52

M etaphor

rese arc h , C IP l a ngu ages are sti l l l i m ite d i n th e ir e x pressi v e p o w er. T h e c o nstra i nt so l v er is monolithicyou cant create ne w imperative methods to solve declarative constraintsand in so m e se nse su b ord i n ate , re l egate d to th e ro l e of a uto m ati c a l l y m a i nta i n i ng re l ati o ns a m o ng v ari a b l es i n a n oth er w ise pro c e d ura l l a ngu age . T h e sa m e is tru e of oth er efforts to c o m b i n e constraints w ith more general models programming ( H etenryck 1989) (Siskind and M c A llester 1 9 9 3). T h ese e ff orts, w h i l e c ert a i n l y v a l u a b l e , d o n o t se e m t o m e t o e x p l ore t h e f u l l ra nge o f p ossi b i l iti es of c o nstra i nts as a n orga n i z i ng m eta p h or for progra m m i ng. A l l of th e m ta k e a n essentially fixed constraint solver and make it an adjunct to an otherw ise ordinary procedural language. A programming system that w as fully organi z ed around a constraint metaphor w ould h a v e t o h a v e a m u c h m o r e p o w e rf u l c o n c e p t o f c o n str a i n ts , o n e t h a t c o u l d e n c o m p a ss computation in general, as does the object-oriented model. C onstraints w ould have to be as p o w erf u l as pro c e d ures ( w h i c h t h e y c o u l d b e , i f t h e y h a d a f u l l y e x pressi v e pro c e d ura l component) but also capable of being invoked w ithout an explicit call. The agent-based systems described in chapter 5 are attempts to reali z e this alternative version of the constraint model.

2.2.4

Interface Metaphors

T h e o n l y are a of c o m p uter sc i e n c e th at m a k es a regu l ar pra cti c e of e ngagi ng i n e x p l i c it discourse about its o w n metaphors is the field of human interface design. N o doubt this is due to th e n ature of th e i nterfa c e task: to m a k e h i d d e n , i n n er, a bstruse w orl ds of c o m p utati o n a l o b j e c ts a n d a c t i o ns a c c essi b l e t o users w h o m a y n o t h a v e a n y d ire c t k n o w l e dge o f t h e ir properties. From our point of vie w , just about everything about computation is metaphorical any w ay, and the distinction bet w een a highly metaphorical interface (such as the M acintosh desktop) and a command-line interface (such as that of U N IX) is a matter of degree only. It is not hard to se e th at th e U N IX c o n c e pts of fi l es a n d d ire ctori es are j ust as gro u n d e d i n m eta p h ors as th e documents and folders of the M acintoshthe former have simply been around longer and thus have achieved a greater degree of transparency. In t erf a c e m e t a p h ors are ge n era l l y e asi er t o d esign t h a n m e t a p h ors f or progra m m i ng l a ngu ages, for a c o u p l e of re aso ns. F irst, i nterfa c e m eta p h ors are usu a l l y d esign e d for m ore sp e c i f i c t asks t h a n l a ngu ages. T h e y ge n era l l y h a v e o n l y a sm a l l n u m b er o f o b j e c t t y p es, relations, and actions to represent, and so each element can be given a representation carefully tailored to its purpose. A programming language, by contrast, has an extensible set of objects, o p e r a t i o n s , a n d r e l a t i o n s , a n d a n i n t e rf a c e t h a t p r e s e n ts i ts e l e m e n ts t o t h e u s e r m u st n e c essari l y o p erate o n a m ore ge n era l l e v e l . F or e x a m p l e , a n o n-progra m m a b l e i ntera cti v e graphics program might have special icons for each of the objects it allo ws the user to dra w (i.e. re cta ngl es a n d l i n es) a n d o p erati o ns it c a n p erform (i . e . erase , m o v e , resi z e). O n th e oth er hand, a general-purpose graphic programming environment w ill have an ever-expanding set of objects and operations and thus its interface, unless extended by the user, can only represent objects and operations in general, and thus will be limited in the metaphors it can employ.

M etaphor

53

O ne w ay to deal w ith this problem is to find an intermediate level bet w een applicationspecific but non-programmable tools, and general-purpose environments that are programmable but difficult to present metaphorically. This approach is used by Agentsheets (Repenning 1993), an environment building tool w hich is designed using a layered approach. The substrate level is a general-purpose programming environment featuring a grid-based spatial metaphor w hich can contain active objects, programmed in a general-purpose language (an extension of Lisp called AgenTalk). A dapting Agentsheets for a ne w domain task involves having a metaphor designer build a set of building blocks that w ork together using a common metaphor, such as flo w . The end-user then can construct simulations using the block-set and the metaphor, but is insulated from the po w er and complexity of the underlying programming language. A n o t h e r r e a s o n t h a t i n t e r f a c e m e t a p h o rs a r e e a s i e r t o d e s i g n t h a n m e t a p h o rs f o r programming is that direct-manipulation interfaces in general dont need to represent action. U nder the direct-manipulation paradigm, all actions are initiated by the user. W hile the results of action or the action itself might have a graphic representation (for instance, opening a folder on a desktop can be represented by a z ooming rectangle) the action itself is soon over and does not require a static representation. N or is there a need to represent actors, since the user is the only initiator of action in the system. The interface w orld is beginning to reali z e limits to the d ire ct-m a n i p u l ati o n p ara d igm a n d e m bra c e re prese ntati o ns of a cti o n i n th e form of anthropomorphic interface agents (see section 3.3.4). Progra m m i ng, h o w e v er, is a l l a b o ut a cti o n a n d th us progra m m i ng e n v iro n m e nts h a v e a need to represent actions and actors. Its interesting that functional programming models, in w hich action is de-emphasi z ed, have been the most amenable to presentation through graphic m e t a p h ors. T o re prese n t a c t i o n , progra m m i ng m e t a p h ors m a y a lso n e e d t o t urn t o anthropomorphism.

2.3

Conclusion
My main complaint is that metaphor is a poor metaphor for w hat needs to be done. Alan Kay (Kay 1990)

O ur basic ideas about computation are founded on metaphoric models. The daily activity of programmers involves inventing and dealing w ith ne w forms of computational structure, and thus they are engaged in a continual process of inventing and deploying metaphors that make th ese stru ctures u n d ersta n d a b l e . Su c h m eta p h ors are n ot cre ate d arb itrari l y , h o w e v er. T h is point is often lost in battles bet w een constructivists and objectivists. O ur ideas about the w orld are constructed, but they are not constructed just as w e please. Scientific metaphors must map e v ery d a y c o n c e p ts o n t o t h e a c t u a l pro p ert i es o f t h e n a t ura l w orl d a n d t h us t h e c h o i c es o f source domains and mappings are highly constrained. There may be more freedom in choosing m eta p h ors to orga n i z e c o m p utati o n , b ut n ot a l l m eta p h ori c a l stru cturi ng w i l l pro v e e q u a l l y po w erful. A good computational metaphor should use only a fe w real-w orld concepts for its source domain, and map them onto computational concepts that are po w erful. It is hard to capture e x a ctl y w h at d eterm i n es th e p o w er of a m eta p h ori c a l syste m . Perh a ps a n e x a m p l e of a bad 54 M etaphor

metaphor w ould help: I once used a language that had started as a tool for building computerassisted instruction lessons. It had since gro w n into a general purpose language, but w as still stru c t ure d i n t erms o f l esso n u n i ts a n d c o n tro l f l o w w as orga n i z e d aro u n d t h e u n d erl y i ng metaphor of question-and-answ er drills. A ll sorts of operations had to be shoehorned into this fra m e w ork . T h e q u esti o n-a n d-a ns w er m eta p h or d i d n ot tra nsl ate i nto p o w erfu l a n d ge n era l tools for computation, and as a result the language w as quite a w k w ard to use. The moral is that not all real-w orld domains are suitable for use as the basis of a general computational model. The ones w e have examined in this chapter are dominant because they are p o w erf u l a n d ge n era l , a n d b e c a use t h e y h a v e e v o l v e d o v er t i m e as t h e n a t ure o f t h e computational realm has become better understood. But w e should hope that the evolutionary p r o c e ss h a s n o t f i n i s h e d a n d t h a t t h e r e i s r o o m f o r t h e i n v e n t i o n o f n e w m o d e l s f o r programming that will overcome the limitations and biases of the existing ones. In a sense, programming is a form of writing. The most basic model of computation, the imperative model, is closely linked to the idea of narrative and drama. Programming is a process o f w ri t i ng scri p ts f or c o m p u t a t i o n a l a c t ors. Y e t t h e i m p era t i v e m o d e l o f progra m m i ng is t h e o r e t i c a l l y s u s p e c t , s p a w n i n g a s e a r c h f o r l a n g u a g e s t h a t a r e m o r e tr a c t a b l e , s u c h a s functional programming. Functional programming has not made w ide inroads in environments for novices or even for practicing programmers. The reasons for this are many, but surely one is th at fu n cti o n a l progra mm i ng d isc o urages th i n k i ng of c o m p utati o n i n terms of a cti o ns a n d a c t ors. Inst e a d o f f igh t i ng aga i nst t h e t e n d e n c y t o t h i n k i n t erms o f a c t i o ns a n d a c t ors, w e should w ork w ith our natural epistemological tools, and embrace the use of metaphors based o n t h e a c t ors w e k n o w , t h a t is t o sa y , h u m a ns a n d o t h er a n i m a t e e n t i t i es. T h e n a t ure o f animism and its use in computation is the subject of the next chapter.

M etaphor

55

Chapter 3

Animacy and Agents


S ometimes I think it is a great mistake to have matter that can think and feel. It complains so. By the same token, though, I suppose that boulders and mountains and moons could be accused of being a little too phlegmatic.

W inston N iles Rumfoord

3.1

Introduction

There appears to be a fundamental dichotomy in human thought that separates the living from the inanimate, the purposive from the mechanical, the social from the natural, and the mental from the physical. The tendency to divide the w orld along such lines is strong, possibly innate, crucial to social functioning, and a key part of folk psychology ( D ennett 1987). This grand divide is no doubt an example of w hat M insky calls a dumbbell theory, or false dualism ( M i nsk y 1 9 8 7 , p 1 1 7). I sh o u l d m a k e it c l e ar th at th e d u a l ism e x p l ore d i n th is c h a pter is a n e p ist e m i c d u a l ism t h a t e x ists i n o ur t h e ori es o f t h e w orl d , n o t i n t h e w orl d i tse l f , a n d t h us should be distinguished from ontologically dual theories such as C artesianism or vitalism. Sc i e n c e h as, a t l e ast o n t h e surf a c e , o u tgro w n b o t h sorts o f d u a l ism . B u t b e c a use t h e distinction betw een animate and inanimate is such a universal and basic part of human thinking, it h a u nts e v e n th e m ost so p h isti c ate d efforts to gra p p l e w ith th e n ature of th e m i n d . W e a l l b egi n as d u m b b e l ls, a n d w e d o n o t e asi l y ri d o urse l v es o f o ur d u m b b e l l t h e ori es. C omputational theories of the mind and computation itself are in some w ays attempts to bridge this gapto make lifelike behavior and intelligence from inanimate parts, and to explain the behavior of living things in terms dra w n from the physical w orld. But the partial successes of AI, cybernetics, and cognitive science in devising theories that partially unite these realms has n ot y et re m a d e o ur e v ery d a y m i n ds a c c ord i ngl y . N or are th e sc i e ntifi c th e ori es th e mse l v es immune to the effects of this persistent divide. It is a common practice to describe the activity of machines or other non-living objects in a n i m a t e t e r m s . I w i l l r e f e r t o t h e s e s o r t s o f m a p p i n gs a s animate metaphors. T h e t e r m a nthropomorphism is more common, but is not quite as accurate, since other animals besides humans can serve as the source domain. A nother suitable term is ethop ia , the classical G reek w ord for attributions of human qualities to non-human objects ( N ass, Steuer et al. 1993). This c h a p t er e x p l ores t h e use o f a n i m ism a n d a n i m ist i c m e t a p h ors i n t h e c o nstru c t i o n o f t h e computational realm. In particular, it examines the w ays in w hich animacy is used to make the operations of complex systems such as computers comprehensible. A n i m ate m eta p h ors are p o w erfu l b e c a use th e y are c a p a b l e of e x p l o iti ng o ur k n o w l e dge about humans and human action. W hen dealing w ith systems that are too complicated to be understood in physical and mechanical terms, the leverage that animate metaphors can give is crucial. It allo ws us to think in terms of purpose and function, and thus to understand w ithout having to kno w the implementation details of the system. At the same time, the use of animate

m e t a p h ors t o d escri b e m a c h i n es c a n b e d a ngero us, b e c a use o f t h e risk o f o v era ttri b u t i o n errors. For instance, w e can talk of a simple robot vehicle using negative feedback control as w anting to propel itself to w ards some stimulus (as in (Braitenberg 1984)) but the nature of this w anting is not the same as that of a personthe vehicle does not kno w that it w ants, does not necessarily feel anything like disappointment if it does not get its goal, and so forth. The metaphor is compelling, but can also be misleading. The first section of this chapter explores ho w the concepts of animate and inanimate arise, ho w they develop, and ho w they are used. It traces a fe w key properties of the animate realm t hro ugh v ari o us a t t e m p ts t o a n a l y z e t h e t w o d o m a i ns. T hre e k e y c o n c e p ts e m erge as t h e defining properties of the animate realm: autonomy, purposefulness, and reactivity. The second section looks at ho w animate metaphors have been used in computation and w hat roles they play in the description of various programming languages. W e w ill find that w h i l e a n i m ism p l a ys a c e ntra l ro l e i n th e fo u n d ati o n a n d c o nti n u i ng d e v e l o p m e nt of computation, it tends to be a rather peculiar and limited form of animism, one that omits some of the most important qualities of the domain. The last section explores a ne w kind of programming paradigm based on agents, th at is, o n collections of explicitly anthropomorphic units. Agent-based programming seeks to combine the p o w er o f c o m p u t a t i o n w i t h t h e asp e c ts o f a n i m ism t h a t pre v i o us f orms o f c o m p u t a t i o n a l animism have left out. It w ill also explore the use of narrative as a natural w ay to express the action and interaction of animate beings.

3.2

The Realm of Animacy

A nimacy is a basic category, yet one that is difficult to define precisely. The category of animate things is not the same as living things (since plants and sessile animals for the most part should not be included, w hile robots and other artificial beings perhaps should be). A nimacy is more than simply a category, but constitutes w hat M insky calls a realm of thought w ith its o w n distinctive style of mental representation and reasoning. The dichotomy bet w een animate a n d i n a n i m ate se e ms to m a n ifest itse lf i n d iffere nt w a ys at d iffere nt c ogn iti v e l e v e ls. In th is section I attempt to sketch out some different approaches to understanding ho w w e think about t h e a n i m a t e re a l m . T h e ro o ts o f a n i m a c y are f o u n d i n b asi c p erc e p t u a l pro c esses, b u t i ts ra m i f i c a t i o ns go b e y o n d p erc e p t i o n a n d a f f e c t t h e w a y w e t h i n k a b o u t a c t i o n a n d so c i a l behavior.

3.2.1

The Perception of Causality

The division betw een animate and inanimate appears to be both a universal and innate part of ho w w e see the w orld. A n obscure but fascinating thread of research in perceptual psychology indicates that the ability to distinguish betw een animate and inanimate objects may b e i n so m e se nse p erc e ptu a l pri m iti v es, h ard- w ire d i nto o ur bra i ns at th e l o w est l e v e l (se e ( G elman and Spelke 1981) for a survey). A t this level, animacy is manifest in the perception of m o t i o n , sp e c i f i c a l l y m o t i o n t h a t a p p e ars t o arise a u t o n o m o usl y , w i t h o u t v isi b l e e x t ern a l 58 Animacy

c a usati o n . T h e a b i l ity to d isti ngu ish b et w e e n c a use d a n d a uto n omo us moti o n a p p e ars to b e innate and can be detected experimentally. Research on the perception of causality began w ith the w ork of M ichotte (M ichotte 1950). H is experiments involved sho w ing subjects a set of moving abstract shapes on a screen, and asking them to make judgments about w hat they had seen. In a typical experiment, a moving shape A w ould approach a second stationary shape B. W hen A contacted B, depending upon the experimental situation B might start to move either immediately, or after a span of time, and A m i g h t st o p o r c o n t i n u e t o m o v e . T h e s u b j e c ts w e r e t h e n a s k e d t o i n t e r p r e t w h a t h a d happened. A ll subjects tended to interpret these scenes in terms of causal relationships bet w een the t w o sh a p es: th at is, th e e x p eri m e nta l situ ati o n w o u l d stro ngl y suggest e ith er a d ire ct c a usa l re l a t i o nsh i p b e t w e e n t h e t w o m o v e m e n ts, or a n a u t o n o m o us (n o n-c a use d) origi n f or t h e movement of the second object. For example, in the case w here A stopped and B immediately b ega n m o v i ng, th e sc e n e w as i nterprete d as a c o l l isi o n or l a u n c h i ng . In th e c ase w h ere A continued to move along w ith B, the scene w as interpreted as a case of A dragging B along w ith it. In another case, similar to the first but w ith the difference of including a delay before B began to move, the subjects w ould attribute autonomy or self-causation to Bs movement. The striking thing about these experiments w as the immediacy and po w er of their ability to induce particular kinds of causal perceptions in the subjects, given the highly abstract character of the objects and motions involved. M ichottes experiments have been replicated w ith six-month old infants (Leslie 1979)(Leslie a n d K e e b l e 1 9 8 7). It w as fo u n d th at th ese y o u ng su b j e cts c o u l d d isti ngu ish b et w e e n c a usa l a n d n o n-c a usa l sc e n ari os. T h ese e x p eri m e nts i n v o l v e d sh o w i ng th e su b j e cts a se q u e n c e of presentations similar to those of M ichotte, w hich w ould consist of all causal presentations w ith one interposed non-causal presentation, or the inverse. In either case the infants w ould sho w a startle response w hen the interposed presentation w as sho w n. Ste w art (1982)(Ste w art 1982) performed similar moving image experiments on adults. In this case, both the motions and the judgments observers w ere asked to make w ere some w hat more complex than in the earlier experiments. Ste w arts shapes w ould follo w one another or avoid o n e a n oth er, or start, sto p , or c h a nge d ire cti o ns arb itrari l y . O bserv ers w ere ask e d to j u dge w h e t h er t h e sh a p es i n m o t i o n w ere o b j e c ts or cre a t ures . A l l o f t h ese m o t i o ns i n d u c e d judgments of animacy or aliveness in observers, w hereas shapes that follo w ed less complex paths were judged as inanimate or mechanical. T o ge n era l i z e fro m t h e resu l ts o f t h ese e x p eri m e n ts, i t a p p e ars t h a t h u m a ns stro ngl y distinguish betw een externally caused and autonomous motions, and that the ability to do so is to some extent innate, or at least appears early in development. These perceptual abilities seem to form the perceptual basis for the later development of concepts about living vs. non-living things and purposefulness. To a first degree of approximation, any object moving in w ays that appear to violate basic N e w tonian la ws of motionthat is, an object that changes its motion w ithout apparent external cause, other than frictiontends to induce a judgment that the object is a l i v e , p urp osefu l , a n d a uto n o m o us. O n th e oth er h a n d , o b j e cts i n u n c h a ngi ng m oti o n , or

Animacy

59

objects that change their motion only in response to visible external causes, are judged to be inanimate. The implications of these experiments are that the perceptual system is attuned to changes in motion and relations in changes in motion, and that there is a need to interpret or explain such changes by assigning their cause to either internal or external factors (Premack 1990). The apparent innateness and universality of these effects argues that causality is in some sense a perceptual primitive. Related concepts of aliveness, purpose, intent, self-a w areness build upon and refine these primitives. T h a t t h ere sh o u l d b e su c h a n i n n a t e m e c h a n ism m a k es a go o d d e a l o f se nse fro m a n evolutionary standpoint, since it is important for animals to be able to judge w hich objects in their environment are alive and w hich are not. From the physiological point of vie w , it is w ellkno w n that the visual system includes many sorts of motion detection mechanisms. The ability to sense changes in motion and relations bet w een different motions is a step up in complexity, b ut n ot a v ery l arge o n e . T h ere is e v e n so m e e v i d e n c e fro m stu d i es o n bra i n-d a m age d a n d autistic subjects that indicates the presence of a physiological locali z ed mechanism to detect agency and causality (Baron-C ohen 1995). D o e v e n si x-m o n t h o l d i n f a n ts c o nstru c t c a usa l m o d e ls o f t h e ir w orl d a n d d ist i ngu ish bet w een external and internal causes? It seems more likely that there are at least t w o levels of processing at w ork here: one, the level of basic perceptual processing, and another process of interpretation and explanation that involves more conceptual thought. The perceptual m e c h a n isms m a y b e a b l e t o pro v i d e t h e b asi c a b i l i t y t o d ist i ngu ish b e t w e e n c a use d a n d uncaused motions, w hile the conceptual mechanisms, w hich develop later, have the task of fitting these perceptions into categories and constructing explanations for them.

3.2.2

The Development of Animism as a Category

Piagets studies of childrens thinking revealed a phenomenon he called childhood animism (Piaget 1929). This is the tendency of children to attribute properties normally associated w ith l i v i ng th i ngs to th e n o n-l i v i ng. T h e q u a l iti es th at are pro j e cte d o nto th e i n a n i m ate w orl d b y c h i l d h o o d a n i m ism i n c l u d e b o t h a l i v e n ess a n d c o nsc i o usn ess. T h ese are o b v i o usl y t w o separate concepts, but they apparently follo w similar stages through development, suggesting that they are based on a common underlying concept. O ther qualities that are brought into play by childhood animism include freedom and the ability to have intentions or w ill. W hile some of Piagets results have been challenged as being oversimplified (see (C arey 1985)), his central results are still of interest. Piaget found that children w ill attribute the quality of being alive to different object types at different stages of development. In general, each stage exhibits a refinement, or narro w ing, of the class of things that are considered alive. The stages are outlined in Table 3.1.

60

Animacy

A s a resu lt of th is d e v e l o p m e nta l pro c ess, c h i l dre n c a n e x h i b it n oti o ns of a l i v e n ess th at depart quite dramatically from the adult version of the concept. For instance, a child of 8 (in stage 1), w hen asked if a bicycle w as alive, replied N o, w hen it doesnt go it is not alive. W hen i t go es i t is a l i v e . O b j e c ts m igh t b e e n d o w e d w i t h c o nsc i o usn ess o f so m e t h i ngs b u t n o t oth ers:
If you pricked this stone, would it feel it? N o . W hy not?Because it is hard .If you put it in the fire, would it feel it?Y es.W hy? Because it would get burned (p176).

C h i l dre n i n t h e e arl i er st ages (0 , 1 , a n d 2) t e n d t o pro d u c e m i x e d a n d u nsyst e m a t i c j u dgm e nts. Pi aget c h ara ct eri z es st age 2 as pri m ari l y a tra nsit i o n p eri o d i n w h i c h t h e c h i l d develops the distinction bet w een things that move on their o w n (such as a person) and things that only move under outside impetus (such as a bicycle). W hen this distinction is made the c h i l d r e a c h e s t h e t h i r d st a g e , w h i c h P i a g e t c o n s i d e r e d t o b e t h e m o st s y st e m a t i c a n d interesting of the four. H ere is an example of a child struggling to express the Stage 3 idea that autonomous motion is the salient quality that determines the ability to feel:
T e l l m e w h at y o u t h i n k , w h at m a k es y o u t h i n k t h at p erh a ps t h e w i n d d o esn t f e e l w h e n it is blowing? Because it is not a person . A nd w hy do you think perhaps it does feel?Because it is it that blows (p183).

Piaget gives special attention to this last answ er as a striking illustration of the nature of third-stage childhood animism. It is it that blows beautifully illustrates the childs mind arriving at the idea that it is initiators of action that are thought to be feeling and thus animate. Piagets vie w is that only at the third stage (usually reached at ages 7 or 8) do children make the distinction betw een motion in general and autonomous motion. This w ould appear to be in conflict with the results of Michotte, Leslie, et al, w ho believed that this distinction w as present m u c h e arl i er. T h is c o nfl i ct m ight b e reso l v e d b y re a l i z i ng th at th e Pi ageti a n stu d i es o p erate p ure l y i n t h e c o n c e pt u a l re a l m , w h ere as t h e ot h er rese arc h ers are st u d y i ng t h e p erc e pt u a l a b i l i t y t o d e t e c t d ist i n c t i o ns. C h i l dre n m a y h a v e a n i n n a t e a b i l i t y t o d ist i ngu ish t y p es o f observed motion, but lack the ability to construct coherent explanations for such motion. The latter ability must be learned, and in some sense the Piagetian developmental sequence is a case of the conceptual mind lagging behind and eventually catching up to the distinctions generated Stage Stage 0 Stage 1 Stage 2 Stage 3 Stage 4 Name N o concept A ctivity M ovement A utonomous movement Adult concept (animals) Description random judgments anything active is alive only things that move are alive only things that move by themselves are alive only animals (and plants) are alive.

Table 3.1: (after (Carey 1985)) The stages of development of the concept of alive.

Animacy

61

innately by the perceptual system. Piagets theory of animism has been critiqued on a number of grounds. For instance, the q u est i o ns ask e d b y t h e e x p eri m e n t er c a n i n d u c e p art i c u l ar f orms o f t h o ugh t a n d st y l es o f judgment (Piaget himself w as a w are of this). A lso, children at all ages seem to use a large variety of techniques for judging w hether or not something is alive, and never use exclusively the fact of a uto n o m o us m o v e m e nt ( C are y 1 9 8 5). C are y s criti q u e se e ms v a l i dth e d e v e l o p m e nt of childrens representation of the concept of living things is no doubt a more complex story than the simple stage theory has it. H o w ever, as C arey admits, her study is not aimed at the heart of t h e Pi age t i a n t h e ory o f a n i m ism , w h i c h is c o n c ern e d m ore w i t h t h e d e v e l o p i ng n o t i o ns o f c a usa l i t y ra t h er t h a n t h e d e f i n i t i o n o f t h e w ord a l i v e i n a n y n arro w se nse . D esp i t e h er disagreements w ith Piaget, she agrees that the separation of intentional causality from other types is central to w hat is changing. This is really the only aspect of the theory that concerns us h ere .

3.2.3

Frameworks of Understanding

A more sophisticated w ay to handle the distinction bet w een animate and inanimate is to tr e a t t h e m , n o t a s c a t e g o r i e s i n t o w h i c h o b j e c ts m u st b e s l o t t e d , b u t a s t w o a l t e r n a t i v e a p pro a c h es w ith w h i c h to a n a l y z e e v ery d a y p h e n o m e n a . Ev e n c h i l dre n are a b l e to fl e x i b l y apply these approaches to some extent (recall the child w ho thought the bike w as alive w hen it moved and not otherw ise). Philosophers and psychologists, w ho perhaps have a greater need to think in fixed categories than children, often try to fix these approaches into categories, but e v e n t h e y e v e n t u a l l y h a v e a b a n d o n e d v i t a l ism a n d d u a l ism , re c ogn i z i ng t h e n e e d t o tre a t animacy and aliveness as epistemological stances rather than fixed facts of the w orld. D ennett h as art i c u l a t e d t h is a b o u t as w e l l as a n y b o d y w i t h h is d ist i n c t i o n b e t w e e n i n t e n t i o n a l a n d p h ysi c a l st a n c es ( D e n n e t t 1 9 8 7), b u t se e a lso (B o d e n 1 9 7 8) o n t h e c h e c k ere d h ist ory o f p u r p o s i v e e x p l a n a t i o n i n p s y c h o l o g y , a n d (S c h a e f e r 1 9 8 0 ) o n h o w F r e u d b l e n d e d b o t h mechanistic and animate stances in his metapsychology. The sociologist Erving G offman explored the question of ho w such stances (frame w orks, in his terms) are used in everyday life and ho w they function in organi z ing cognition and society. H is a p pro a c h ( G offm a n 1 9 7 4) i d e ntifi es t w o pri m ary fra m e w orks: so c i a l a n d n atura l , w h i c h correspond roughly to D ennetts intentional and physical stances:
W hen the individual in our W estern society recogni z es a particular event, he [employs] one or more frame w orks or schemata of interpretation of a kind that can be called primary. I say primary b e c a use a p p l i c ati o n of su c h a fra m e w ork or p ersp e cti v e is se e n b y th ose w h o a p p l y it as n ot d e p e n d i ng o n or h ark i ng b a c k t o so m e pri or or origi n a l i n t erpre t a t i o n ; i n d e e d a pri m ary frame w ork is one that is seen as rendering w hat w ould otherw ise be a meaningless aspect of the scene into something that is meaningful... In daily life in our society a tolerably clear distinction is sensed, if not made, bet w een t w o broad classes of primary frameworks: natural and social. N atural frameworks identify occurrences seen as undirected, unoriented, unanimated, unguided, purely physical...It is seen that no w illful agency causally and intentionally interferes, that no actor continuously guides the outcome. Success or failure in regard to these events is not imaginable; no negative or positive sanctions are involved. Full determinism and determinateness prevail.

62

Animacy

So c i a l fra m e w orks, o n t h e o t h er h a n d , pro v i d e b a c kgro u n d u n d erst a n d i ng f or e v e n ts t h a t incorporate the will, aim, and controlling effort of an intelligence, a live agency, the chief one being the human being. Such an agency is anything but implacable; it can be coaxed, flattered, affronted, and threatened. W hat it does can be described as guided doings. These doings subject the doer to standards, to social appraisal of his action based on its honesty, efficiency, economy, safety, elegance... A serial management of consequentiality is sustained, that is, continuous corrective control, becoming most apparent w hen action is unexpectedly blocked or deflected and special compensatory effort is required. M otive and intent are involved, and their imputation helps select which of the various social frameworks of understanding is to be applied (p.21-22)/

T h ese gu i d e d d o i ngs are su b j e ct t o c o nst a nt e v a l u at i o n b ot h fro m t h e d o er a n d fro m other participants on the scene as to their efficacy and quality, distinguishing them from purely natural happenings, w hich are not so judged. Social frame w orks, but not natural frame w orks, involve actors, that is, humans (or occasionally other entities such as animals or gods) that can initiate actions and are responsible for their success. Frame w ork-based interpretation is fluid; a scene that appears to be a guided doing may be tra nsform e d (thro ugh a c c i d e nts or m uffi ngs , or b y th e re a l i z ati o n th at a n a ct th at se e m e d intentional w as actually an accident) into a scene in w hich physics takes over from intention (for example, an ice-skater who slips and falls).
The concepts of muffings and fortuitousness have a considerable cosmological significance. G iven our belief that the w orld can be totally perceived in terms of either natural events or guided doings and that every event can be comfortably lodged in one or the other category, it becomes apparent that a means must be at hand to deal with slippage and looseness (p34-35).

The relevance of G offman to this discussion is his specifically cultural perspective on the d i c h oto m y b et w e e n a n i m ate a n d i n a n i m ate . T h e a b i l ity to d isti ngu ish b et w e e n c a use d a n d a uto n o m o us m oti o ns m a y b e i n n ate , b ut th e ty p es of situ ati o ns i n w h i c h th is d isti n cti o n is a p p l i e d c a n b e e n orm o usl y v ari e d a n d c o n d iti o n e d b y c u lture . F or i nsta n c e , d iffere n c es i n religious vie ws can often lead to differing use of frame w orks: w here some might see a natural disaster others might see the w ill of a god. T h e a n i m ate re a l m n o w ta k es o n asp e cts of m ora l ity a n d th e n e c essity of j u dgm e nt: o ur so c i a l l i v es re q u ire us to m a k e th ese d isti n cti o ns a n d to b e su b j e ct to th e m . Tri a ls i n w h i c h insanity defenses arise are an excellent example of a situation in w hich the distinction betw een natural and social arises. A defendant w ho can be judged subject to the presumptively external causation of insanity can escape having his actions judged according to the standards of social frame w orks. Social frame w orks impose standards. A ctions vie w ed w ithin social frame w orks can be successful or otherw ise, because they are initiated and guided by social actors.

3.2.4

Animacy and the Representation of Action

A nimacy appears to be a basic category of the human mind, appearing in a variety of forms at different levels of cognition. But to think of animacy as simply a category, in isolation from its r o l e i n u n d e rst a n d i n g , i s t o m i ss i t s s i g n i f i c a n c e , w h i c h st e m s f r o m i t s k e y r o l e i n t h e understanding of action and causality. T o try a n d u n d erst a n d t h e p l a c e o f a n i m a c y i n c ogn i t i o n , w e n e e d a t h e ory o f representation that takes into account the importance of action. W e w ill use M inskys frameAnimacy 63

b ase d th e ory of u n d ersta n d i ng ( M i nsk y 1 9 8 7 , p 2 4 5), i n p arti c u l ar th e th e ory of tra ns-frames w h i c h h as i ts ro o ts i n Sc h a n k s c o n c e p t u a l d e p e n d e n c y sc h e m e f or re prese n t i ng se m a n t i c i nform ati o n (Sc h a n k 1 9 7 5). U si ng th ese to o ls, I w i l l atte m pt to sk etc h o ut su c h a c ogn iti v e theory of animacy. In M inskys theory, a frame is essentially a conceptual template or schema, representing a single concept such as chair or thro w , w ith labeled slots or terminals th at serv e to c o n n e ct i t t o o t h er fra m es t h a t re prese n t re l a t e d p arts. So f or i nst a n c e a c h a ir fra m e w o u l d h a v e terminals to represent legs and back, w hile a thro w frame w ould have terminals representing th e o b j e ct thro w n , th e thro w er, a n d so forth . U n d ersta n d i ng a sc e n e , se nte n c e , or situ ati o n involves selecting a frame for it and finding appropriate entities to fill its terminals. O ne particularly important kind of frame, used to represent action and change, is called a trans-frame. A tra ns-frame is a generalized representation of action, which can be specialized for p arti c u l ar c irc u msta n c es b y fi l l i ng i n term i n a ls for v ari o us ro l es su c h as A C TI O N , O RI G I N , D ES T I N A T I O N , A C T O R , M O T I V E , a n d M E T H O D . Trans- f r a m e s r o u g h l y c o rr e s p o n d t o sentences, in terms of the scale of the concept they encode, although the frame w ith its many term i n a ls is c a p a b l e of i n c l u d i ng m ore i nform ati o n th a n a ty p i c a l se nte n c e . Sc h a n k furth er c ategori z es tra ns e v e n t s i n t o P T R A N S , M T R A N S , a n d A T R A N S t y p e s , c o rr e s p o n d i n g t o w hether the action involves physical movement, the transmission of information, or the transfer of abstract relationships like o w nership.

Trans-frames give us a w ay to think about the representation of action, and thus a w ay to think about animacy, leading to a simple theory of w hat it means for something to be animate: A thing w ill be seen as animate if its representation can plausibly fit into the A C T O R terminal of a tra ns-frame . O r in other w ords, something w ill seem animate if it can be seen as the initiator of an action. From the standpoint of language, this is equivalent to saying that it can be the subject of a sentence describing the action (assuming the sentence is in the active voice). This definition of animacy suggests the classical Aristotelian definition of an actor or agent as one w ho initiates action. O f course, this definition is slightly tautological, and it doesnt tell us w hat things w ill be able to take on this role or w hy. But it does give us a convenient w ay to think about ho w the animate category functions in relation to other mechanisms for understanding action.
C onsider again the example from Piaget, w here a child explains w hy he thinks that the w ind c a n fe e l b e c a use it is it th at b l o w s . It a p p e ars th at th e c h i l d h as a fra m e for BL O W I N G , w hich has an actor slot that needs to be filled. U nable to find anything else to put in that slot, the w ind itself must be there: it is it that blo ws . A nd, w hen the w ind takes on this role, it is s o m e h o w e n d o w e d w i t h t h e p r o p e rt i e s o f t h e l i v i n g , d e s p i t e t h e f a c t t h a t t h e c h i l d h a d c o n c l u d e d e arl i er th at th e w i n d c o u l d n o t f e e l , b e c a use i t is n o t a p erso n . A n o t h er c h i l d denies animacy to the w ind, because it is the cloud that makes it blo w (that is, the w ind here is a n o b j e ct rat h er t h a n a n a ct or), a n d y et a n ot h er b est o w s f e e l i ng u p o n t h e c l o u ds f or t h e sa m e re aso n . A C T O Rh o o d se e ms t o p l a y a p o w erf u l ro l e i n d e t erm i n i ng w h e t h er or n o t something is thought to be animate. W hy are actions and actors so important to cognition? A lthough the w orld may be in reality a unified flux of physical causation, we cant think about it that way on a practical level. Instead, w e need to divide the changing w orld up into representable parts such as objects and actions. 64 Animacy

A n action is a segment of activity w ith a beginning, generally in the form of an actors intention, and an end, in w hich the w orld is in a ne w state as a result of the action. The idea of action, and the related ideas of autonomous, intentional actors (and the notion that they can have free w ill) is an artifact of this need to represent the w orld in manageable chunks. M ore c o m p l e x re aso n i ng re q u ires u n d erst a n d i ng se q u e n c es o f e v e n ts, w h i c h i n t urn involves chaining tra ns-frames together. In such a chain, individual objects w ill change their roles: w hat w as an O BJEC T of action in one frame may become the A C T O R in the next. The ability to manipulate chains of changes is important to reasoning and suggests that the ability to sw itch bet w een animate and inanimate may actually be a necessity born of the need to create such chains (see (A ckermann 1991) for a similar argument). The act of explanation chains transframes in the opposite direction: w hen w e ask a question like w hat made him do that? w e are se e k i ng to b u i l d a fra m e th at p uts w h at w as a n A C T O R i nto a n O BJE C T-l i k e ro l e . W h e n a n A C T O Rs initiation of action is explained by its internal properties, it appears purposeful; w hen explained by external factors, it appears reactive. If it cant be explained at all, w hich is often the case, the action might have to attributed to something like free will.

3.2.5

Conclusion: the Nature of Animacy

W e have attempted to define the animate realm through multiple approaches. Based on the above analyses, I w ould like to posit three properties w hich together seem to characteri z e the animate domain:

A utonomy : the ability to initiate action. A nimate creatures are capable of taking action on their o w n, w ithout an apparent external physical cause. Purp osefu l n ess: th e a cti o ns u n d erta k e n b y a n i m ate cre atures are ofte n d ire cte d to w ards the achievement of a goal. This implies further that such actions can be evaluated as to their effectiveness. Reactivity : animate creatures are responsive to their environment and adapt their actions as necessary to the changes of the environment.

These properties relate to each other in complex w ays, and in some respects are in tension w i t h e a c h o t h er. T h e c o n c e p t o f p urp ose f u l n ess is b o u n d u p w i t h a u t o n o m ya n o b j e c t s actions will be se e n as more autonomous if they are directed to w ard a goal rather than being driven solely by outside forces. Reactivity is a crucial part of purposefulnessa creature acting to achieve a goal cannot do so blindly, but must be able to respond to changing conditions in the w orld. H o w ever, reactivity can be in tension w ith autonomy, since if the creature is reacting to outside conditions, then it is in some sense being driven by outside forces, rather than initiating a c t i o n . F or i nst a n c e , a frog c a t c h i ng a f l y w i t h i ts t o ngu e c a n b e c o nsi d ere d t o h a v e b o t h reacted to the fly and to have initiated the action. The frog is the central actor in this version of th e story . B ut it w o u l d b e j ust as v a l i d , if o d d , to te l l a story w ith th e fl y as th e m a i n a ctor, acting causally on the frog to cause its o w n demise. The frog in this version is still reactive, but its autonomy has disappeared. The presence of autonomy is particularly dependent upon point of vie w and the choice of starting points w hen describing a sequence of causal events. Animacy 65

A n i m a c y , th e n , is m ore pro p erl y u n d ersto o d as a fra m e w ork or w a y of th i n k i ng, rath er than as a category. A nimate thinking stems from a basic need to explain happenings and tell simple stories about them, and a need to fit things into roles in the stories as actors and objects of action. Scientific and mechanistic w ays of thinking are in some sense attempts to get beyond these basic animistic tendencies, in that they tend to eliminate autonomy by searching for a cause for every action. But the tendency to describe the w orld in terms of autonomous acters is strong. Even scientists w ho should kno w better tend to try to find simple explanations and si ngl e a ctors rath er th a n gra p p l e w ith th e d istri b ute d c a usa l ity of a c o m p l e x syste m (K e l l er 1985) (Resnick 1992).

3.3

Animacy and Computation

A nimacy is a primary domain, in that it is not itself grounded in metaphor but in more basic p r o c e ss e s . H o w e v e r , i t c a n a n d d o e s s e r v e a s a s o u r c e d o m a i n f o r t h e m e t a p h o r i c a l u n d ersta n d i ng of oth er re a l ms. O b v i o us a n d fa n c ifu l v ersi o ns of th ese m eta p h ors are q u ite c o m m o n i n e v ery d a y l ife , as i n uttera n c es l i k e th is b ottl e j ust d o esn t w a nt to b e o p e n e d . So m e m e c h a n i c a l syst e ms are so c o m p l e x t h a t t h e y n e e d t o b e tre a t e d as h a v i ng m o o ds, particularly vehicles, and are thus anthropomorphi z ed. I w ill refer to such usages as animate metaphors. C omputer systems in particular are prone to be anthropomorphi z ed, due to their complexity and apparent autonomy:
Anthropomorphization 9 Sema nti c a l l y , o n e ri c h so urc e of j argo n c o nstru cti o ns is th e h a c k ish tendency to anthropomorphi z e hard w are and soft w are. This isn't done in a naive w ay; hackers don't personali z e their stuff in the sense of feeling empathy w ith it, nor do they mystically believe that the things they work on every day are 'alive'. W hat is common is to hear hardware or software talked about as though it has homunculi talking to each other inside it, w ith intentions and desires. Thus, one hears The protocol handler got confused, or that programs are trying to do things, or one may say of a routine that its goal in life is to X. O ne even hears explanations like ... and its poor little brain couldn't understand X, and it died. Sometimes modeling things this w ay actually seems to make them easier to understand, perhaps because it's instinctively natural to think of anything with a really complex behavioral repertoire as 'like a person' rather than 'like a thing'.

The computer bridges the animate and inanimate w orlds as fe w other objects can. A lthough even humans can become subject to physical rather than intentional explanations, the computer, as a manufactured object designed around animate metaphors, inherently straddles the divide. People w ho interact w ith computers must do the same. Sherry Turkle has written e x t e n s i v e l y o n c h i l d r e n s r e a c t i o n s t o c o m p u t e rs a s m a rg i n a l o b j e c t s , n o t r e a d i l y categorizable as either living or inanimate:
C omputers, as marginal objects on the boundary bet w een the physical and the psychological, force thinking about matter, life, and mind. C hildren use them to build theories about the animate and the inanimate and to develop their ideas about thought itself (Turkle 1984, p31).

But animate metaphors for computation can be problematic as w ell. AI, w hich might be c o nsi d ere d a n a tt e m p t t o b u i l d a n e x t e n d e d m e t a p h ori c a l m a p p i ng b e t w e e n h u m a ns a n d

9 From the communally-written H acker Jargon File, Version 3.0.0, 27 July 1993, http://fount.journalism.wisc.edu/jargon/jarg_intro.html

66

Animacy

m a c h i n e s , i m p i n g e s u p o n h i g h l y c o n t r o v e rs i a l i ss u e s i n p h i l o s o p h y , a n d g i v e s r i s e t o c o n tr a d i c t o r y i n t u i t i o n s , i n t e n s e p a ss i o n s , a n d st u b b o r n d i s a gr e e m e n ts a b o u t w h e t h e r computational processes can truly achieve intelligence ( D reyfus 1979), (Penrose 1989), (Searle 1980). The stereotypical AIs and robots seen in fiction are lifelike in some w ays, but mechanical i n o t h e rs i n f l e x i b l e , i m p l a c a b l e , e v e n h o st i l e . C o m p u t e rs a r e s a i d t o l a c k c e rt a i n k e y components of humanity or aliveness: consciousness, free w ill, intentionality, emotions, the ability to deal w ith contradiction. People exposed to computers w ill often end up defining their o w n humanness in terms of w hat the computer cannot apparently do (Turkle 1991). Something about the nature of computers, no matter ho w intelligent they are, seems to keep them from being seen as full members of the animate realm. O ur f o c us o n a n i m a t e m e t a p h ors a l l o w s us t o si d est e p t h is o ft e n st eri l e p h i l oso p h i c a l d e b a t e . Inst e a d , w e w i l l e x a m i n e t h e w a ys i n w h i c h c o m p u t a t i o n a l pra c t i c e m a k es use o f animism to structure itself. W ith i n th e fi e l d of c o m p utati o n , a nthro p o m orp h i c m eta p h ors are so m eti m es d e n i e d as wrongheaded or harmful:
N e v er refer to parts of programs or pieces of equipment in an anthropomorphic terminology, nor allo w your students to do so...The reason for this is that the anthropomorphic metaphor...is an enormous handicap for every computing community that has adopted it...It is paraly z ing in the sense that because persons exist and act in time , its adoption effectively prevents a departure from operational semantics and, thus, forces people to think about programs in terms of computational behaviors, based on an underlying computational model. This is bad because operational reasoning is a tremendous waste of mental effort (D ijkstra 1989).

B u t m o st c o m p u t e r p r a c t i t i o n e rs a r e n o t o f t h e o p i n i o n t h a t a n t h r o p o m o r p h i s m ( o r o p e r a t i o n a l t h i n k i n g , f o r t h a t m a t t e r) i s s u c h a b a d t h i n g . I n d e e d , t h e d e l i b e r a t e u s e o f anthropomorphism has been a promising tool in computer education:


O ne reason turtles w ere introduced [into Logo] w as to concreti z e an underlying heuristic principle i n pro b l e m-so l v i nga nthro p o m orp h i z e! M a k e th e i d e a c o m e a l i v e , b e so m e o n e . . . T a l k i ng to inanimate objects and thus giving them life is an implicit pattern in our lives; we have tried to turn it to our advantage and make it an explicit process (Solomon 1976).

A c o m m o n w orry a b o u t a n t hro p o m orp h i c d escri p t i o ns o f c o m p u t a t i o n a l syst e m is t h e danger of causing overattribution errors. That is, people might dra w incorrect inferences about the abilities of computers, assuming that they share more properties of the animate than they actually do, such as the ability to reason or to learn. Sometimes this is dealt w ith by instructing students to regard the little people as particularly dumb, mechanical instruction follo w ers w ith no goals, judgment, or intelligence of their own, much like a player of the Simon Says game. In Paperts phrase, anthropomorphism can concreti z e dumbness as w ell as intelligence. T h i s s e c t i o n e x p l o r e s t h e a n i m a t e r o o ts o f c o m p u t a t i o n a n d t h e w a y s i n w h i c h t h e programming paradigms introduced in the last chapter make use of animate metaphors. W e w ill also look at the relation of animism to human interface design, artificial intelligence, and the t e a c h i ng o f progra m m i ng. T h e q u est i o ns t o b e ask e d are w h i c h a ttri b u t es o f a n i m a c y are mapped into the computational domain, and onto w hat parts.

Animacy

67

3.3.1

Animism at the Origins of Computation

T h e e n t ire e n t erprise o f c o m p u t a t i o n m igh t b e se e n as b e i ng b u i l t aro u n d a seri es o f anthropomorphic metaphors, beginning w ith Turings description of w hat are no w called Turing machines. A t this point in time, the w ord computer referred to a human calculator, w ho w as destined to be replaced by the described machine:
C omputing is normally done by writing certain symbols on paper. W e may suppose this paper is divided into squares like a childs arithmetic book... the behavior of the computer at any moment is determined by the symbols w hich he is observing, and his state of mind at that moment. W e may suppose that there is a bound B to th e n u m b er of sy m b o ls or sq u ares w h i c h th e c o m p uter c a n observe at one moment... Let us imagine the operations performed by the computer to be split up into simple operations... Every such operation consists of some change of the physical system consisting of the computer and his tape [a one-dimensional version of the squared paper]... The operation actually performed is determined, as has been suggested by the state of mind of the c o m p u t er a n d t h e o bserv e d sy m b o ls. In p art i c u l ar, t h e y d e t erm i n e t h e st a t e o f m i n d o f t h e computer after the operation. W e may now construct a machine to do the work of this computer (Turing 1936).

H ere the anthropomorphism underlying computation is made quite explicit. C omputation is first c o n c e i v e d of as a h u m a n a cti v ity , a l b e it o n e c arri e d o ut i n a rath er form a l a n d l i m ite d m a n n er. T h e m eta p h ori c a l m a p p i ng fro m th e h u m a n d o m a i n h as so m e q u esti o n a b l e componentsin particular, the characteri z ation of the human computer as having a state of mind that is discrete and dra w n from a finite set of possible states. N onetheless this metaphor h as pro v e n e xtra ord i n ari l y p o w erfu l , a n d forms th e b asis of th e i m p erati v e m o d e l of programming described in section 2.2.3.1. This prototypical computer, w hile described in animate terms, has fe w of the properties that are central to animacy. The computer is not particularly autonomousit is doing w hat it is told, no more, no less. Its purpose, if any, comes from outside itselfit has no representation or a c c ess to its go a l . It h as n o re l ati o nsh i p w ith a w orl d o utsi d e of its o w n ta p e m e m ory , so certainly cannot be said to be reactive. It is, ho w ever, repeatedly performing actions, and so despite its limitations is seen as animate. I call this particular reduced form of animism rote instruction follo w er animism, to contrast it w ith the concept of animacy used in everyday life, w hich is linked to autonomy, purposefulness, and consciousness. It is i nteresti ng to c o ntrast th is form of c o m p utati o n a l a n i m ism w ith th e re l ate d i m agery f o u n d i n t h e d isc o urse o f c o m p u t a t i o n s c l ose c o usi n , c y b ern e t i cs. C y b ern e t i cs a n d t h e technology of computation developed in parallel during and after W orld W ar II. C ybernetics c o n c e r n e d i t s e l f p r e c i s e l y w i t h t h o s e p r o p e r t i e s o f a n i m a c y m a rg i n a l i z e d b y T u r i n g s hypothetical machine and the later actual machines: purposefulness, autonomy, reactivity, and the importance of the relationship bet w een an organism and its environment. These sciences had origins in different technological tasks (feedback control in the case of cybernetics, codebreaking in the case of computation), different mathematical bases (continuous time series vs. discrete symbolic manipulation), and ultimately in different ideas about the mind (regulative vs. cognitive). W hile the t w o approaches w ere discussed together during the period of the M acy conferences ( H eims 1991), they ultimately w ent their separate w ays. Recent developments in AI, such as the situated action approach to behavioral control (Agre and C hapman 1987) are in some sense an attempt to bring back into AI the cybernetic elements that w ere split off. 68 Animacy

3.3.2

Animacy in Programming

The various programming models described in the last chapter can be analy z ed in terms of animacy. This w ill mean looking at each in terms of w hat each model offers the programmer in t e r m s o f t o o l s f o r t h i n k i n g a b o u t a c t i o n a n d a c t o r s . L i k e tra ns-fr a m e s , st a t e m e n ts o f programming languages can be considered as representations of change. If w e assume that the o p era t i o n o f progra ms is u n d erst o o d , a t l e ast i n p art , b y m e a ns o f t h e a p p l i c a t i o n o f su c h fra m es, w e c a n ask o urse l v es q u esti o ns a b o ut th e c o nte nts of th e term i n a ls of su c h fra m es. W hat are the actions, w hat are the A C T O Rs and O RI G I N s and D ESTI N A TI O N s? The identities of the A C T O Rs are of particular interest: w ho or w hat is making these actions happen, w ho is in charge? W hat images of control can inform our understanding? To take an obvious example, consider an imperative assignment statement like LET A=B. In the above terms, it is a command to move a value O BJEC T (contained in B) from a S O U RCE (B) into a D ESTI N A TI O N (A). This is essentially represented metaphorically as a physical transfer (PTRA N S) of an object from one place to another, although neither the objects nor places are truly physical in any tangible sense. But w hat about the A C T O R terminal of the trans-frames that represents this action? W ho is performing the move operation? Imperative statements or commands like the one above are like imperative sentencesthey do not explicitly name their A C T O R, instead they have an implied actor w ho is the recipient of the command. In the computational case, the computer itself w ill take on the role of A C T O R w hen it executes the instruction. This mode of address meshes w ith the image of the computer as a n a n i m ate b ut d u m b b e i ng, w h o m ust b e i nstru cte d i n d eta i l a n d c a n n ot re a l l y ta k e a n y action on its o w n. W hile object-oriented programming languages also follo w a basically imperative model, the image of their operation is some w hat different, because the objects are available to fill A C T O R terminals. In O O P, programs are written as methods for specific object classes, and are seen as executing on behalf of particular objects. This tends to make the implied actor of an imperative instruction that occurs inside a method be the object, rather than the computer as a w hole. The fact that methods can refer to their o w ning objects through reserved w ords like self heightens this effect. M essage-passing O O P languages introduce M TRA N S or information-transmission events to the metaphorical underpinnings of the language. A message send is an action that transmits a request or order from one object to another (or to itself). O O P languages often use animistic names like ask or send for this operation. In a frame representation of a message-passing action, o b j e c ts w i l l o c c u p y b o t h t h e A C T O R a n d D ESTI N A TI O N t erm i n a ls. O n c e t h e m essage is tra nsm i tt e d , t h e D ESTI N A TI O N o b j e c t e x e c u t es i ts o w n m e t h o d f or t h e m essage a n d , i f i t should take any action, will fill the A CT O R role of the next operation. M essage-passing languages thus provide a richer conceptual image of their activity than can be found in the basic imperative model, even though the computations they support may be identical. The activity is no longer the actions of a single actor, but a complex of interactions bet w een objects. Even though, in an ordinary object-oriented language, the objects are not in any real sense active or autonomous (that is, they only take action w hen explicitly activated Animacy 69

from the outside), they provide better handles for programmers to apply animistic thinking. The p art i a l l y a n i m ist i c n a t ure o f o b j e c ts cre a t es n a t ura l j o i n ts t h a t a l l o w t h e progra m m er or program reader to carve up the activity of the program into small segments, each of w hich is more readily understood in animate terms. W hereas previously the computation w as seen as a single actor manipulating passive objects, under O O P objects are seen as taking action on their o w n behalf. Functional languages, by contrast, are those in w hich action, time, and change have all been banished for the sin of theoretical intractability. Such languages do not support animate thinking at all, and there are no implied actors to be found. Some programming environments that are quasi-functional, like spreadsheets, are amenable to a rather limited animate interpretation, in the se nse th at spre a dsh e et c e l ls th at h a v e a fu n cti o n a l d efi n iti o n c a n b e th o ught of as a cti v e l y pulling in the outside values needed to compute their o w n value. Spreadsheet cells are also responsive to change, and purposeful in that they act on their o w n to maintain their value in th e fa c e of c h a nge . B ut b e c a use th e y c a n n ot a ct to c h a nge th e w orl d o utsi d e of th e mse l v es, they are not going to be understood as animate in any broad sense. Procedural languages blend the imperative and functional models, and so admit to being u n d e rst o o d a s a n i m a t e t o v a r y i n g d e gr e e s d e p e n d i n g o n t h e st y l e o f t h e p r o gr a m . T h e modulari z ation of a program into a collection of procedures allo ws each procedure to be seen in animate terms; this is exemplified by the little-person metaphor, described below. C o nstra i nt syste ms a n d l a ngu ages v ary i n th e ir tre atm e nt of a ctors a n d age n c y . Li k e th e fu n cti o n a l m o d e l , th e y e m p h asi z e d e c l arati v e state m e nts of re l ati o nsh i ps rath er th a n specification of action, and so tend to be actorless. But some, like ThingLab, explicitly treat the constraints as objects w ith procedural methods. This suggests that the constraints themselves paradigm imperative functional dataflow procedural organizing metaphors and principles action, instruction-following functional mappings flo w of values through net w ork treatment of agents single implicit agent no agents cells can be seen as pulling agents

society of computing objects; call and pro c e d ures c a n b e se e n as age n ts; return m eta p h ors; c o m b i n es i m p era- little-person metaphor tive and functional modes communication metaphors, message- e n c a psu l ati o n h e l ps to prese nt o bsending, encapsulation jects as agents d e c l a r a t i o n s o f r e l a t i o n s h i p s t o b e c o n str a i n ts c a n b e s e e n a s a g e n ts maintained with goals.
Table 3.2: Summary of metaphors and agents in programming paradigms.

object-oriented

constraint

70

Animacy

could take the role of actors in the system. But in practice, constraints are seen as passive data use d b y a u n itary c o nstra i nt-so l v er. T h e pro c e d ura l si d e of c o nstra i nts are si ngl e state m e nts that are manipulated as data objects by a planner, rather than active entities in their o w n right. A nimacy is a po w erful conceptual tool w ith w hich to analy z e programming paradigms (see Table 3.2 for a summary). In particular, it can help explain the specific appeal and utility of object-oriented programming, w hich has in recent years become an extremely popular model for commercial programming. O O P is fundamentally just a w ay of organi z ing a program, and it h as n ot a l w a ys b e e n c l e ar w h y or e v e n if it is a su p eri or w a y to d o so . A n i m ism pro v i d es a theory about w hy O O P is po w erful: its particular style of modulari z ation divides up a program so that animate thinking can be readily applied to any of its parts. Functional programming, on the other hand, provides a model that systematically excludes animism, w hich might explain w hy, despite its undeniable theoretical advantages, it has little popularity outside of a small research community. A nimism lurks in the background of these classic programming models. C an it be used as an explicit basis for the design of ne w ones? Agent-based programming, to be described, attempts t o d o j ust t h a t . In p art i c u l ar, i t se e ks t o pro v i d e a l a ngu age f or progra ms t h a t are understandable in animate terms, but w ith the A C T O R slot filled by objects that partake of a higher degree of animacy than the rote instruction follo w ers found in the imperative and object models. They should be capable of being seen as possessing the main qualities of real animacy: purposefulness, responsiveness, and autonomy.

3.3.2.1

The Little-Person Metaphor

The little-person metaphor is a teaching device used to explain the operation of Logo to beginners. The little-person metaphor w as invented by Seymour Papert in the early days of Logo development; the description here derives from the descriptions in ( H arvey 1985) and (diSessa 1 9 8 6). U n d er t h is m e t a p h or, t h e c o m p u t er is p o p u l a t e d w i t h l i t t l e p e o p l e (LPs) w h o are sp e c i a l ists at p arti c u l ar pro c e d ures, a n d h ire oth er LPs to p erform su b pro c e d ures. LPs are n o r m a l l y a s l e e p , b u t c a n b e w o k e n u p t o p e rf o r m t h e i r t a s k . W h e n e v e r a n LP n e e d s a subprocedure to be run, it w akes up and hires an LP w ho speciali z es in that procedure, and goes to sleep. W hen the hired LP finishes executing its procedure, it rea w akens the caller. A chief LP serves as the interface to the user, accepting tasks from outside the LP domain and passing them on to the appropriate specialists. The LP metaphor is an explicitly animate metaphor for a procedural language. Procedures are still rote instruction follo w ers, accepting commands from the outside and executing fixed scripts, and not capable of autonomous activity in any sense. Still, the LP metaphor succeeds quite w ell in animating procedures and making their activity understandable. In some respects it is easier to see a procedure as animate than the computer as a w hole. I believe this is because a p r o c e d u r e , b e i n g s p e c i a l i z e d f o r a p a r t i c u l a r t a s k , b r i n gs a l o n g w i t h i t a f e e l i n g o f p urp osefu l n ess. LPs th us c a n b e se e n as fu lfi l l i ng a task rath er th a n as si m p l y c arry i ng o ut a sequence of instructions. The social and communicative aspects of the metaphor are also important, since they give a metaphoric basis to the relationships bet w een procedures.

Animacy

71

The little-person metaphor has been quite successful as a device for teaching the detailed w orkings of the Logo language. 10 Sometimes the model is taught through dramati z ation, w ith students acting out the parts of the little people. N ot only does the model provide a good tangible model for the otherw ise abstruse idea of a procedure invocation, but it turns them into animate objects, allo w ing students to identify w ith them and to project themselves into the environment.

3.3.3

Body- and Ego-Syntonic Metaphors

T h e Logo turtl e w as d e v e l o p e d to e n c o urage w h at Pa p ert c a l ls syntonic learning (Pa p ert 1 9 8 0 , p . 6 3). T urtl es are sa i d to b e b o d y sy nto n i c , in that understanding a turtle is related to and compatible w ith learners understandings of their o w n bodies. The turtle may also be ego sy nto n i c in that it is coherent w ith childrens sense of themselves as people w ith intentions, go a ls, d esires, l i k es, a n d d isl i k es . Sy n t o n i c l e arn i ng, t h e n , is a n y f orm o f l e arn i ng w h i c h someho w engages w ith the students existing kno w ledge and concerns, in contrast to the more common style of dissociated learning (such as the rote learning of historical events or multiplication tables). Paperts theory of syntonic learning resonates w ith our theory of metaphorically-structured understanding, w hich holds that all real conceptual learning involves building connections w ith existing kno w ledge. Looking at syntonic learning as a metaphor-based process might give us a w ay to think about ho w it w orks. Body syntonic learning involves creating a correspondence betw een the body of the learner and some anthropomorphic element in the problem w orld (the turtle). The learner is thus able to bring to bear a large store of existing kno w ledge and experience to w hat w as an unfamiliar domain (geometry, in the case of the turtle). M etaphors based o n t h e b o d y h a v e t h e a d v a n t age o f u n i v ersa l i t y: e v ery o n e h as a b o d y a n d a l arge st o c k o f kno w ledge about it, even young children. The po w er of the turtle lies in its ability to connect bodily knowledge with the seemingly more abstract realm of geometry. T h e u t i l i t y o f b o d y-sy n t o n i c i t y f or pro b l e m so l v i ng h as a lso b e e n e x p l ore d b y (Sa y e k i 1 9 8 9). Sa y e k i e x p l ore d h o w p e o p l e pro j e ct th e mse l v es i nto a n i m agi n ary sc e n e su c h as th e w orld of a physics or geometry problem, and found that problem solving times could be drastic a l l y d e cre ase d b y i n c l u d i ng c u es th at a l l o w e d so l v ers to m a p th e pro b l e m o nto th e ir o w n bodies (i.e. making w hat w as a geometric figure resemble a body by the addition of a cartoon head). By introducing anthropomorphic forms (w hich he labels kobitos, or little people) he can apparently make it much easier for subjects to find the appropriate mappings from their o w n b o d i es t o t h e o b j e c ts o f t h e pro b l e m , a pro c ess h e re f ers t o as t hro w i ng-i n . T h is is a n interesting case of the deliberate deployment of metaphor in order to aid in problem-solving. It also highlights the active nature of the process of metaphorical understandinglearners actively project themselves into the problem domain, as is the case w ith the turtle.

10 Seymour Papert, personal communication.

72

Animacy

The reali z ation of body-syntonicity through turtles and similar physical or graphic objects that permit identification w ould seem to be a clear success. Ego-syntonicity, ho w ever, is more problematic. The Logo turtle is only w eakly ego-syntonic. A turtle al w ays has bodily properties (position and heading), but does not in itself have goals and intentions of its o w n, or behaviors that take into account the environment (Resnick and M artin 1991). If it has any kind of ego, it is t h e si m p l e-m i n d e d o n e o f t h e ro t e i nstru c t i o n f o l l o w er. A n d t h is o f c o urse d o es a l l o w t h e learner to project some of their o w n mental activity onto the turtle, but only a highly limited subset. The turtle can, in theory, be programmed to have ego-syntonic properties like goals, b ut th e y are n ot i n h ere nt i n th e b asi c Logo turtl e or th e Logo e n v iro n m e nt. In p arti c u l ar, i n many implementations of Logo the turtle lacks any kind of sensory capability and thus cannot really have goals because there is no w ay to verify w hen the goals are satisfied. Later w ork by Pa p ert a n d h is stu d e nts (Pa p ert 1 9 9 3) ( M arti n 1 9 8 8) a d dresses th e issu e of a ugm e nti ng th e turtle w ith sensors so that it could have responsive behaviors and gave more emphasis to the role of feedback. H o w ever, the Logo language is still essentially oriented around the procedural model, rather than a reactive or goal-oriented one. There are strong emotional factors at w ork in this process of projection and identification. C hild programmers may have different styles of relating to the computer that affect ho w or if they can identify w ith and project themselves onto the machine. Such styles are strongly conditioned by gender and other social factors (Turkle 1984) (Papert 1993). It has been suggested, f or i nst a n c e , t h a t t h e c h i l d-re ari ng ro l e o f w o m e n pre d isp oses t h e m t o t a k e p l e asure i n anothers autonomy w hile men are more likely to be preoccupied w ith their o w n autonomy and thus more prone to domination and mastery rather than nurturing the autonomy of others (Keller 1985). This difference in style has been observed in the different programming styles of b o y s a n d g i r l s l e a r n i n g t o p r o gr a m ( M o t h e r w e l l 1 9 8 8 ) ( T u r k l e a n d P a p e r t 1 9 9 1 ) . I n M otherw ells study, girls w ere considerably more likely to treat the computer as a person than w ere b o ys.

3.3.4

Anthropomorphism in the Interface

H uman interface design has considered anthropomorphism in the form of agents . In this context, an agent is an intelligent intermediary bet w een a user and a computer system, visuali z ed as an anthropomorphic figure on the screen w ith w hom the user interacts, often by means of natural language (A pple C omputer 1991). Interface agents are still mostly a fantasy although there are some explorations of anthropomorphic interfaces w ith minimal backing intelligence ( O ren, Salomon et al. 1990), as w ell as efforts to use more caricatured, less naturalistic anthrop o m orp h i c m e t a p h ors t h a t use e m o t i o n t o i n d i c a t e t h e st a t e o f a c o m p u t a t i o n a l pro c ess (Ko z ierok 1993). There is a long-standing debate in the interface community about the utility and ethics of agents (Laurel 1990). A nthropomorphic agents promise easier to use interfaces for novices; but they also threaten to isolate the more experienced user from the ability to directly control their v irt u a l w orl d (Sh n e i d erm a n 1 9 9 2) (La n i er 1 9 9 5). O t h er e t h i c a l issu es re v o l v e aro u n d t h e question of w hether having a computational system present itself as a mock person requires or elicits the same sort of moral attitudes that apply to a real person, along w ith the even more

Animacy

73

provocative notion that dealing w ith simulated people w ho can be abused (deleted or deactivated, for instance) will lead to similar callous attitudes towards real people. N ass demonstrated that people interacting w ith computers are prone to treat computers as social actors, w hen interaction is framed appropriately ( N ass, Steuer et al. 1993). That is, if the interaction is framed as a conversation, users w ill apply the usual social rules of conversation to th e i ntera cti o n (i . e . , pra isi ng oth ers is c o nsi d ere d m ore p o l ite th a n pra isi ng o n ese lf). T h e subjects of the experiments applied these rules even though they believed that such rules w ere not properly applied to computers. This research suggests that people can be induced to take a n a n imate v i e w (i n G offma n s terms, to a p p l y a so c i a l frame w ork) b y c erta i n sp e c ifi c c u es, such as voice output. This cueing process seems to operate almost beneath conscious control, much as the motional cues used by M ichotte to induce perceptions of animacy. M any interfaces are not as explicitly anthropomorphic as those above, but incorporate a fe w cues that induce a mild degree of animism. The Logo language, for example, is designed to use natural-language terms in a w ay that encourages a form of interface anthropomorphism. C ommands, syntax, and error messages are carefully crafted so that they resemble natural language communication, casting the Logo interpreter, procedures, or turtle as communicating age n ts. F or i nst a n c e , i f a user gi v es Logo a n u nre c ogn i z e d c o m m a n d (sa y S Q U A RE), i t resp o n ds w i t h I D O N T K N O W H O W T O S Q U A RE , ra t h er t h a n so m e t h i ng o n t h e ord er o f U ndefined procedure: S Q U ARE. The student can then instruct Logo by saying: TO SQUARE REPEAT 4 [FD 70 RT 90] END SQUARE The interesting detail here is the syntax for procedure definition makes the definition resemble instruction in natural language: To [make a] square, do such-and-such... . By putting the user in the position of addressing the computer (or the turtle) in conversation, the system promotes the use of animate thinking. This syntactical design allo ws Logo teachers to employ t h e m e t a p h or o f t e a c h i ng t h e c o m p u t er or t e a c h i ng t h e t urt l e t o p erf orm pro c e d ures (Solomon 1986). C onsider the different shadings of meaning present in the follo w ing different w ays of expressing a textual error message: 1 2 3 4 M issing argument to procedure square. Procedure s quare requires more arguments. Procedure s quare needs more arguments. Procedure s quare w ants more arguments.

O f these, message 1 is the most formal, and the least animate. It is not even a sentence, just a declaration of a condition. M essage 2 casts the procedure as the subject of a sentence, w hich is a large step in the direction of animacy. M essages 3 and 4 are of the same form as 2, but alter the verb so as to imply increasingly human attributes to the procedure. A ll these variants and more occur in various places in the discourse of computer science and in the discourse-like interactions bet w een programmers and their environments. M ost professional programming environments use messages that are like message 1 or 2, w hile those like message 3 are found in 74 Animacy

some Logo environments in keeping w ith the languages use of animate and natural-language c o nstru cts (se e b e l o w). Stateme nts l i k e message 4 are rare l y use d as error messages, b ut are common in the informal discourse of programmers. C o nsi d er a lso t h e m essages of t h e f orm I d o n t k n o w h o w t o square , i ss u e d b y s o m e Logo environments to indicate an undefined procedure. The use of the first person makes these more explicitly anthropomorphic than the earlier group. But since there is no procedure, the I m ust refer to th e c o m p uter as a w h o l e , or th e i nterpreter, rath er th a n a sp e c ifi c p art. T h ese presentational subtleties are indicative of subtle modulations of animism in the Logo environment: the interpreter/turtle is fairly heavily animate, to the point w here it can refer to itself in the f irst p erso n , w h ere as pro c e d ures are l ess so: t h e y h a v e n e e ds , b u t d o n o t prese n t t h e mselves as agents, instead letting the interpreter speak for them. In recent years the term agent has become overused in the commercial soft w are w orld a l m ost to th e p o i nt of m e a n i ngl essn ess. Sti l l , so m e c ore c o m m o n a lti es a p p e ar a m o ng m ost pro d u cts a n d syste ms to ute d as age nts. O n e of th ese m e a n i ngs is a pro c ess th at ru ns i n th e background, autonomously, w ithout being directly invoked by a user action. Even the simplest progra ms of th is ty p e , su c h as c a l e n d ar a n d a l arm progra ms, h a v e b e e n d ign ifi e d as age nts. Less trivial applications include programs that try to learn and automate routine user actions (Ko z ierok 1993) (C harles River A nalytics 1994). This usage seems to derive from the overw helming success of the direct manipulation interaction paradigm. Because of the current dominance of this model of computer use, any user application that operates outside of the direct manipulation mode, even something as simple as an alarm clock, becomes an agent if only by contrast. A nother popular type of agent is the migrating program, such as Kno w bots that roam the netw ork looking for information that meets preset criteria (Etz ioni and W eld 1994). Agents of this sort can transport themselves over a net w ork to remote locations w here they w ill perform t asks f or t h e ir user. Sp e c i a l l a ngu ages, su c h as T e l escri p t ( G e n era l M agi c 1 9 9 5) are u n d er development to support the development and interchange of these agents. It is not clear to me w hy a program running on a remote computer is any more agent-like than one running on a local computer. The animism apparently arises from the w ays in w hich these programs are intended to be used. Remote execution might contribute to a greater feeling of autonomy, and agent programs can migrate from machine to machine, like a w andering animal, and reproduce b y c o p y i ng t h e mse l v es. T h e d e v e l o p m e n t o f c o m p u t er n e t w orks h as gi v e n rise t o sp a t i a l metaphors (like the overused cyberspace ) w hich in turn seems to encourage the use of animate metaphors for the entities that are to populate the ne w space. Telescript in particular features places , w hich are similar to processes, as one of its main object types.

3.3.5

Animate Metaphors in Artificial Intelligence

The task of Artificial Intelligence is to derive computational models of human thought, a process that is metaphorical in nature but maps in the opposite direction from the one w e have been considering here, that is, the use of animate metaphors for computation. The t w o w ays of kno w ing are intimately related, of course: metaphorical mappings of this broad sort tend to be Animacy 75

bidirectional, so that models of the mind and of the computer are necessarily co-constructed in each others image. I w ill not directly address the issues raised by computational metaphors for m i n d , a to p i c a d dresse d w i d e l y e lse w h ere (se e ( A gre 1 9 9 6) for a v i e w th at e m p h asi z es th e specific role of metaphor). H o w ever, mental or animistic metaphors for computation are just as much a part of AI as are computational metaphors for mind. From this standpoint, AI is less a w ay of doing psychology and more an engineering practice that relies on the inspiration of human thought for design principles and language. In other w ords, it makes explicit the animism that has been implicit in other approaches to computation. For example, here is a fairly typical description of the operation of an AI program, selected at random from a textbook:
W hen F IXIT [a program] reexamines a relation, it looks for a w ay to explain that relation using all but one of the precedents... [the exception] is omitted so that FI X I T can explore the hypothesis that it provided an incorrect explanation... (W inston 1992, p390) [emphasis added].

The italici z ed w ords above indicate verbs that put the program in the position of an animate actor. Such talk is probably necessary, in that it is the most compact and meaningful w ay to communicate an understanding of the program to the reader. AI has al w ays pushed the frontiers of complexity in programming and thus has generated many ne w metaphors for computational activity, metaphors w hich are not necessarily linked to the founding metaphor of computation as thought. A n example of this w ould be the blackboard model of problem solving (Reddy, Erman et al. 1973), in w hich a blackboard metaphorically re prese nts a scratc h m e m ory a n d c o m m u n i c ati o ns m e d i u m th at c a n b e sh are d b y m u lti p l e computational processes. T h e w i l l i ngn ess o f A I t o fre e l y l e a p b e t w e e n c o m p u t a t i o n a l a n d a n i m a t e l a ngu age h as proved both fruitful and dangerous. The fruitfulness results from the richness of animate language for describing processes, and the inadequacy of more formal language. The danger resu lts fro m th e te n d e n c y to ta k e o n e s o w n m eta p h ori c a l l a ngu age to o l itera l l y . ( M c D erm ott 1 9 8 7) is a w e l l-k n o w n d i atri b e aga i nst th e pra cti c e of gi v i ng progra ms a n i m isti c n a m es l i k e U N D ERST A N D rather than more restrained, formalistic names based on the underlying algorithm. Such naming practices, ho w ever, are a constituent part of the practice of AI. C onstant critical self-evaluation is the only w ay to ensure that the metaphors are used and not abused. T h e su b f i e l d o f d istri b u t e d art i f i c i a l i n t e l l ige n c e (B o n d a n d G asser 1 9 8 8), i n w h i c h A I s y s t e m s a r e s p l i t i n t o c o n c u rr e n t c o m m u n i c a t i n g p a r t s , m a k e s m o r e e x p l i c i t u s e o f anthropomorphic metaphors to represent its parts. Because communication often dominates the activity of such systems, metaphors of communication and social interaction predominate. T h e m eta p h ors e m p l o y e d i n c l u d e n egoti ati o n ( D a v is a n d Sm ith 1 9 8 3), m ark et tra nsa cti o ns (M alone, Fikes et al. 1988), and corporations or scientific communities (Kornfeld and H e w itt 1981). A particularly important thread of w ork in this field begins w ith H e w itts w ork on A ctors, a model of concurrent computation based on message passing ( H e w itt 1976) (Agha 1986). The A c t or m o d e l is a c o m p u t a t i o n a l t h e ory , i n esse n c e a m o d e l o f c o n c urre n t o b j e c t ori e n t e d progra m m i ng, b u t t h e w ork o n A c t ors h as i n c l u d e d a go o d d e a l o f w ork o n h igh er-l e v e l protocols and on w ays of organi z ing communication bet w een more complex actors. This has l e d to a n i nterest i n o p e n syste ms ( H e w itt 1 9 8 6), a n a p pro a c h to th i n k i ng a b o ut 76 Animacy

c o m p u t a t i o n a l s y st e m s t h a t a c k n o w l e d g e s t h e i r c o n t i n u a l i n t e r a c t i o n w i t h a n e x t e r n a l environment. M inskys Society of M ind represents perhaps the most figurative use of anthropomorphic language in AI, perhaps out of necessity as it is a semi-technical book written in largely nontechnical language. By using anthropomorphic metaphors to talk about parts of minds, M insky risks being accused of resorting to homunculi, and indeed has been ( W inograd 1991). D ennett has a lucid defense of homuncular theories of the mind:
It all looks too easy, the skeptics think. W herever there is a task, posit a gang of task-si z ed agents to perform it a theoretical move w ith all the virtues of theft over honest toil, to adapt a famous put-down of Bertrand Russells. H omunculi demons, agents are the coin of the realm in Artificial Intelligence, and computer science more generally. A nyone w hose skeptical back is arched at the first mention of homunculi simply doesnt understand ho w neutral the concept can be, and ho w w idely applicable. Positing a gang of homunculi w ould indeed be just as empty a gesture as the skeptic imagines, if it w ere not for the fact that in homunculus theories, the serious content is in the claims about ho w the posited homunculi interact, develop, form coalitions or hierarchies, and so forth (D ennett 1991, p261).

3.3.6

Conclusion: Computation Relies on Animate Metaphors

W e h a v e se e n th at a n i m ate m eta p h ors a n d usages p l a y a n u m b er of ro l es i n c o m p uti ng: they appear in the discourse of computation as foundational metaphors, in pedagogy as teachi ng d e v i c es, a n d are t a k e n w i t h v ari o us d egre es o f l i t era l ism i n i n t erf a c e d esign a n d A I. Fundamentally, computers are devices that act , and thus w e are prone to see them in animate terms. But in most cases the animism attributed to the computer is of a limited kind, the rote instruction-follo w er kind of animism. In some sense, this is proper and unexceptionalafter all, the computer is a rote i nstru cti o n fo l l o w er, at th e l e v e l of its i n n er w ork i ngs. Stu d e nts m ust learn to give up their animism and look at the computer as it really is , that is, under the mechanical vie w point, as a device w ithout goals or feelings, if they are to understand its operations in detail. But w hat if our goal is not to teach ho w machines w ork, but particular styles of thought? If our interest is in exploring programming as a means of controlling action and of building animate systems, the fact that the language of computation provides only a narro w concept of animacy is unfortunate. W ith that in mind, the next section looks at the idea of agents as the basis for programming languages that can support a richer notion of animacy.

3.4

Agent-Based Programming Paradigms

This section develops a theory of agent-based programming, that is, a model of programming strongly based on animate metaphors. Agent-based programming begins w ith the traditi o n a l a nthro p o m orp h i c m a p p i ng u n d erl y i ng th e i d e a of c o m p utati o n a n d c h a nges it i n t w o w ays. First, it changes the nature of the mapping so that instead of presenting the computer as a si ngl e a n t hro p o m orp h i c e n t i t y , i t is i nst e a d se e n as a so c i e t y o f i n t era c t i ng a u t o n o m o us Animacy 77

agents. Second, it extends the mapping bet w een the anthropomorphic representation and the underlying computational reality to include ne w characteristics, such as goals and emotions based on the state of goals. U sing multiple applications of the anthropomorphic metaphor in the description of a program is not a particularly ne w idea. It is present, in varying degrees of explicitness, in the littleperson model, in object-oriented programming, in the A ctor model of computation, and in the Society of M ind. H o w ever, in these systems, the metaphor has for the most part remained in the background, used only for teaching purposes or to illustrate a set of concepts that quickly become detached from their metaphorical roots. The animate parts in such systems are for the most part seen as rote instruction follo w ers. In age n t-b ase d progra m m i ng, t h e a n i m a t e m e t a p h or is t a k e n m ore seri o usl y . A nthropomorphic characteristics are deliberately brought forw ard into the language and interface, and the user is encouraged to think of agent activity and interaction in those terms. M ore imp orta ntl y , age nt-b ase d programmi ng se e ks to pro v i d e a ri c h er form of a nthro p omorp h ism th a n e arl i er mo d e ls. In c o ntrast to th e rote-i nstru cti o n-fo l l o w er v ersi o n of a n ima c y fo u n d i n most of the standard models of computation, the animacy of agent-based systems attempts to emphasi z e the characteristics of animacy w e have found to be the most important: autonomy, purposefulness, and reactivity. W e w ill see that the single most important technique for reali z ing this concept of agents is to give them explicit goalsthat is, concrete and accessible representations of w hat it is they are supposed to accomplish. G oals can help crystalli z e the anthropomorphic metaphor: an agent is not just any sort of person, its a person w ith a job to do. G oals can support reactivity (agents react to events that affect their goal) and support detection of conflicts w hen one agent interferes w ith anothers goal.

3.4.1

Principles of Agent-Based Programming

In the loosest sense of the term, an agent-based system is simply one w hose functionality is distributed among active functional modules. If a module can be seen to be taking an action to a c h i e v e a p urp ose , it p arta k es of age nth o o d . B y th is criteri o n , e v e n th e m ost ord i n ary programs written in standard procedural languages may be seen as agent-based: agents are procedures, w hile the communications betw een them are procedure calls. So this definition does not capture anything very distinctive, although it does allo w us to see that the roots of the agent metaphor are to be found in standard programming practice. H o w can w e design agents that are more likely to be seen in animate terms? W e have identified three characteristics in particular that contribute to the feeling of animacy: purposefulness, autonomy, and reactivity. These characteristics do not have simple technical definitions, and are deeply intertw ined w ith one another. The follo w ing sections explore ho w these characteristics can be reali z ed in concrete computational terms. O ther criteria must be taken into consideration w hen designing an agent language. W e w ould like our agent system to be at least as po werful and usable as more traditional languages. This means that w e also need to consider tradi-

78

Animacy

tional language design issues such as understandability, expressiveness, modularity, and composability. Agent-based programming, by its nature, emphasi z es action-taking rather than computation in the narro w sense. Because of this, it is crucial that agents be embedded in some kind of environment in w hich they can act on other active or passive objects. The environment, then, w ill be just as important as the language in determining the nature of agent-based programming, since it determines the kinds of action and interaction that can take place. C hapter 4 treats these issues in detail; for no w , w e should just keep in mind that agents are involved in interactions with a complex world.

3.4.1.1

Purpose, Goals, and Conflict

W hen we talk about a goal, we mix a thousand meanings in one word. Marvin Minsky, S ociety of Mind

In a complex soft w are system, every component is there to achieve some goal of the designer. This goal may be evident to an expert familiar w ith the global w orkings of the system and the relationships of the parts, but may not be at all evident to a novice attempting to understand the system from scratch. In fact, even experts often have trouble understanding the purpose of others code, and occasionally even their o w n. A ge nt-b ase d progra m m i ng c a n m a k e th ese u n d erl y i ng p urp oses e x p l i c it, b y i n c l u d i ng a computational representation of the state of affairs the agent is supposed to bring about. Agents allo w procedural programs to be associated w ith declarative information about w hat they do. In th e sa m e w a y th at o b j e cts i n a d y n a m i c l a ngu age l i k e Lisp c a n c arry aro u n d th e ir ty p e w ith them, agents can carry around their goals. Explicit goals serve a number of different purposes in an agent system:

C ontrol : The most basic use of goals is simply to control and structure activity by triggering procedures at appropriate times. A goal tells an agent w hen to runthat is, w hen its goal is unsatisfied. Verification : G oals allo w agents to monitor the success or failure of their actionssuccessful actions make the goal become satisfied. This can make debugging easier, since parts of programs that fail to achieve their stated purpose are explicitly revealed. The fact that agents can have an idea of success and failure also provides a w ay to deal w ith unreliable problem-solving techniques. Agents may create several subagents to help achieve its goal, each subagent having the same goal as its superior, but using different methods of achieving it. Because the agents can tell w hether or not they have succeeded, the superior agent can use this kno w ledge to dispatch among its subagents. Conflict detection : If an agent achieves its goal, it can continue to monitor that goal and detect if some other agent causes the goal to no longer hold. This is one w ay to detect inter-agent conflict. C onflict situations are quite common in complex systems, and are a common source of bugs. The presence of explicit goals permits an agent to detect situations in w hich another agent interferes w ith its goal, and makes it easier to convey to the user the nature of the problem.
Animacy 79

O rganization : Agent-based programming can be vie w ed as a particular w ay of organi z ing program fragments, by analogy w ith object-oriented programming. Just as O O P organi z es proc e d ures aro u n d t h e o b j e c ts t h a t i t m a n i p u l a t es, i n age n t-b ase d syst e ms pro c e d ures c a n b e vie w ed as organi z ed around the goals they are meant to achieve. Each of these forms of modularity provides a degree of encapsulation or black-boxing, that is, a separation bet w een the external interfaces of objects and their internal implementations. In O O P, this means that an object can send another object a message w ithout having to kno w about the internal structure of the receiving object or the methods that process the message. The analogous property for agentbased systems is that an agent can assert a goal to be satisfied w ithout having to w orry about the details of the other agents that w ill be recruited to satisfy that goal Visualization: Explicit goals can also make programs more comprehensible to an observer w h o is re a d i ng th e progra m or w atc h i ng it e x e c ute . T h e go a ls serv e as a n n otati o ns or c o mments that explain in a declarative style w hat a procedure is trying to do. But unlike textual comments, goals are in a machine-usable form and can thus be used for a variety of interface tasks.
G oals thus form the conceptual and computational basis for giving agents explicit representations of their purpose, w hich also contributes to the reali z ation of the other t w o major qualities of animacy w e seek: autonomy and reactivity.

3.4.1.2

Autonomy

In the standard procedural model of programming, programs run only w hen they are explicitly invoked by an outside entity, such as a user or another program. Agents, by contrast, should be able to invoke themselves, w ithout the need for external invocation. That is, they should be autonomous in the sense w e have been using the w ord in this chaptercapable of initiating action, or being seen as such. O f course, since an agent is also a constructed mechanism, one w hich the programmer builds and understands using a more mechanical, causal point of vie w , this apparent autonomy may only be skin-deep. N o action really happens all by itself. So agents w ill al w ays have to be capable of being seen in at least tw o w ays: as autonomous action takers and as mechanical responders to outside conditions. The simplest w ay to reali z e agent autonomy is to make each agent into a separate process, and let it run in a loop concurrently w ith all other agents (and other activity, such as user actions). C oncurrency in some form is a minimal requirement for agent autonomy. But concurrency by itself is a bare-bones approach to constructing agents. It provides a necessary platform to su p p ort a uto n o m y , b ut n o stru cture for h a n d l i ng c o nfl i cts or e x p l i c itl y d e a l i ng w ith goals. A so m e w h a t d i ff ere n t a p pro a c h is t o a l l o w age n ts t o b e triggere d b y sp e c i f i c e v e n ts or states. T h at is, age nts sp e c ify so m e h o w w h at states or e v e nts th e y are i ntereste d i n , a n d are activated w henever these occur, w ithout having to continuously check for them. This has the same effect as the concurrent approach, but it can be more efficient and the metaphor is different. In some sense triggering is causal or non-autonomous, because the agent is being activated by an outside force, but if w e use the monitoring metaphor the agent may still be seen as the source of action. 80 Animacy

3.4.1.3

Reactivity

Reactivity means that agents should be responsive to the w orld. But w hat does this mean? For one thing, it implies that the agent is operating in a changing w orldan assumption at odds w ith the standard model of procedural programming, w here the environment is generally static. It also implies that the agent has some readily available means of sensing the state of the w orld. M ore importantly, it means that the image of the agent is different from the sequential executor that the rote-instruction-follo w er model suggests. W hile agent-based systems should certainly be capable of executing sequences of operations, it should also be easy for them to respond to changes in the w orld at any time. Re a cti v ity is re l ate d to th e pro p erti es of a uto n o m y a n d p urp osefu l n ess. A n a uto n o m o us entity initiates actionbut to seem purposeful must have some re aso n f or t a k i ng a ct i o n . F or simple systems, the reason is usually going to be a change in the state of the w orld, that is, the entity is reacting to something in its environment.

3.4.2

Computational Realizations of Agents

This section examines some of the w ays in w hich the term agent has been used to refer to elements of larger computational systems, and analy z es their strengths and deficiencies compared to the criteria outlined above.

3.4.2.1

Agent as Process

The simplest reali z ation of computational agents is as concurrent processes that can execute simple loops. This approach is used by M ultiLogo (Resnick 1988). In M ultiLogo, agents are pro c esses t h a t c a n e x e c u t e a n y pro c e d ure . A ge n ts are t h us ge n era l p urp ose e n t i t i es ra t h er than being speciali z ed for particular functions. Each agent has a graphic turtle of its o w n, so turtles are controlled by a single agent, but the agents can communicate freely w ith the sensors a n d e ff e c t ors o f LE G O cre a t ures, p erm i tt i ng e x p eri m e n ts i n w h i c h m u l t i p l e age n ts c a n b e controlling a single creature. Agents communicate by sending messages to one another. Each agent has an input queue for messages and has some control over ho w messages are inserted into the queue of recipients. M ultiLogo agents, being separate processes, are certainly autonomous. The language provides no special constructs for supporting goals or reactivity, although it is a fairly simple matter to set up procedures w ith conditionals that provide these kinds of features. There are no builtin facilities for handling conflict: if tw o agents try and control the same LE G O motor, contention w ill arise. Agents, ho w ever, are protected from conflicting commands by handling them through a queue, which effectively serializes them. O n e m a j or d i ff ere n c e b e t w e e n M u l t iLogo s a p pro a c h a n d t h e age n t-b ase d syst e ms o f Live W orld is the sharp distinction in the former bet w een agents and procedures. This follo ws st a n d ard c o m p u t i ng pra c t i c e , b u t l e d t o so m e c o n f usi o n a m o ng st u d e n ts l e arn i ng t o use M ultiLogo, w ho had to learn to perform t w o separate types of problem decomposition. In effe ct, age nts (pro c esses) are a se p arate fa c i l ity for c o n c urre nt o p erati o n th at is a ugm e nti ng a

Animacy

81

standard procedural language (Logo). Perhaps the confusion arises because both concepts partake of animacy in different w ays, and get conflated in the students minds.

3.4.2.2

Agent as Rule

A nother model for agent is a rule or demon. In this model, agents have a condition and an action to be taken w hen the condition is met. A collection of such agents, together w ith a procedure for resolving conflicts, forms a forw ard-chaining rule system, that is, a system that is driven solely by the current state of the w orld rather than by goals. W hile agents may have a p urp ose , th e y d o n ot h a v e e x p l i c it go a ls. T e l e o-re a cti v e progra m m i ng ( N i lsso n 1 9 9 4) is a n e x a m p l e of a form a l ism th at uses sets of ru l es to i m p l e m e nt age nts; for m ore d isc ussi o n se e Section 5.1.3. A lthough the agent-as-process model is more general (since a process can presumably implement a rule using conditionals), the more restrictive format of the agent-as-rule model can simplify conflict resolution and makes possible certain control strategies (such as recency or specificity) and efcient implementations (such as storing rules in a data structure that permits fast triggering (Forgy 1982)). Ru l es, c o nsi d ere d as a progra m m i ng m eta p h or, are q u i ntesse nti a l l y re a cti v e b ut are n ot goal-oriented and are not usually thought of in particularly anthropomorphic or autonomous terms. O ne w ay in w hich rules are anthropomorphi z ed is to think of them as demons th at are triggered by specific events or conditions.

3.4.2.3

Agent as Enhanced Object

Shohams Agent O riented Programming (A O P) formalism (Shoham 1993) is a computational frame w ork explicitly designed as an extension or speciali z ation of object-oriented programming. O b j e c ts b e c o m e age n ts b y re d e f i n i ng b o t h t h e ir i n t ern a l st a t e a n d t h e ir c o m m u n i c a t i o n protocols in intentional terms. W hereas normal objects contain arbitrary values in their slots and communicate w ith messages that are similarly unstructured, A O P agents contain beliefs, commitments, choices, and the like; and communicate w ith each other via a constrained set of speech acts such as inform, request, promise, and decline. The state of an agent is explicitly defined as a mental state . The A O P concept of agent is coarser-grained than that found in Live W orlds agent systems. Each agent has its o w n mentality or belief system as opposed to components of a single mind. There is no real opportunity for conflict in A O P, because each agent is responsible for maintaining consistency among its commitments. If given contradictory information a choice must be made, but there is no built-in mechanism for doing this. O ddly enough, the A O P formalism appears to have no explicit representation of desire or go a ls. N or d o th e l a ngu ages th at i m p l e m e nt A O P pro v i d e pro c esses or oth er c o nstru cts th at support autonomous activity. Agents, despite their mental qualities, are essentially passive like ordinary objects, but communicating at a higher level of abstraction. The agency in A O P is entirely representational , rather than active. The roots of agency are seen as having explicit beliefs and kno w ledge, rather than in being goal-directed or autonomous.

82

Animacy

This makes Shohams concept of agency almost entirely orthogonal to Live W orlds. They are not necessarily incompatible thoughthere is the interesting possibility that it might be possi b l e t o c o m b i n e Sh o h a m s re prese n t a t i o n a l age n c y w i t h t h e p urp osi v e , a u t o n o m o us i d e a agency developed here. This is an area for future research.

3.4.2.4

Agent as Slot and Value-Producer

P l a y gr o u n d ( F e n t o n a n d B e c k 1 9 8 9 ) h a d a r a t h e r i d i o s y n c r a t i c v i e w o f a g e n ts a s a c o m b i n a t i o n o f a sl o t a n d a v a l u e-pro d u c i ng f orm f or t h a t sl o t . A n age n t i n t h is syst e m is something like a spreadsheet cell that is also part of an object. See Section 2.2.3.2 for further discussion of Playground. Playgrounds model of agent seems rather un-agent-like in the context of our discussion, in that it cannot take any action to effect the w orld outside of itself. Functional agents like these can be anthropomorphi z ed to some extent by describing their computation as a pulling of values from other cells in the system to use in its computation of its o w n value. This is opposed to the usual pushing activity of more imperatively-structured languages. This terminology at least puts the agent in an active role, but does not really allo w it to act on the w orld. A Pl a ygro u n d age n t is a u t o n o m o us, i n t h e se nse t h a t i t c o n t i n u o usl y u p d a t es i ts v a l u e w ithout outside intervention, and reactive for the same reason. It has no explicit representation of goa l or purpose. Since there is exactly one agent per sl ot, there is no re al opportunity for conflict to arise.

3.4.2.5

Agent as Behavioral Controller

A w ide variety of systems for controlling the behavior of an intelligent creature employ distri b ute d n et w orks of si m p l e m o d u l es. So m e of th ese refer to th e m o d u l es age nts , b ut it is more common in this realm for the creatures themselves to be called agents. To avoid confusion w e w ill continue to use agent to refer to the internal active parts. These systems arise from a movement w ithin the AI and artificial life fields that focuses on intelligent action rather than the more traditional symbolic problem solving. In part this focus stems from frustrations w ith the state of w ork in traditional paradigms, in part from an interest in modeling animal behavior for its o w n sake, in part from philosophical standpoints about the nature of human intelligence and activity (see section 2.1.4), and in part by a search for alternatives to the dominant planning and reasoning paradigm, w hich can be computationally intractable and has a limited ability to deal with a dynamic world (Chapman and Agre 1986). W h i l e situ ate d a cti o n d o es n ot ru l e o ut re prese ntati o n a n d re aso n i ng, it d e-e m p h asi z es them. Intelligent action is generated first by responsiveness to current conditions in the w orld. Systems that w ork in this w ay tend to be organi z ed around a functional modularity. Rather than the centrali z ed architecture of traditional AI, these systems are divided up into more-or-less independent, modules each of w hich is in charge of a particular behavior. These modules are connected in net w orks so that some control can be exerted, but each module is in charge of managing its o w n connection to the w orld through sensors and effectors.

Animacy

83

A variety of computational constructs are used to implement the internal agents of these situated creatures. I w ill survey a fe w of these systems; for a fuller treatment see (Agre 1995). The subsumption architecture (Brooks 1986) (C onnell 1989) is a design methodology for robot control systems. A subsumption program consists of a number of modules connected in a net w ork, usually arranged in a layered fashion, w ith each layer capable of controlling action independently. H igher-level layers are capable of preempting lo w er-level ones using a scheme b ase d o n f i x e d pri ori t y ga t es t h a t m a k e u p t h e n e t w ork . Ea c h m o d u l e is a n a u t o n o m o us a ugm e n t e d f i n i t e-st a t e m a c h i n e , w h i c h c a n c o m m u n i c a t e w i t h t h e o u tsi d e w orl d t hro ugh se nsors, to oth er mo d u l es thro ugh th e n et w ork , a n d to itse lf thro ugh a sma l l set of registers. M odules typically implement fairly simple behavioral control rules, sometimes augmented w ith st a t e . G o a ls are i m p l i c i t ra t h er t h a n e x p l i c i t , a n d c o n f l i c t b e t w e e n m o d u l es is h a n d l e d b y hard w ired priorities in the connections betw een the modules and the netw ork. T h e A gar syste m is a soft w are k it for m o d e l i ng a n i m a l b e h a v i or (Tra v ers 1 9 8 8), a n d its c o n c e pti o n of c o ntro l is b ase d l o ose l y o n T i n b erge n s eth o l ogi c a l m o d e ls (T i n b erge n 1 9 5 1) (also see section 5.2). In Agar, an animals behavioral control system consists of a net w ork of agents. A n agent is something of a cross bet w een a process and a rule, and has an activation l e v e l a n d a thresh o l d th at d eterm i n es w h e n it c a n ru n . A ge nts i n ge n era l c o n n e ct a se nsory st i m u l us t o a n a ct i o n , w h i c h m a y b e a n e xt ern a l a ct i o n or t h e a ct i v at i o n of a n ot h er age nt. A ge nts affe ct o n e a n oth er b y p assi ng a cti v ati o n i n th is m a n n er, a n d th e usu a l pra cti c e is to arra nge th e m i nto a c o ntro l h i erarc h y so th at h igh er-l e v e l age nts c a n a cti v ate o n es at l o w er levels. There are no explicit goals. C onflict is avoided by hard-w ired inhibitory links bet w een agents that conflict. M aes A ction Selection A lgorithm (M aes 1989) (M aes 1990) is some w hat different from the a b o v e syst e ms. It t o o p osi ts a d i v isi o n o f a c o n tro l syst e m i n t o f u n c t i o n a l m o d u l es, w i t h variable activation levels. H o w ever, the relations betw een them are modeled after the relations of classical STRIPS-like planning operators, so that modules are connected to other modules that re prese nt th e ir pre c o n d iti o ns a n d e x p e cte d resu lts. U n l i k e th e oth er m o d e ls, th is a l l o w s th e activation of the system to respond to changing goals as w ell as to conditions in the w orld. The action selection algorithm is explicitly non-hierarchical so that there are no managers, ho w ever, there is a bottleneck in that only one module can actually act at any one time. The agents of these systems are highly limited, yet can perform complex tasks. As agents in the sense of this chapter, they are some w hat deficient. A ll three systems offer a high degree of reactivity. Agars agents and Brooks behavior modules are semi-autonomous: they run concurrently, and take action on their o w n. M aes competence modules are less so, since only one can act at a time. A ll the architectures implement purposefulness, but only M aes uses an explicit representation of goals.

3.4.3

Agents and Narrative

N arrative deals with the vicissitudes of intention. Jerome Bruner (Bruner 1986)

84

Animacy

The agent metaphor allo ws computational elements to be envisioned using more natural and po w erful conceptual tools than those provided by more formalistic approaches. But thinking about program parts in animate terms is only the first step. O nce that mapping is created, w hat other uses can be made of it? O ne possibility is to explore the traditional methods for expressi ng th e i ntera cti o ns a n d h istori es of h u m a n age nts; th at is, of n arrati v e forms. T h ere w o u l d seem to be great potential in using the form of stories both to create soft w are agents (through programming-by-example or case-based techniques) and to present the activity of such agents to the user. T h i s s e c o n d t e c h n i q u e w a s e x p l o r e d i n p r o t o t y p e f o r m i n t h e N o s e G o b l i n s s y st e m (Tra v ers a n d D a v is 1 9 9 3). T h is pro j e c t i n c l u d e d a n age n t arc h i t e c t ure t h a t w as o n e o f t h e pr e d e c e ss ors o f Li v e W orl d s, a n d a l l o w e d users t o c o nstru c t c o nstra i n t-l i k e age n ts t h a t p erf orm e d t asks i n a gra p h i c d esign d o m a i n . In t h is arc h i t e c t ure , age n ts re l a t e d go a ls a n d methods, and could detect inter-agent conflict. W hen an agent conflict w as detected, N ose G oblins created a story about the conflict and expressed the story to the user using a format that combined a comic-strip/storyboard format w ith c l i ps of a n imate d c arto o n c h ara cters (se e F igure 3 . 1). T h e story b o ard serv e d to prese nt the temporal qualities of the story, w hile the animated characters presented the emotional states of th e a ctors, b ase d o n th e satisfa cti o n state of th e ir go a ls (h a p p y , u n h a p p y , or a ngry if i n a conflict situation). W hen a conflict w as detected, a partial storyboard w as generated w ith the final panel sho w ing the characters in an angry state; it w as then up to the user to resolve the situation. The resolution w as stored in a case library and used to deal w ith future conflicts.

Animacy

85

Figure 3.1: Four panels from a N ose G oblins storyboard. The first two frames illustrate the goals of the two agents involved, while the last two illustrate how one agent clobbers anothers goal and the resultant conflict.

N arrative is a natural form for describing action, particularly action that involves the interaction of multiple actors. If computational objects are going to be understood anthropomorphically, their actions are going to be best understood through narrative forms.

3.5

Conclusion

This chapter has defined and explored a particular mode of thought and its relationship to computation. I imagine that some readers might have found this discussion to be highly irritating. W hy all this attention to such a marginal concept?, I hear them saying. D ont you kno w that anthropomorphism is at best a useful pedagogical device, and not something that really has anything to do w ith ho w computers w ork and are programmed? Assuming any of those readers have actually made it to the end of the chapter, I w ould like to answ er them. In computation, animism has become w hat I have called a transparent metaphor, one that is so much a p art of th e stru cture of th e d isc o urse of th e fi e l d th at w e h a v e forgotte n th at it is th ere . T h is chapter is an attempt to see a metaphor that has become close to invisible, w ith the hope of understanding and extending it. Is there a need for this treatment? I think that there is, because of the confusion that rages in various segments of the computer w orld over issues that are deeply tied to the issue of just w hat it means to be animate and/or intelligent. The current fad of using the w ord agent for soft w are of all types is one aspect of this unease, and it generates a good deal of confusion. A nother symptom is the recent split in AI bet w een representationalists and the situated action 86 Animacy

approach, reminiscent of the older split bet w een AI and cybernetics. M ature science is supposed to converge on a theory; but instead computational approaches to intelligence and life seem to be diverging, w ith no consensus on the problems to be solved, let alone the answ ers. This chapter, then, is an attempt to address these problems at a conceptual level, by trying to understand ho w the languages of computation are related to the language used to describe life and action. W e found that w hile animate metaphors are pervasive in computation, being in some sense a founding metaphor for the field, the metaphors offer up only a limited form of animacy that leaves out many of the key properties associated w ith aliveness. The rote-instruction-follo w er image affects and infects our thinking and limits our imagination about w hat computers can do. Agent-based programming systems set out to bring a fuller form of animacy to the description of computational processes. By picturing the components of programs as animate objects that can have explicit goals, a degree of autonomy, and the ability to dynamically react to their surroundings, languages can be designed that are more suitable for creating animate w orlds. The follo w ing chapter illustrates some agent systems based on these ideas and explores w hat they can do.

Animacy

87

Chapter 4

LiveWorld
If the computer is a universal control system, lets give kids universes to control. Theodore H . N elson ( N elson 1974 )

The substrate of Live W orld, upon w hich the agent systems w ere constructed, constitutes a ge n era l p urp ose c o m p u t a t i o n a l m e d i u m , d esign e d f or l i v e l i n ess a n d e ase o f c o nstru c t i o n . Li v e W orl d c o nsists of a tightl y i ntegrate d o b j e ct syste m a n d i nterfa c e , w h i c h p erm its re a d y manipulation of the various components needed to make animate w orlds. In addition to making the animated graphic objects or actors easy to create, manipulate, and control, it w as necessary t o m a k e t h e i nt ern a l p arts a n d o p erat i o ns of t h e o b j e cts a n d t h e progra ms t h at dro v e t h e m v isi b l e a n d m a n i p u l a b l e as w e l l . W h i l e Li v e W orl d itse lf is n ot b ase d o n age nts or a n i m at e meta p h ors, it pro v i d es a w orl d i n w h i c h l a ngu ages a n d programs b ase d o n th ose meta p h ors can be developed. N ote: this chapter goes into a good deal of detail about the inner w orkings of Live W orld. Re a d ers w h o are i ntereste d o n l y i n th e age nt syste ms m a y w ish to sk i p o v er a l l b ut th e first s e c t i o n o f t h i s c h a p t e r . T h e f i rs t s e c t i o n i s a n o v e r v i e w w h i c h i n t r o d u c e s e n o u g h o f Live W orlds terminology to make the next chapter understandable.

4.1

Overview of LiveWorld

Live W orlds virtual space consists of a hierarchical structure of objects called b o x e s (s e e f igure 1 . 1). B o x es c a n b e cre a t e d a n d m a n i p u l a t e d w i t h t h e m o use; t h e y are c o n cre t e a n d tangible graphic representations of underlying computational objects. The intent of the interface is to make the entire computational state of the virtual w orld available to the user in the form of b o x es. Boxes are named and can have values. If a box color is inside of a box turtle, then color is s o m e t i m e s r e f e rr e d t o a s a n annotation o f turtle. A n n o t a t i o n s c a n f u n c t i o n l i k e s l o ts o f standard object-oriented languages, so in the above example the value of the color box w ill be i nterprete d as a sl ot of th e turtl e . B o x es are so m eti m es referre d to as frames, reflecting their underlying representation. Some boxes represent graphic objects; these are called a ctors. A ctor b o x es are c o nta i n e d inside theaters, w hich present them in t w o separate vie ws: a stage vie w w hich sho ws them in graphical form, and a cast v i e w w h i c h sh o ws th em i n th e form of b o x es. T h ese t w o v i e ws are interconstrained so that changes in one are reflected in the other. Boxes can inherit properties from a prototy p e . N e w b o x es are o ft e n m a d e b y cloning a n existing box, w hich just means making a ne w box w ith the original as prototype. C loned boxes (also called spinoffs) i n h erit v ari o us pro p erti es fro m th e ir prototy p e , su c h as v a l u es for sl ots. Inheritance is dynamic, meaning that changes in the prototype may affect the spinoff. The initial

Live W orld environment consists of speciali z ed objects including theaters, actors, slots, sensors; users usually begin the programming process by cloning and combining these into a w orld of their o w n. A fter an object is cloned the ne w object may be customi z ed by modifying any of its properties to be different from its prototype. Live W orld is programmed using an extension of C ommon Lisp. Since boxes are named and are i n a h i erarc h y , th e y c a n b e referre d to b y p aths. T h ere are t w o forms of b o x p aths. T h e a bso l u t e f orm gi v es t h e n a m e o f a b o x st art i ng fro m t h e t o p , or ro o t , o f t h e h i erarc h y . F or instance, the path #/theater-1/cast/turtle/color n a m es t h e color f r a m e o f a turtle i nsi d e t h e cast o f theater-1. Relative boxpaths allo w references to be made relative to a local box; these are explained in section 4.5.4.2. A m essage p assi ng l a ngu age is d e f i n e d o n fra m es: T h e ask p r i m i t i v e i s u s e d t o s e n d a message to a box. For instance, (ask #/theater-1/cast/turtle :forward 10) w i l l c a use th e n a m e d turtl e to m o v e for w ard 1 0 u n its. B o x es sp e c ify th e ir resp o nses to messages by means of methods, w hich are themselves boxes containing a program. Specialized boxes called animas offer process-like capabilities. A n anima repeatedly sends a :step message to its containing box, concurrently w ith other animas and user-initiated actions. A nimas can be used as the basis for building agents.

4.2
4.2.1

Design
General Goals

Li v e W orl d w as d esign e d to su p p ort c erta i n b asi c q u a l iti es of i ntera cti o n: a l l p arts of th e syste m sh o u l d b e c o n crete l y re prese nte d a n d a c c essi b l e , th e syste m sh o u l d fe e l re a cti v e , it should permit exploratory or improvisatory programming, and there should be a clear learning path that leads a user from simple to more complex modes of use.

4.2.2

A World of Lively Objects

Creating animate systems requires the creation and organi z ation of many different kinds of p arts, i n c l u d i ng w orl ds, a c t ors (gra p h i c o b j e c ts, a lso c a l l e d cre a t ures), age n ts (b e h a v i or ge n era t ors). Ea c h o f t h ese p arts i n t urn c a n h a v e p arts o f i ts o w n or asp e c ts a f f e c t i ng i ts appearance and function. The number of objects can be quite overw helming unless deliberate steps are taken to present the complexity in a form that a novice can comprehend. The approach used by Live W orld is in the tradition of Smalltalk and Boxer, in that it tries to make computational objects real for the user. O bjects should be concreteth at is, th e y sh o u l d 90 Live W orld

appear to have a solid existence, metaphorically rooted in the properties of physical objects, and tangiblethey should be accessible to the senses and actions of the user. The techniques used to achieve these goals include a simple yet po w erful object-oriented programming system w ith prototype-based inheritance (arguably more concrete in its operation than class-based inheritance); and the integration of the object system w ith an equally simpley e t - p o w e r f u l d i r e c t m a n i p u l a t i o n i n t e r f a c e (s e e F i g u r e 4 . 1 ) . T o g e t h e r o b j e c t - o r i e n t e d programming ( O O P) and direct manipulation serve to make computational objects appear as c o n cre t e a n d t a ngi b l e . T h ese pro p ert i es a l l o w users t o m a k e use o f t h e ir v isu a l a n d m o t or abilities to interact with computational objects. Li v e W orl d is d esign e d t o su p p ort age n t-b ase d progra m m i ng, or progra m m i ng w i t h a n animate flavor. It is not itself constructed from agents11 , but is intended to support the creation of agents, both computationally and from a design standpoint. O bject-oriented programming is the existing programming paradigm best capable of supporting animate thinking (see 3.3.2), so Live W orld starts from that basis. O bjects are animate in the sense of being capable of acting, but only in response to messages from outside themselves. This is a po w erful paradigm, fully capable of representing a w ide range of computational activity, but its metaphorical implications may be limiting. O O P presents a picture of objects as passive, taking action only in response to a st i m u l us fro m t h e o u tsi d e . F or Li v e W orl d , w e w a n t o b j e c ts t o se e m c a p a b l e o f a c t i ng as animate creatures. A s set o ut i n C h a pter 3 , th e thre e sa l i e nt c h ara cteristi cs of a n i m a c y are p urp osefu l n ess, a u t o n o m y , a n d r e a c t i v i t y . T h e a g e n t s y st e m s d e s c r i b e d i n C h a p t e r 5 a r e m o r e d i r e c t l y c o n c ern e d w i t h t h ese issu es, b u t t h e u n d erl y i ng l e v e l is c a p a b l e o f pro v i d i ng so m e b asi c su p p ort f or t h e l a tt er t w o . A u t o n o m y is su p p ort e d b y sp e c i a l o b j e c ts c a l l e d animas , w h i c h p r o v i d e a f a c i l i t y s i m i l a r t o p r o c e ss e s , b u t i n a s t y l e d e s i g n e d t o s u p p o r t a g e n t - b a s e d programming. A nimas provide a po w er source w hich can be combined w ith other objects to produce independent behavior, running independently from user activity and from each other. They form the underlying basis of some of the simpler agent systems detailed in section 5.1. Re a cti v ity is su p p orte d b y s e n s o rs that allo w objects to detect other objects or conditions in th e ir e n v iro n m e nt, a n d b y th e m ore ge n era l c o m p ute d-sl ot fa c i l ity th at a l l o w s v a l u es to b e automatically updated from changing environments.

4.2.3

Spatial Metaphor and Direct Manipulation

To make computational objects real for the novice, w ho has not yet developed the skills to mentally visuali z e them, objects can be given some of the properties of physical objects, such as appearance, location, and responsiveness to action. In other w ords, they should be brought out to the user by means of a direct manipulation interface (Shneiderman 1983). The interface should disappear as a separate entity; instead the user should be able to think of computational objects as identical with their graphic representation (H utchins, H ollan et al. 1986, p97).

11Section 6.3.4 dicusses the prospect of building a system that is entirely based on agents.

Live W orld

91

Live W orld presents itself as a collection of recursively nested graphic objects, arrayed in sp a c e a n d m a n i p u l a b l e b y th e user. T h is i d e a is l arge l y b orro w e d fro m B o x er (d iSessa a n d A belson 1986), follo w ing the design principle referred to as naive realism . Live W orld retains Boxers basic metaphor of recursively nested boxes, but differs from Boxer in the w ay it treats its b asi c o b j e ct. In Bo x er, b o x es are u n d ersto o d i n refere n c e to a te xtu a l meta p h or. A Bo x er box is like a character in a text string that can have internal structure, w hich w ill be other lines o f t e x t t h a t a lso m a y i n c l u d e b o x es. B o x es h a v e n o f i x e d sp a t i a l p osi t i o n , b u t are f i x e d i n re l ati o nsh i p to th e te xt l i n e th at c o nta i ns th e m . T h ere are n o c l asses of b o x es (e x c e pt a fe w built-in system types) and no inheritance. In contrast to Boxer, Live W orld boxes are to be understood as graphic objects that may be moved w ith the mouse. W hile Boxers interface is rooted in w ord processing (specifically in the Emacs text editor (Stallman 1981) from w hich Boxer derives its command set), Live W orlds is ro o t e d i n o b j e c t-ori e n t e d dra w i ng progra ms. B o t h syst e ms e x t e n d t h e ir ro o t m e t a p h or b y allowing for recursive containment. Li ve W orl ds obje ct system supp orts the idea that a user should a l w ays be a ble to a ccess internal data, but shouldnt have to see detail that is irrelevant to her needs. C omplex objects can be treated atomically as necessary, but opened up so that their w orkings can be vie w ed and their parameters can be changed.

4.2.4

Prototype-based Object-oriented Programming

O b j e c t-ori e n t e d progra m m i ng ( O O P) m a k es progra ms m ore c o n cre t e b y gi v i ng t h e m a feeling of locality. U nder O O P, each piece of a program is closely associated w ith a particular o b j e c t or c l ass o f o b j e c ts. Ra t h er t h a n a n a bstra c t se t o f i nstru c t i o ns, a ro u t i n e is n o w a method , b e l o n g i n g t o a p a r t i c u l a r o b j e c t a n d i n t e n d e d t o h a n d l e a s p e c i f i c c l a s s o f communication events. It has a location, and in a sense its function is made more concrete by its association w ith a class of objects. Prototype-based languages (Lieberman 1986) ( U ngar and Smith 1987) are an alternative to th e c l ass-b ase d o b j e ct sc h e m es use d i n m ore tra d iti o n a l O O P l a ngu ages su c h as Sm a l lta l k , C L O S, or C + + . Prototy p e-b ase d O O P argu a b l y offers a d d iti o n a l c o n crete n ess b y d isp e nsi ng w i t h c l asses. In a c l ass-b ase d o b j e c t syst e m , e v ery o b j e c t is a n i nst a n c e o f a c l ass, a n d methods are associated w ith a class rather than w ith particular concrete objects. W hile classes are usually represented by objects, these objects are of a different order than normal objects and are sometimes called meta-objects to emphasi z e this distinction. In contrast, a prototypebased system has no distinction bet w een classes and instances or bet w een objects and metaobjects. Instead of defining objects by membership in a class, they are defined as variations on a prototype. A ny object may serve as a prototype for other objects. T h e a d v a nt ages of prot ot y p e-b ase d progra m m i ng are si m p l i c it y , c o n cret e n ess, a n d t h e possibility of a better cognitive match bet w een program construct and the thinking style of the progra m m er. It e l i m i n ates w h o l e c l asses of m eta o b j e cts, a n d si m p l ifi es th e sp e c ifi c ati o n of inherited properties. In a sense it is object creation by example.

92

Live W orld

F or e x a m p l e , t h e pro p ert i es o f e l e p h a n ts m igh t b e d e f i n e d b y a pro t o t y p i c a l e l e p h a n t ( C l y d e) w h o h as c o l or gray a n d m a s s heavy. Pro p ert i es o f C l y d e b e c o m e d e f a u l ts f or t h e sp i n offs, so a l l e l e p h a nts w i l l b e gra y a n d h e a v y u n l ess th e ir d efa u lt is o v erri d d e n , as i n th e case of pink elephants. W ith prototypes, the specification of defaults and exceptions are done in exactly the same w ay, that is, simply by specifying concrete properties of objects. In a class syst e m , o n e w o u l d ge n era l l y h a v e t o use se p ara t e sorts o f st a t e m e n ts t o e x press b o t h a l l members of the class elephant are gray and except for the pink ones. There are some indications that mental representation of categories is structured around prototypes (Lakoff 1987). W hether this translates into any cognitive advantage for prototypeb ase d c o m p uter l a ngu ages is o p e n to q u esti o n . W h at prototy p es d o a c c o m p l ish for p r o gr a m m i n g i s t o s m o o t h o u t t h e d e v e l o p m e n t p r o c e ss , b y e a s i n g t h e tr a n s i t i o n fr o m experimentation to system-building. Live W orlds prototype-based object system is a modified version of Framer ( H aase 1992), a k n o w l e dge re prese ntati o n to o l th at pro v i d es a h i erarc h i c a l stru cture for o b j e cts, prototy p eb ase d i n h erita n c e , a n d a p ersiste nt o b j e ct store . It is b ase d o n a si ngl e stru cture , th e fra m e , w h i c h c a n t a k e t h e p l a c e o f a n u m b er o f c o nstru c ts t h a t are usu a l l y se p ara t e . Fra m er is a re prese n t a t i o n-l a ngu age l a ngu age i n t h e tra d i t i o n o f RLL-1 ( G re i n er 1 9 8 0). In t h is t y p e o f language, slots of a frame are first-class objects (frames) in their o w n right. This ability to put recursive slots-on-slots makes it relatively easy to implement advanced programming constructs that are difficult or impossible to reali z e in conventional object systems, such as facets, demons, dependency net w orks, and histories. For example, any slot-frame can have a demon added to it, w hich w ill be stored on a slot of the slot. Framer w as not designed as an object system for dynamic environments like Live W orld, a n d re q u ire d a f e w m o d i f i c a t i o ns, a d d i t i o ns, a n d sp e e d u ps. I c h ose Fra m er f or t h is t ask because of its hierarchical structure, w hich w as a perfect match for the Boxer-like interface I envisioned for Live W orld, because of its simplicity, because of its prototype-based inheritance scheme, and because the ability to recursively annotate slots made it a very flexible vehicle for e x p eri m e n t a t i o n . Li v e W orl d s gra p h i c re prese n t a t i o n f or t h e fra m es is t h e b o x , w h i c h is described belo w . From the users perspective boxes and frames are identical, and for the most part I w ill use the terms interchangeably.

4.2.5

Improvisational Programming

A programming system for novices ought to support experimentation and improvisation. T h e m o d e l of use sh o u l d n ot assu m e th at th e user h as a fu l l y w ork e d-o ut m o d e l of th e task . Ra t h er, t h e syst e m sh o u l d assu m e t h a t t h e user is e ngage d i n a n a c t i v i t y t h a t c o nsists o f incremental and interleaved design, construction, debugging, and modification. This means that each part of the users cyclical path bet w een idea, execution, and evaluation has to be short and relatively painless.

Live W orld

93

idea browsing; affordances evaluation

kits; libraries; prototypes

execution immediate feedback


Figure 4.1: H ow Live W orld supports improvisational programming.

Improvisational programming relies on the ability to build programs incrementally 12 . T h i s facility is an important part of dynamic programming environments for novices such as Boxer or Smalltalk, since novices need the short feedback cycle that incremental programming can provide. From the standpoint of interface design, incremental programming is akin to non-modal interface design: conventional programming requires constant sw itching bet w een writing and testing, while incremental programming attempts to reduce or eliminate that modal switch. A graphic bro wsing and editing interface contributes to the improvisatory feel of a system b y l a y i ng o u t a l l t h e a v a i l a b l e p arts a n d o p t i o ns f or t h e user, e n c o uragi ng c o m b i n a t i o n , modification, and experimentation. Lisp and Logo generally have n ot included such a facility, but Boxer and Smalltalk have made bro wsing interfaces a prominent part of their design. T h e c o m b i n ati o n of o b j e ct syste m , i n cre m e nta l progra m m i ng, a n d gra p h i c c o nstru cti o n gives the system the feel of a construction kit. A construction kit essentially provides a set of p arts th at are b oth m ore c o m p l e x th a n ra w m ateri a l a n d are d esign e d to fit togeth er. K its support improvisation because they reduce the effort needed to try ne w configurations. Prototype-based object systems are arguably better at supporting improvisation than their class-based equivalents. A class-based system makes it hard to create one-of-a-kind objects, so b u i l d i n g s o m e t h i n g i s a l w a y s a t l e a st a t w o st a g e p r o c e ss (f i rst d e f i n i n g t h e c l a ss , t h e n instantiating an instance). Prototype-based systems eliminate this barrier, freeing users to build concretely w ithout having to first turn their concrete ideas into abstract classes. The immediate feedback of the system closes the gap bet w een execution and evaluation. G raphic displays that provide affordances for action can involve the user in object manipulation and suggest courses of action.

12 Sometimes the ability to build programs incrementally is conflated w ith the distinction bet w een interpreted and compiled languages. W hile the idea of interactive incremental program construction has its roots in interpreted languages, modern programming environments support incremental compilation, so that the benefits of compilation and incremental construction can be combined.

94

Live W orld

4.2.6

Parsimony

A lso borro w ed from Boxer is the idea that a single structure, the box, can be made to serve a multitude of purposes. In most languages, variables, data structures, sets, graphics, classes, buttons, and palettes are very different sorts of things w ith very different interfaces. In Boxer and Live W orld all of these structures are replaced by the box, w hich is flexible enough that it can perform all of their functions. This technique is of great value in reducing the complexity of the interface, since only a single set of manipulation skills needs to be learned.

4.2.7

Metacircularity

As much as possible, the interface of Live W orld is defined in the language itself, giving the user control over its appearance and operations. Framers recursive structure makes it easy to use frames to represent information a b o ut frames, a n d Li v e W orl d ma k es fre q u e nt use of th is capability. For instance, display information for frame boxes is stored in (normally invisible) frame annotations to each displayed frame (%box-position, for i nsta n c e). If y o u d isp l a y th ese frames, they get their o w n display annotations, recursively. Because Live W orld represents its i n t ern a l pro c esses i n t h e sa m e w a y as i ts user-l e v e l i n f orm a t i o n , i t m a y b e c o nsi d ere d as capable of a degree of computational reflection (M aes 1987) (Ferber and C arle 1990) in that it is p ossi b l e f or progra ms w i t h i n Li v e W orl d t o m o d i f y t h e ir u n d erl y i ng i n t erpre t er a n d re l a t e d mechanisms.

4.2.8

Graphic Realism and Liveness

Live W orld strives for a feeling of real objects interacting in real-time. The principle of naive realism is heightened in Live W orld by displaying boxes and actors as solid objects that retain their solidity as they are moved around. This simple but important technique serves to heighten the realistic and concrete feel of the medium. 13

13 T h e a b i l i t y t o d o sm o o t h d o u b l e-b u f f ere d draggi ng w as m a d e p ossi b l e b y t h e Sh e e t syst e m developed by Alan Ruttenberg.

Live W orld

95

Figure 4.2: A cloned sensor about to be dropped into a turtle actor.

W h e n a b o x or a ctor is i n tra nsit (for i nsta n c e , j ust after b e i ng c l o n e d b ut b efore b e i ng dro p p e d i n i ts h o m e) i t a p p e ars t o f l o a t o v er t h e w orl d , c ast i ng a sh a d o w t o i n d i c a t e i ts transitional state (see figure 4.2). The liveness of Live W orld requires that many activities are ongoing simultaneously. This means that screen objects must be able to move concurrently, and also that screen animation can proceed concurrently w ith user interaction. The feeling of liveness is enhanced by updating displays immediately. For instance, dragging an object w ill cause any related displays to update continuously, not only after the object is released. A lso, autonomous screen objects continue to act during user interaction, and responsive objects may change their behavior as a result of u s e r m o t i o n , a g a i n e v e n b e f o r e t h e o p e r a t i o n i s c o m p l e t e . T h e g o a l o f t h e s y st e m i s t o encourage users to interact w ith the systems they build. M any systems that allo w interactive editing of a runnable system use global mode sw itching as a predominant feature of their interface (for example, the N eXT Interface C onstruction Kit h as a b ig i c o n o f a k n i f e s w i t c h f or t h is p urp ose). T h ese syst e ms i m p ose a b arri er b e t w e e n construction and use that should be unnecessary. Live W orld avoids the need for global mode 14 switching, e n c o uragi ng users t o m o d i f y t h e ir syst e ms as t h e y ru n . T h is h as t h e e f f e c t o f tightening the debugging loop as well as making the interface less modal.

4.2.9

Learning Path

A progra m m i ng syste m for n o v i c es sh o u l d b e b oth e asy to l e arn a n d p o w erfu l . It is to o much to expect a po w erful system to be learned all at once, so the system needs to provide a l e arn i ng p a t h c o nsist i ng o f t e c h n i q u es t h a t a l l o w a user t o progressi v e l y l e arn a n d a d o p t features of the system. Each layer of the system should provide conceptual scaffolding that

Live W orld d o es have a master sw itch to turn off animation, but its use is optionalediting can take place while things are running.

14

96

Live W orld

a l l o w s th e l e arn i ng of th e n e xt l a y er to b e ro ote d i n e x isti ng sk i l ls. C o m p l e x ity n e e ds to b e hidden until it is needed , at which time it should reveal itself in understandable terms. In Live W orld, there are a number of distinct levels of usage that exist w ithin an integrated frame w ork. The intent is that simple modes of use should be easily learnable and also lead the user i nto th e m ore c o m p l e x m o d es. F or e x a m p l e , a user w h ose o n l y e x p eri e n c e is i n usi ng d ire ct-m a n i p u l ati o n gra p h i cs progra ms c a n a p pro a c h th e use of Li v e W orl d as sh e w o u l d a dra w ing program. U nlike a dra w ing program, ho w ever, Live W orld makes the properties of the object into manipulable objects in their o w n right, and can thus introduce this novice user to the idea of properties; slots; and values. The learning path of a novice might follo w these steps: use of direct manipulation graphics to create pictures; o p e n i ng u p t h e gra p h i c o b j e c ts t o m a n i p u l a t e pro p ert i es a n d sl o ts; usi ng o b j e c ts as prototy p es; adding behavior to objects by copying agents from a library; debugging behavior interactions; customi z ing behaviors by modifying agents.

T h e c o e x ist e n c e o f se v era l m o d es o f use t h a t sh a d e n a t ura l l y i n t o e a c h o t h er cre a t es a learning curve. M astery at one level can function as scaffolding for learning the next.

4.2.10

Rich Starting Environment; Libraries

O n e i m p ort a n t st age o f use i n t h e sc a f f o l d i ng m o d e l is progra m m i ng b y c o p y i ng a n d c o m b i n i ng pre-b u i l t o b j e c ts a n d b e h a v i ors fro m l i brari es. La t er, users m a y o p e n u p t h ese o b j e c ts t o s e e h o w t h e y w o r k a n d c h a n g e t h e m . A l a n K a y h a s t e r m e d t h i s st y l e o f u s e differential programming (Kay 1981). The idea behind differential programming is to support the common desire to make an object that is almost identical to an existing one, but w ith a fe w small modifications. This is quite different from Logos approach (see section 1.3.3), w hile Boxer is some w here in bet w een. Logo environments generally begin as blank slates, containing only a turtle. A ne w Boxer environment presents a blank slate to the user, but the educational community around B o x e r h a s a l s o d e v e l o p e d a st y l e i n w h i c h t h e u s e r b e g i n s w i t h a n a l r e a d y - c o n str u c t e d m i cro w orl d c o n t a i n i ng b o t h w ork i ng e x a m p l es a n d c o m p o n e n ts t h a t c a n b e use d i n n e w simulations. Li v e W orl d go es b e y o n d B o x er i n t h a t i t is d esign e d t o p erm i t e asy m o d i f i c a t i o n a n d combination of pre-existing components by direct manipulation. A ny existing object (from a library or else w here) can be cloned, and the clone can then be modified incrementally w ithout affecting the original. If a modification turns out to have an undesirable effect, the modification can be undone by deletion, and the object w ill revert back to the properties and behavior of the original. Live W orlds hierarchical object system allo ws library objects to be combined into ne w Live W orld 97

configurations: i.e., a user might combine a graphic representation for an actor cloned from a library of pictures and add to it sensors and agents cloned from separate libraries. A si d e fro m th e ir use as so urc es of prototy p es a n d c o m p o n e nts, th e l i brari es a lso a ct as sources of examples. That is, each entry in a library may be treated as a closed object, w hich is used as is, or an open object that can be modified or inspected.

4.3

Box Basics

This section introduces the essential features of Live W orlds representation and interface.

4.3.1

Boxes Form a Hierarchical Namespace

T h e Li v e W orl d e n v iro n m e nt is m a d e o ut of b o x es or fra m es. T h e terms are use d i nterc h a nge a b l y e x c e pt i n c o nte xts w h ere th ere is a n e e d to d isti ngu ish b et w e e n th e scre e n representation (box) and the internal structure (frame). From the users perspective, they are th e sa m e . B o x es are n a m e d a n d c a n c o nta i n oth er b o x es as annotations. B o x es t h us f orm a h i erarc h i c a l n a m esp a c e , w i t h a si ngl e d ist i ngu ish e d b o x as t h e ro o t . T h e i n v erse o f t h e annotation relation is called home , so that all boxes except the root have exactly one home. F r a m e r s s y n t a x f o r r e f e rr i n g t o fr a m e s u s e s a s y n t a x b a s e d o n U n i x p a t h n a m e s . #/ designates the root frame, #/theater-1 d esign ates a n a n n otati o n of #/ n a m e d theater-1, a n d #/theater-1/cast/bug/xpos designates a frame named xpos several levels do w n in the hierarchy w h o s e h o m e i s #/theater-1/cast/bug. L i v e W o r l d i n tr o d u c e s s o m e v a r i a n ts o n t h i s s y n t a x w hich are explained in section 4.5.4.2. Boxes also can have a value o r gro u n d , w hich may be any Lisp object, including another box. The value allo ws a box to serve as a slot.

4.3.2

Inheritance, Prototypes and Cloning

A b o x c a n h a v e a prototy p e , from w hich it inherits values and annotations. For example, t h e pro t o t y p e o f #/poodle i s # /dog. # /poodle w ill inherit all the properties of #/dog, b u t c a n override ones in w hich it differs, such as #/poodle/hair-curliness. The inverse of the prototype relation is the spinoff , so #/dog h as #/poodle as a spinoff. B y d efa u lt, a fra m e s prototy p e is th e a n n otati o n of its h o m e s prototy p e w ith th e sa m e n a m e . F o r e x a m p l e , i f t h e p r o t o t y p e o f #/dog i s #/wolf, t h e n t h e d e f a u l t p r o t o t y p e o f #/dog/personality will be #/wolf/personality. H o w ever, the prototype can be any frame at all, so that w hile #/rover might be a spinoff of #/dog, #/rover/personality could be changed to be a sp i n off of #/sheep/personality. W ithin Live W orld, ne w frames are usually created by cloning existing frames; see 4.4.4. Framer provides only single inheritance (a frame can have at most one prototype). But since contained frames can have their o w n prototypes that violate the default rule, it is possible to simulate some of the effects of multiple inheritance.

98

Live W orld

4.3.3

The Basic Box Display

Li v e W orl d s d isp l a y c o nsists of a si ngl e h i erarc h y of n este d b o x es, e a c h re prese nti ng a frame. A typical set of boxes is illustrated in Figure 4.3.

handle

icon

home

name

annotations

value

prototype resizer

Figure 4.3: Boxes and their parts. The labels denote parts or relations relative to the object my-

turtle.

Boxes consist of the follo w ing graphic elements (from left to right on the top in Figure 4.3):

h a n d l e c o n tro ls w h e t h er t h e b o x is o p e n (d isp l a y i ng i ts a n n o t a t i o ns) or c l ose d . T h e handle appears in solid form if there are (interesting) annotations to display, otherw ise it appears in outline form. icon - icons can give a box a more distinctive visual appearance. Icons, inherited like other b o x pro p erti es, serv e to i n d i c ate bro a d ty p es of b o x es (i n th e i l l ustrati o n , th e i c o ns for w orlds, actors, and sensors are visible) and may also be used to indicate the state of the object represented by the box (as in G oal Agents, see 5.1.2). name the name of the box. Required; and must be unique w ithin the boxs home. value the value or ground of the box, if it has one.
The follo w ing elements are only visible w hen the box is open:

annotations these appear as contained boxes. O nly interesting annotations are displayed, see 4.4.6.

prototy p e the name of the boxes prototype appears in the lo w er-right corner of the box. resi z er used to change the si z e of the box.

Each of these elements also functions as an affordance for action. For instance, clicking on a boxs prototype indicator can select the boxs prototype, or change it. C licking on the name or Live W orld 99

value accesses similar functionality. The actions selected by clicks can be customi z ed through click tables; see 4.4.3.

4.3.4

Theatrical Metaphor

G ra p h i c o b j e c ts are i m p l e m e n t e d b y sp e c i a l fra m es c a l l e d a ctors t h a t l i v e i n theaters. Theaters offer t w o vie ws of their objects, a cast vie w and a stage vie w . Both the cast and stage are frames themselves, and the actor frames are actually contained w ithin the cast frame and dra w themselves in the stage frame. The t w o vie ws of the objects are interconstrained (so that, for instance, dragging an object w ill continuously update the relevant slot displays). In Figure 4.3, simple-world is a theater w ith the stage and cast visible as annotations. A l i brary of b asi c a ct ors is pro v i d e d , w h i c h t h e progra m m er c a n c l o n e a n d c ust o m i z e . These include various shapes, lines, turtle-like rotatable objects, and text-actors. The library itself is a theater and ne w objects are created by using the standard cloning commands. There is no need for specialized palette objects.

Figure 4.4: The library of graphic objects

A ctors respond to roughly the same commands as boxes. Both may be cloned by the same mouse-keyboard gesture, for instance. Both may be dragged, although the meaning of dragging a n a c t or is d i ff ere n t fro m draggi ng a b o x . T h e m e a n i ng o f gest ures m a y b e i n d e p e n d e n t l y customi z ed for both actors and boxes. 100 Live W orld

C omposite actors can be created by making a separate theater and cloning its stage (see f igure 4 . 5). Inst e a d of a n ot h er st age , t h is m a k es a n a ct or t h at c o nt a i ns a l l t h e a ct ors of t h e original stage as parts. The inheritance of parts is dynamic, w hich means that changes in the original parts are immediately reflected in the composite.

Figure 4.5: Composite actors. The theater on the right allows the parts of the face to be manipulated; while on the left the face is a single actor.

The link bet w een graphic and non-graphic objects may help novices w ho are experienced users of direct manipulation interfaces make the transition to programming, both by sho w ing them a different vie w of their actions and by permitting them to interact w ith computational objects in a familiar w ay. O n the other hand, the link bet w een the graphic and box vie ws is some w hat a d h o c a n d i n c o nfl i ct w ith th e go a l of ma k i ng o b j e cts se em c o n crete b y stro ngl y identifying objects and their representation (see section 4.8.1).

4.4

Interface Details
An interface is what gets in between you and what you w ant to do.
Carl H avermiste ( H avermiste 1988 )

4.4.1

Selection

Live W orlds interface command structure is based on the standard select-then-operate user interface model. O nce a box is selected, it may be operated on by menu commands, keyboard commands, or mouse gestures, all of w hich can be customi z ed for particular boxes and their spinoffs. Live W orld 101

M u l t i p l e se l e c t i o n is p art i a l l y su p p ort e d . Se v era l fra m es c a n b e se l e c t e d t oge t h er a n d o p erate d o n as a gro u p . F or i nsta n c e , if a gro u p of a ctors is se l e cte d th e y c a n a l l b e se nt a :grow message w ith a single menu selection. H o w ever, not all operations make sense for all groups of selected boxes. This is especially true w hen boxes on different levels are selected. In p art i c u l ar, i f a b o x a n d o n e o f i ts c o n t a i n i ng b o x es are b o t h se l e c t e d , draggi ng b e c o m es problematic, because the base against w hich the inner box is moving is itself moving.

4.4.2

Menus

Live W orld has three menus of its o w n. The Live W orld menu contains global controls and items that operate on the selected box. This is about the same set of operations described in the mouse-gesture table belo w , plus some additional commands for saving and restoring frame structures to files. T h e Sl ots m e n u sh o w s w h at sl ots (a n n otati o ns) are a c c essi b l e for th e se l e cte d b o x . B oth local and inherited slots are included. Slots are organi z ed under the prototype box in w hich th e y a p p e ar i n th e regu l ar b o x v i e w , a n d th e prototy p es are arra nge d i n i n h erita n c e ord er, providing self-documentation of the inheritance structure.

Figure 4.6: Slots and Ask menus, in this case for the box named #/theater-1/cast/rectangle-2.

Selecting an item from the Slots menu finds or creates a slot frame as an annotation to the selected frame, declares that slot interesting (see 4.4.6) so that it w ill be visible, and selects it. Since this has the effect of moving do w n one level in the box hierarchy, the Slots menu also includes an inverse operation, U p, w hich allo ws the user to navigate up the box hierarchy by selecting the box enclosing the current selection. T h e A sk m e n u l ists a l l a v a i l a b l e m e t h o ds or sl o ts w i t h v a l u es f or t h e se l e c t e d fra m e . C hoosing an item from the menu sends the corresponding message to the selected frame, that is, i t is e q u i v a l e n t t o a c a l l t o t h e Lisp ask p r o c e d u r e (s e e s e c t i o n 4 . 5 . 2 ) . If t h e m e ss a g e 102 Live W orld

c orresp o n ds t o a m e t h o d t h a t t a k es argu m e n ts, t h e user w i l l b e ask e d t o su p p l y t h e m . T h e m e n u i t e ms i n d i c a t e w h e t h er or n o t t h e y t a k e argu m e n ts a n d i f t h e y h a v e a n e q u i v a l e n t keyboard command (see section 4.5.3. If the ask procedure returns a value it is displayed next to the Ask menu. Both menus are customi z ed for the selected box or boxes. In the case of multiple selection, th e A sk m e n u sh o w s o n l y m eth o ds or sl ots th at are v a l i d for e a c h of th e se l e cte d b o x es. Its m ore d iffi c u lt to d efi n e a se nsi b l e b e h a v i or for th e Sl ots m e n u w h e n m ore th a n o n e b o x is selected; currently it simply sho ws the slots for a single selected object.

4.4.3

Mouse Operations

M any operations in Live W orld can be performed w ith mouse gestures. A mouse gesture is a combination of a mouse click on some part of a box together w ith some set (possibly empty) of modifier keys. The use of modifier keys is some w hat unfortunate, since they are not a particularly easy-tolearn interface technique. Ideally, there w ould be an affordance (that is, a visible and clickable part) for every possible action. If this w ere so then there w ould be no need for modifier keys. But the limitations of screen real estate, together w ith the large number of operations possible, does not allo w this. The combination of separate box regions and modifier keys is a compromise measure. To ameliorate the difficulty this may cause, several rules are adopted: A ll gesture operations can also be accessed from the Live W orld menu. The interface tries to maintain consistency of meaning among the particular modifier keys. F or i nst a n c e , t h e c o m m a n d m o d i f i er usu a l l y i n d i c a t es a n e d i t i ng o p era t i o n , w h i l e t h e c o m m a n d-o pti o n-c o ntro l m o d ifi er i n d i c ates a d e l eti o n (of a fra m e , v a l u e , or prototy p e , depending on the region of the click).

Live W orld

103

no shift keys
body title value drag -

c md
edit value edit name edit value

op t
clone -

ctrl
st e p -

s h if t -op t
move copy value (shift-cmd) -

c md-opt-ctrl
delete delete value

handle

open or close

o p e n or close all edit prototy p e resi z e actor

open w ith internals -

prototype

select prototy p e resi z e drag actor

delete prototy p e -

resizer actor

default size -

st e p

windowize -

Table 4.1: G lobal mouse gestures. An entry of - means the behavior of a click on the region is the same as the corresponding click on the body.

B o x es c a n c usto m i z e th e ir h a n d l i ng of m o use gestures b y c h a ngi ng th e v a l u e of annotations w ithin a set of frames kno ws as click tables. For example, buttons (Figure 4.7) w ork by providing an entry in the body-click-table for ordinary clicks that calls a user-specified action (a n d m a k es c o ntro l-c l i c k ta k e o v er th e ord i n ary fu n cti o n of drag, so th e b utto n c a n sti l l b e m o v e d ) . A s e p a r a t e c l i c k t a b l e c a n b e d e f i n e d f o r e a c h p a rt o f t h e b o x ( b o d y , r e s i z e r , prototype, and so forth). For the purposes of mouse click handling, the graphic representation of a n a ctor is c o nsi d ere d a regi o n a n d h as its o w n ta b l e . C l i c k ta b l es a lso serv e as documentation for mouse gestures

Figure 4.7. Illustrating the use of click-tables. The left-hand box is a button which performs an action when clicked (it can be dragged with control-click). The box on the right is a turtle actor, which will be rotated rather than resized (the default) when given a cmd-click mouse gesture.

104

Live W orld

4.4.4

Cloning

N e w objects are usually made by cloning existing objects w ith a mouse gesture. The steps involved are as follo ws: The user clones an existing box w ith a mouse gesture. A n e w b o x is m a d e th at h as th e origi n a l as its prototy p e . T h e n e w b o x l i v es i n a sp e c i a l frame called # /limbo. T h e n e w b o x a p p e ars to fl o at o v er th e w orl d , c asti ng a sh a d o w (se e figure 4 . 2). A s it is dragged, potential homes are indicated by highlighting them. Some boxes specify that they c a n o n l y b e dro p p e d i n t o p art i c u l ar t y p es o f b o x es (f or i nst a n c e , se nsors c a n o n l y b e dropped into actors). The ne w object is dropped into its home w hen the user releases the mouse. Install methods are run (see section 4.7.4).

4.4.5

Inheritance

Li v e W orl d o b j e c ts t h a t are c l o n e d fro m a pro t o t y p e m a i n t a i n a l i v e l i n k b a c k t o t h a t prototy p e , a n d c o nti n u e to l o o k u p v a l u es for l o c a l a n n otati o ns i n th e prototy p e u nti l l o c a l v a l u es are d efi n e d . T h is resu lts i n w h at I c a l l dynamic inheritance , m e a n i ng th at c h a nges i n prototypes can affect spinoffs, a fact w hich is reflected in the interface. This is most noticeable i n th e c ase of a ctors, w h ose pro p erti es c a n b e affe cte d b y m o use m oti o ns. If a n a ctor w ith spinoffs is resi z ed, for example, and the spinoffs are inheriting si z e values from it, they w ill also c h a nge as th e mo use mo v es. T h is gi v es a stro ng ta cti l e fe e l i ng for th e n ature of i n h erita n c e . H o w ever, it can also lead to expectation violations. A n attempt w as made to mitigate this by the use of special dragging handles that indicate w hich objects w ill be affected by a drag or resi z e operation (see Figure 4.8).

Figure 4.8: Dragging handles. oval (on the left) is selected, so it has solid handles that allow the user to change its position or size slots. oval-1 inherits its xsiz and ysiz slots from oval , so it has hollow handles to indicate that it too will change if those properties are modified in oval .

Live W orld

105

D ynamic inheritance is a useful feature for conveying the idea and feel of inheritance, but it is some w h at i n te nsi o n w ith th e re a l ist meta p h or. A lth o ugh it is b ase d o n re a l isti c c ogn iti v e m o d e l s i t d o e s n o t c o rr e s p o n d t o t h e b e h a v i o r o f r e a l w o r l d o b j e c ts . W h i l e y o u m i g h t u n d ersta n d y o ur n e igh b ors c ar i n terms of a prototy p i c a l c ar (p erh a ps y o ur o w n) y o u d o not expect the neighbors car to change colors if you should happen to paint your o w n! This issue is an example of w hat (Smith 1987) refers to as the tension bet w een literalism a n d m agi c . T h ere is a tra d e off b et w e e n a d h ere n c e to a re a l- w orl d m eta p h or a n d pro v i d i ng a c c ess to th e usefu l pro p erti es of th e c o m p utati o n a l w orl d th at m ight a p p e ar to v i o l ate th at metaphor. In this case I w as particularly interested in exploring the properties of an interface t h a t i n c orp ora t e d d y n a m i c i n h eri t a n c e , so t h e d e c isi o n w as m a d e t o a l l o w t h is m agi c a l pro p ert y i n t o t h e syst e m . A syst e m a i m e d so l e l y a t n o v i c es m igh t c h o ose t o a d h ere m ore closely to the literal metaphor, or perhaps make dynamic inheritance available as an option.

4.4.6

Interestingness

Framer creates local annotations for slot references. This means, for example, if a rectangle object inherits its color from a parent, it will nonetheless get a local color annotation on the first reference. This is done primarily for efficiencythe local annotation serves as a cache that w ill speedup future lookups. H o w ever, it means that there are many slots in existence w hich are not of direct interest to the user. A ne w ly created rectangle has about 12 such local slots, w ith only 2 of them (the x and y positions) actually containing information unique to that rectangle. To deal w ith this problem, Live W orld defines an interestingness predicate for frames w hich c o ntro ls w h eth er or n ot th e y are d isp l a y e d . Esse nti a l l y a fra m e is d e e m e d i nteresti ng if it is acting as other than a local cache. This is true if it fulfills at least one of the following criteria: It has a local value; Its prototype is other than the default; It contains an interesting annotation; or It has been explicitly marked as interesting by the user.

The last clause allo ws users to make local slots visible, usually for the purpose of modifying their value. For instance, w hen a user creates a ne w frame using the Slots menu it is marked as interesting to ensure that it actually appears. Some frames have this property set by the system, su c h as t h e cast a n d stage a n n o t a t i o ns o f t h e a t ers, b e c a use su c h fra m es sh o u l d a l w a ys b e visible.

4.4.7

Box Sizes and Positions

The si z e and position of a box are specified by internal annotations on the corresponding fra m e . T h ese a n n otati o ns are internal , t h a t is, t h e y are n o t n orm a l l y se e n b y t h e user (se e section 4.7.2). U sing the system to represent information about itself has several advantages:

106

Live W orld

Si z es a n d p ositi o ns are a uto m ati c a l l y sa v e d a n d restore d a l o ng w ith th e rest of a set of boxes w hen they are closed or written out to a file. B o x si z es a n d p ositi o ns i n h erit d y n a m i c a l l y , j ust as th ose of a ctors d o . T h is m e a ns th at draggi ng or resi z i ng a b o x m ight c h a nge th e p ositi o n or si z e of a sp i n off. T h is b e h a v i or m ight b e d isc o n c erti ng, b ut c a n a lso serv e to re i nforc e th e re a l ity of i n h erita n c e relationships to the user. A user can choose to make the internal frames visible, w hich results in a dynamic display of the internal w orkings of the system.

By default, boxes w ill automatically resi z e themselves to be just large enough to contain their contents. This too is done on a dynamic basis, so if an internal box is being dragged, its c o nta i n er w i l l resi z e itse lf d uri ng th e drag. T h is pro c ess is k n o w n as shri n k- w ra p p i ng . O f c o urse a user m igh t a lso w a n t t o sp e c i f y t h e si z e o f a b o x b y h a n d , f or i nst a n c e i f sh e w as planning to drop a large set of ne w items into it and w anted to make the space in advance so th e y c o u l d b e arra nge d pro p erl y . T o d e a l w ith th is a b o x h as a th ird i ntern a l sl ot, preferredsize, w h i c h c o n t a i ns t h e user-sp e c i f i e d pre f erre d si z e or nil i f t h e d e f a u l t shri n k- w ra p p i ng behavior is desired.

4.5

Language Extensions

This section describes Live W orlds extensions to Lisp. The facilities include accessors for boxes and their components, a message passing language defined on boxes.

4.5.1

Accessors for Boxes

Framer extends Lisp w ith the frame structure and accessors for its components (i.e., framehome, frame-prototype). Li v e W orl d h as a sl igh t l y m o d i f i e d se t o f f u n c t i o ns f or a c c essi ng annotations and grounds: names of boxes are given in the form of Lisp key w ords, w hich are preceded w ith a colon and not evaluated. (getb box name ) Returns the annotation of b o x named name , or generates an error if the annotation is not prese nt. (getb-safe box name ) Same as getb b ut returns nil rather than getting an error. (getb-force box name &optional prototy p e ) Same as getb, but w ill create the frame if necessary (as a spinoff of prototype).

4.5.2

Message-Passing with ask

Live W orld defines a message-passing protocol on boxes. W hen a box receives a message, w h i c h c o nsists of a n a m e a n d so m e o pti o n a l argu m e nts, it l o o ks for a n a n n otati o n w ith th e sa m e n a m e as th e m essage . T h is a n n otati o n sh o u l d b e a m eth o d o b j e ct, w h i c h sp e c ifi es a n action (see the next section). In other w ords, methods are themselves boxes and are inherited

Live W orld

107

by the usual mechanism. A single primitive, ask, is use d b oth to se n d m essages a n d to retri e v e values from slots. The syntax of ask is as follo ws: (ask box message arguments*) Ask examines the annotation of b o x n a m e d b y message . If it is a meth o d , th at meth o d is applied to the box and arguments. If its an ordinary slot, the value of the slot is retrieved and returned. For example: (ask turtle :color) (ask turtle :forward 10) Returns the value of turtles color slot. C auses the turtle to move forw ard 10 pixels.

There are also functions send a n d slot, w hich are like ask e x c e p t t h a t t h e y a l w a ys d o a message send or a slot-lookup, respectively. This can be useful if a program w ants to access a method object as a value rather than invoke it (something users w ould not ordinarily need to d o). ask-self is a variant of ask that can be used to access a slot or method directly. W hile ask i s a n a l ogo us t o m essage-se n d i ng c o nstru c ts i n o t h er l a ngu ages, ask-self i s r a t h e r u n u s u a l . I t d e p e n ds u p o n t h e f a c t t h a t sl o ts a n d m e t h o ds are f irst-c l ass o b j e c ts a n d are l o c a l t o t h e ir containing object: (ask-self slot-or-method arguments* ) will return the value in slot-or-method , or invoke it as a method if it is one. Ask-self is often u s e d t o e x tr a c t a v a l u e fr o m a b o x . B e c a u s e t h i s o p e r a t i o n i s q u i t e c o m m o n , i t c a n b e abbreviated as v for value. The follo w ing constructs are thus equivalent: (ask b o x name ) (ask-self (getb b o x name ) ) Setting values is done by sending them a :set message: (ask slot :set value ) T h is a l l o w s o b j e c ts t o sp e c i f y sp e c i a l a c t i o ns t o b e p erf orm e d o n se ts. F or i nst a n c e , computed slots (see section 4.6.3) get an error if an attempt is made to set their value. Because se tt i ng v a l u es is su c h a c o m m o n o p era t i o n , i t m a y b e a b bre v i a t e d usi ng t h e C o m m o n Lisp construct setf w ith a value accessing construct such as ask or v: (setf (v slot ) value ) (setf (ask b o x slot ) value )

4.5.3

Methods

108

Live W orld

M ethods are written in C ommon Lisp augmented w ith Framer and Live W orld extensions. There are several different kinds of methods, and it is possible for users to add further kinds. The system defines the follo w ing standard classes of methods:

primitive methods: these methods are built into the system code. Their definitions cannot normally be seen or changed by the user15 . Primitive methods can take arguments. simple methods: t h e s e m e t h o d s c o n s i s t o f a s i n g l e b o x w h i c h c o n t a i n s t h e m e t h o d definition in the form of a Lisp expression. They cannot take arguments. See Figure 4.9 for an example. complex methods: complex methods can take arguments. A complex method is a box w ith internal boxes that specify the arguments and body of the method.

Figure 4.9: A turtle with a simple method for :step m essages.

Figure 4.9 illustrates a simple method for a turtle that implements a behavior. The method is named step, so t h a t (ask #/circler/cast/turtle :step) w ill execute it. The method calls several other methods such as forward and turn-left, w hich are inherited from the prototype turtle and are not visible. The @^ / n o t a t i o n is a b o x p a t h t h a t re f ers t o t h e t urt l e (se e se c t i o n 4 . 5 . 4 . 2). Triangle-sensor is a sensor (see section 4.6.4). The anima causes step to be called repeatedly (see section 4.6.1). T h e b o d y of a m eth o d c a n a c c ess se v era l sp e c i a l sy m b o ls th at are b o u n d to v a l u es th at i n d i c ate th e l o c a l c o nte xt. T h e sy m b o l here i s b o u n d t o t h e b o x i n w h i c h t h e t e x t o f t h e e x pressi o n a p p e ars. T h e sy m b o l self is bound to the object w hich is the methods container. The symbol call-next is function-bound to a function that w ill invoke the method belonging to th e o b j e cts prototy p e . T h is fu n cti o n a l ity is a n a l ogo us to call-next-method i n C L O S (St e e l e

15 The existence of primitive methods is an artifact of the w ay in w hich Live W orld w as bootstrapped, and they could be eliminated.

Live W orld

109

1990), although the w ay in w hich next-methods are found in Live W orld is very different. If a method calls call-next, the system follo ws the methods prototype link back until an appropriate next method is found. This allo ws any object to speciali z e a method w hile making use of the default behavior, and it also allo ws behaviors from one object to be imported to another, w hile preserving appropriate inheritance and calling paths. M e t h o ds c a n h a v e o t h er sl o ts b esi d es t h e ir b o d y a n d argu m e n ts. A m o ng t h e st a n d ard defined slots are documentation, w h ose v a l u e c a n b e a n e x p l a n atory stri ng, a n d commandkey, w hose value is a character w hich w ill make the method invokable by a keyboard command w hen the parent object is selected (see Figure 4.6).

4.5.4

Relative Box Reference

M e t h o ds o ft e n n e e d t o re f er t o t h e ir c o n t a i n i ng o b j e c t or t o o t h er b o x es. A bso l u t e b o x names are usually not suitable because they w ill break if the method is cloned. M ethods thus need to refer to boxes in relation to their o w n location.

4.5.4.1

Self

The simplest w ay to handle relative reference is through a special variable that refers to the local object. In many other O O P languages this variable is called self, and Live W orld continues that tradition. In the body of a method, the name self c a n b e use d to refers to th e o b j e ct th at c o nta i ns th e m eth o d . H o w e v er, Li v e W orl d s h i erarc h i c a l o b j e ct syste m ge n erates n e e ds for more complex forms of relative reference. A lso, the name self is so m e w h at c o nfusi ng i n th e context of a hierarchical object system: it might just as logically be taken to refer to the box in w hich it occurs, rather than the box for w hich it is a method, w hich might be several levels up in the hierarchy.

4.5.4.2

Boxpaths

T o so l v e t h ese pro b l e ms, I d e f i n e d a n e w sy n t a x f or b o x p a t hs, w h i c h pro v i d es a m ore flexible facility for relative reference to boxes and their values. Boxpaths specify a relative path fro m o n e b o x t o a n o t h er. B o x p a t hs are a l w a ys sp e c i f i e d re l a t i v e t o t h e b o x i n w h i c h t h e y o c c ur, re m o v i ng th e a m b igu ity of self. B o x p a t hs a lso a l l o w re f ere n c e b ase d o n t y p es. F or instance, a boxpath can specify paths that say go up to the nearest enclosing actor b o x a n d then get the value from its prey-sensor s other slot. B o x p a t h sy n t a x is b ase d o n Fra m ers d e f a u l t sy n t a x . A n @ i n tro d u c es a b o x p a t h , a n d follo w ing characters specify navigation paths through the box hierarchy, either up or do w n. A caret (^) m e a ns go u p , th at is, a c c ess a n a n c estor of th e c urre nt b o x . A b o x p ath c a n go a fixed number of steps up the container hierarchy, or it can search up w ards for a particular kind of box. D o w n w ard navigation is expressed by the standard frame syntax (see 4.3.1) but w ith an extension that allo ws box values, as w ell as boxes themselves, to be accessed. T h i s e x t e n s i o n i s b a s e d o n U n i x d i r e c t o r y n a m i n g c o n v e n t i o n s , w i t h a b o x tr e a t e d analogously to a directory. A final / in a boxpath indicates that the path is to return the final

110

Live W orld

box in the path, w hile the absence of a final / i n d i c ates th at th e fi n a l b o x s v a l u e sh o u l d b e returned. Some examples of ho w boxpaths express common patterns of box reference: @/ The local box (the box in w hich the boxpath appears). The value of the local box. The immediate container of the local box. T h e v a l u e o f t h e b o x n a m e d f o o d -s e n s o r t h a t i s a sibling of the local box. The container of the immediate container. The example above: go up to the nearest enclosing actor b o x a n d t h e n g e t t h e v a l u e f r o m i t s preysensor s other slot.

@ @^ / @^/food-sensor

@^^ / @^actor/prey-sensor/other

Boxpaths are essentially a syntactic abbreviation for complex sequences of box accessing functions. For example, the last example above expands into the Lisp code: (ask (getb (lookup-box *here* :actor) :prey-sensor) :other) W h ere * h e r e * i s b o u n d t o t h e b o x i n w h i c h t h e b o x p a t h a p p e a rs . Lookup-box i s a function that searches up the box hierarchy for a box of a specified type.

4.5.5

Demons

T h e st a n d ard :set method includes a facility for establishing demons o n a sl o t . T h ese are procedures that get executed w henever the value of a slot changes. W hile similar effects can be accomplished by defining a local :set m eth o d , th e a d v a ntage of d e m o ns are th at th e y c a n b e easily added dynamically, and if there are more than one they w ill not interfere w ith each other (t h a t is, a b o x c a n h a v e m a n y d e m o ns, w h i l e i t c a n h a v e a t m ost o n e l o c a l : s e t method). Live W orld uses demons for many internal functions, such as invalidating computed slots (see 4.6.3) and updating the display of graphic actors if one of their parameters should change. D emons are stored in an internal annotation (name %demons) and are inherited by clones of the parent object. To avoid the potential of infinite recursion, the %demons slot itself has a :set method for that prototype that avoids the usual demon mechanism. T h e d e m o n m e c h a n ism c a n ge n era l i z e t o h a n d l e o t h er t y p es o f e v e n ts b esi d es v a l u e c h a nges. F or i nsta n c e , b o x es c a n a lso h a v e annotation demons th at get c a l l e d w h e n e v er a n annotation is added to or removed. A typical use is for a sensor to put an annotation demon Live W orld 111

on the cast box of a theater, so that it can be informed w henever a ne w actor appears in the w orld.

4.5.6

Global Object

The inheritance scheme of Framer w as modified to include the concept of a global default prototype. N amed #/global, this box serves as a last resort w hen looking up slots. This object provides the default methods for common operations such as :set, the default annotations for i nterfa c e o p erati o ns su c h as c l i c k ta b l es, a n d d efa u lt te m p l ates for u n i v ersa l l y sh are d sl ots, su c h as documentation and %demons.

4.6
4.6.1

Specialized Objects
Animas and Agents

A n i m as are o b j e c ts t h a t pro v i d e a n i n t erf a c e t o t h e b a c kgro u n d e x e c u t i o n f a c i l i t y o f Live W orld. A n anima causes its enclosing object to be sent messages repeatedly. A nimas run concurrently w ith user actions and provide the underlying ability to create autonomous and reactive objects. A nimas are the foundation on w hich the agent systems of C hapter 5 are built. W hen the animas are running, all objects containing active animas are sent :step m essages repeatedly. A ny object can have a :step method, but they are most commonly found in method objects. The effect of sending :step to a method object is to apply the method to its container. A method of z ero arguments can thus be converted into an agent of sorts simply by dropping an anima into it (see Figure 4.9 for an example). A nimas are thus conceptually similar to processes, a lth o ugh th e e x e c uti o n of a n i m as are n ot tru l y c o n c urre nt ( C h a pter 5 go es i nto m ore d eta i l about ho w animas can be modified to provide better concurrency as w ell as conflict resolution facilities). The execution of animas is interleaved with each other and with user action. A n i m as m a y b e turn e d o n or off i n d i v i d u a l l y , a n d th ere is a lso a m aster s w itc h i n th e Live W orld menu that can disable all animas. W hen this master sw itch is off, the entire system can be single stepped by the user, w hich means that each active anima gets sent a single :step message. This is useful for debugging. It is i n t erest i ng t o n o t e t h a t t h e m e t a p h ori c a l d escri p t i o n o f t h e re l a t i o nsh i p b e t w e e n pro c esses a n d pro c e d ure is i n v erte d . In m ore tra d iti o n a l syste ms, pro c esses are esta b l ish e d that execute procedures inside themselves, w hile in Live W orld, the process mechanism lives inside the procedural object that it calls. This inversion of the usual relationship is one part of Live W orlds attempt to change the metaphors used to describe computation into a form that suggests a greater degree of animacy and autonomy (see C hapter 3).

112

Live W orld

4.6.2

Specialized Slots

Live W orld defines some slot objects that are speciali z ed for particular kinds of values, such as c o l ors or p o i nts, th at h a v e sp e c i a l d isp l a y re q u ire m e nts. T h e prototy p es for th ese o b j e cts live in a library named #/slots (see Figure 4.10). For example, #/slots/color-slot defines special m eth o ds th at c a use it to d isp l a y its v a l u e as a c o l or s w atc h , a n d to i n v o k e th e syste m c o l or p i c k er w h e n its v a l u e is e d ite d . T h ese sl ots are i n c orp orate d i nto oth er syste m o b j e cts (i . e . , most actors have a color-slot, and turtles and some sensors use an angle-slot to specify their headings).

Figure 4.10: The slot library.

Some speciali z ed slots take advantage of Framers recursive annotations to have parameters of their o w n. In the figure, bar-graph-slot and formatted-slot are open to sho w their parameter sl ots.

4.6.3

Computed Slots

C omputed slots are slots that dynamically compute their value from an expression, in the manner of spreadsheet cells. The value of a computed slot is defined by a to-compute method d e f i n e d as a n a n n o t a t i o n t o t h e sl o t . F or e x a m p l e , t h e c o m p u t e d sl o t area i n F i g u r e 4 . 1 1 c o m p utes th e are a of its c o nta i n i ng a ctor as th e pro d u ct of th e a ctors regu l ar xsiz a n d ysiz sl ots. N ote th e use of b o x p aths i n th e m eth o d , w h i c h a l l o w s th e are a sl ot to b e c l o n e d i nto other actors.

Live W orld

113

Figure 4.11: An example of a computed slot.

A computed slots value is accessed using normal mechanisms, but trying to set it w ill cause an error. The value is displayed in an italic font to indicate that it is not settable. There are actually several varieties of computed slots. The simplest just computes its value on demand (that is, w henever the rectangle is asked for its area, the multiplication specified in t h e to-compute method w ill be run). The more complex varieties cache their value and only recompute it w hen necessary. This requires that the cached value be invalidated w henever any of th e v a l u es th at it d e p e n ds u p o n c h a nge . Si n c e th ese v a l u es are i n oth er sl ots, th is c a n b e accomplished by putting demons (see 4.5.5) on the depended-upon slots w hich invalidate the c a c h e d v a l u es (a te c h n i q u e d e v e l o p e d i n (F ish er 1 9 7 0) to su p p ort w h at w ere c a l l e d c o n t i n u o u s l y e v a l u a t i n g e x p r e ss i o n s ) . T h e s e d e m o n s a r e i n s t a l l e d a u t o m a t i c a l l y b y monitoring slot accesses during the evaluation of the to-compute method. F igure 4 . 1 2 i l l ustra t es so m e o f t h e i n t ern a l stru c t ures a n d m e c h a n isms t h a t i m p l e m e n t c o m p u t e d sl o ts. Ev ery c a c h e d c o m p u t e d sl o t h as a n i n t ern a l l y st ore d v a l u e a n d a f l ag t h a t

Figure 4.12: The same computed slot, with the internal slots that comprise the computational mechanism revealed.

114

Live W orld

specifies w hether or not that value is valid. Each slot upon w hich the computed slot depends has a demon added, w hich causes the computed slot to become invalid w henever the value of the depended-upon slot changes. In this case the demon appears as a compiled Lisp closure.

4.6.4

Sensors

Sensors are objects that allo w actors to obtain information about their surroundings, and are implemented speciali z ed versions of computed slots. That is, they are computed slots that compute their value based on the actors w orld, and are designed to be annotations of actors. Se nsors c a n a lso pro v i d e a gra p h i c re prese n t a t i o n o f t h e mse l v es as a n a d d-o n l a y er t o t h e actor they are part of. A n example of a sensor may be seen in Figure 4.3. This triangle-sensor is so called because its field is in the shape of a triangular region, and is sensitive to objects that enter that field. Sensors make particularly effective use of Framers hierarchical representation structure, w hich lets them be seen as both slots and objects w ith slots of their o w n. Sensors contain slots that specify their parameters or details about the results they are computing (the to-compute m eth o d c a n set oth er sl ots b esi d es return i ng a v a l u e). A n e x a m p l e is sh o w n i n F igure 4 . 1 3 . Shape is a computed slot itself, that depends upon field-heading, field-width, field-range, a n d

Figure 4.13: Inside a triangle-sensor.

Figure 4.14: The sensor library

Live W orld

115

on the heading of the containing actor. The effect of these dependencies is to let the shape of th e se nsor b e c o m p ute d a uto m ati c a l l y w h e n th e a ctor m o v es or w h e n th e user c h a nges th e values of one of the sensors slots. O ther parameters allo w the sensor to be customi z ed to be sensitive to particular kinds of objects (for instance, only ovals). There are many kinds of sensors (see Figure 4.14). Some, like the triangle-sensor, have a predicate value. O thers have numerical values (for instance, the range-sensor, w hich monitors t h e d ist a n c e o f a si ngl e o b j e c t) or re t urn t h e d e t e c t e d a c t or or a c t ors t h e mse l v es (su c h as nearest-object-sensor). W hile most sensors respond to actors, some, like w all-sensor, respond to other features of the environment.

4.6.5

Multimedia Objects

Li v e W orl d s o b j e ct syste m m a k es it stra ightfor w ard to pro v i d e sp e c i a l i z e d o b j e cts for a variety of media, and also to provide libraries of samples. The t w o most useful and most fully supported media forms are pictures a nd sounds. Pi ctures are simply a form of a ctor. Soun ds are speciali z ed boxes w ith :play a n d :record m eth o ds. B oth p i ctures a n d so u n ds o b j e cts are i m p l e m e nte d as e n c a psu l ati o ns of th e c orresp o n d i ng M a c i ntosh syste m o b j e cts, a n d c a n b e imported from external applications.

Figure 4.15: Libraries of pictures and sounds.

116

Live W orld

So u n d o b j e cts c a n b e use d to pro v i d e a u d itory resp o nses for cre atures or so u n d effe cts for games, but also have a special use for debugging, a technique sometimes called program aurali z ation ( D i G iano, Baecker et al. 1993) by analogy to the w ell-established techniques of program visualization. Li v e W orl d su p p orts a u d i o i z ati o n b y pro v i d i ng a sp e c i a l k i n d of o b j e ct, c a l l e d a n autosound, w h i c h c a n b e dro p p e d i nt o a m et h o d . T h e eff e ct of t h is is t o c a use t h e so u n d t o b e played w henever the method is called. This technique not only supports program audioi z ation, but makes it easy to add sound effects to games and simulations.

4.6.6

K-lines

Frames can also be used to implement a form of memory loosely based on M inskys K-line learning mechanism (M insky 1980). In Society of M ind, a K-line records a partial mental state represented as the activation state of a set of agents. In Live W orld, a K-line can record the state (that is, the values) of a selected set of boxes. A K-line is a box created in the usual w ay. To specify that a slot is to be recorded by the K-line, the user makes a clone of the slot and drops it into the K-line. The K-line thus contains spinoffs of all the frames that it covers and responds to t w o basic messages, :store and :recall , which have simple implementations. Store forces each sp i n off to h a v e th e current value of its prototype, w hile recall copies the value of the spinoff back to the prototype. A n additional message, :add-object, w ill cause the K-line to cover all of the interesting slots of an object. Li v e W orl d s K-l i n es w ere c o nstru c t e d m ost l y t o se e h o w f ar t h e pro t o t y p e re l a t i o nsh i p c o u l d b e e x t e n d e d i n t o o t h er uses (f or a si m i l ar e x p eri m e n t , se e t h e d isc ussi o n o f p orts i n 4.9.1). W hile these K-lines are not po w erful enough to be of much use in mental modeling, they have proved to have some utility in recording initial states for applications like animations and games.

4.7
4.7.1

Miscellaneous Issues
Shallow vs. Deep Cloning

A question arises w hen a box is cloned about w hich of its internal parts should be cloned along w ith it. For example, in the case of an actor w ith no complex internal parts, there is no n e e d to c l o n e a n y of its sl otsth e v a l u es w i l l b e i n h erite d . B ut if th e a ctor h as se nsors, th e se nsors n e e d t o b e c o p i e d so t h a t t h e n e w cre a t ure h as i ts o w n p erc e p t i o ns, ra t h er t h a n inheriting those of its parent! So, in some cases internal parts do need to be cloned. W hich objects require this treatment? O rdinary slots, in general, do n ot need to be copied by this mechanism, since their values are inherited. The objects that need to be copied explicitly are t h ose t h a t c a use so m e si d e-e ff e c t , su c h as cre a t i ng a n i m age o n t h e scre e n (a c t ors) or compute a value based on local information (sensors).

Live W orld

117

Li v e W orl d pro v i d es a m e c h a n ism th at a l l o w s a n y b o x to sp e c ify th at it m ust b e c l o n e d w henever a box that contains it is cloned. Such boxes are flagged w ith an internal annotation, %copy-as-part. W henever any box is cloned, all of the original boxs annotations are examined via recursive descent for the presence of this flag, w hich if present causes the box containing it to be cloned into the appropriate place. Since the appropriate place might be several levels deep in the ne w box, the intervening container boxes must also be cloned. The same mechanism is used to maintain dynamic inheritance relationships after an object is cloned. For example, if turtle-1 is cloned to form turtle-2, a n d th e n turtle-1 is gi v e n a se nsor, turtle-2 s h o u l d r e c e i v e a c l o n e o f t h a t s e n s o r . T h e %copy-as-part f l ag a lso c o n tro ls t h is propagation.

4.7.2

Internal Frames

Li v e W orl d uses a n n o t a t i o ns t o re c ord i n f orm a t i o n a b o u t i ts i n t ern a l f u n c t i o n i ng (f or e x a m p l e , th e scre e n p ositi o n of a fra m e s d isp l a y is store d as a n a n n otati o n o n th at fra m e). Sho w ing these to the user w ould be confusing. Live W orld therefore allo ws certain frames to be marked as internal , w ith the result that they are not normally displayed to the user in the box vie w or in menus. The convention used is that internal frames are those w hose names begin w ith the % c h ara cter16 . A n a d v a n c e d user c a n c h o ose t o d isp l a y t h ese fra m es, b y h o l d i ng do w n an additional key during a command that opens a box or displays a menu. A frame w ith its internal frames exposed may be seen in Figure 4.16. Internal frames serve some of the same p urp oses as closets do in Boxer.

Figure 4.16: A box that has (some) of its internal frames showing. O ne of them, %view-size, also has its own internal frames visible. The values in these slots are Lisp point objects that denote x-y coordinate pairs.

Aside from the display information sho w n in the figure, internal frames are used to store data for internal mechanisms like demons, internal state like interestingness (see 4.4.6), and sl o ts w h ose v a l u e w o u l d b e m e a n i ngl ess t o t h e user, su c h as p o i n t ers t o M a c i n t osh so u n d objects.

16 It w ould be more elegant to use an annotation to convey this information. The % convention is an artifact of Live W orlds development history, and has been retained for reasons of efficiency.

118

Live W orld

4.7.3

Deleting Boxes

D eleting objects can be problematic in a prototype-based object system. O ne issue is the question of ho w to deal w ith objects that inherit from the object being deleted. Framers built-in h a n d l er for d e l eti o n si m p l y d isa l l o w s d e l eti o n of a fra m e w ith sp i n offs. Li v e W orl d e xte n ds Fra m er b y a l l o w i ng t h e user t o sp e c i f y a w a y t o pro c e e d w h e n a pro b l e m a t i c d e l e t i o n is detected. The users options are to: abort the deletion; delete all the spinoffs as well; or try to preserve the spinoffs by splicing out the deleted frame.

Splicing out a frame involves removing it and its annotations from the inheritance chain so that it may be deleted. Each spinoff of the spliced-out frame (and its annotations, recursively) must have its prototype changed to point to the prototype of the spliced-out frame, and if the spliced-out frame provides a value that value must be copied into each spinoff. This complexso u n d i ng pro c e d ure re t a i ns t h e o l d v a l u es o f sl o ts a n d re t a i ns as m u c h o f t h e i n h eri t a n c e relationship as is possible. G iving the user choices is fine for interactive use, but does not deal w ith the problem of deletion by a program in a live simulation. For instance, in a dynamic biological simulation, animals w ill reproduce by creating spinoffs of themselves. If a parent is eaten by a predator, w e dont w ant the child to be affected, but w e also dont w ant the system to stop and ask the user w hat to do. There are also some fundamental problems w ith splicing out prototypes. C onsider the case w here there is a prototype ant, and many spinoffs of it (and possibly spinoffs of the spinoffs). Say further that there is an anteater in the simulation w ith an ant sensor. Sensors often specify the type of object they are sensitive to. If the prototypical ant gets spliced out and deleted, the a n t se nsor w i l l b e p o i n t i ng t o a d e l e t e d fra m e . Ev e n w orse , t h e a n ts w i l l h a v e n o c o m m o n prototype that allo ws them to be considered to be a class of objects17 . F urth ermore , th e a nts no w each have their o w n copy of w hatever properties w ere defined by the prototype (such as t h e c o m p l e m e n t o f se nsors a n d age n ts) so i t is n o l o nger p ossi b l e t o c h a nge t h ese characteristics without changing them individually for each ant. A better solution to the deletion problem, w hich makes good use of Live W orlds hierarchical structure, is to keep prototype objects in a separate theater (see Figure 4.17). These prototypes are then outside of the simulation, inactive, and so in no danger of being deleted.

17I t might be argued that using prototypes to specify classes is a bit inelegant any w ay. If the sensors w ere truer to their real-w orld models, they w ould not specify a type of object to be sensitive to, but instead would use a detectable characteristic of the object (i.e. the ant sensor would look for objects that were small and black). This is certainly implementable w ithin the frame w ork of Live W orld, but w ould be considerably less efficient than the current scheme.

Live W orld

119

Figure 4.17: Illustrating the use of a separate theater to hold prototypes.

The deletion problem is one that is not found in class-based object systems, w here there is no danger that the definition of a class of objects w ill be taken as an element of that class. Some other prototype-based object systems, such as Self (see section 4.9.2) avoid this problem by using static rather than dynamic inheritance. In Self, spinoffs inherit properties from prototype at the time they are created and do not maintain a pointer back to their prototype, so deleting the prototype is not problematic.

4.7.4

Install and Deinstall Protocol

Li v e W orl d d efi n es a n i nsta l l/d e i nsta l l proto c o l o n fra m es. W h e n e v er a fra m e is cre ate d , deleted, or moved it is sent :%install a n d :%deinstall m essages as a p pro pri at e (a m o v e w i l l generate both). M ethods for these messages handle operations such as installing demons for computed slots or creating the graphic representation for actors.

4.7.5

Error Handling

A ny programming environment must be able to deal w ith unexpected conditions. Live W orld utili z es C ommon Lisps condition handling system to provide an error handling facility w ith a box-based interface. W hen an error is detected, it generates a Lisp condition object w hich is then encapsulated into a box. For any type of error, the system can provide speciali z ed error boxes that provide user options or other information.

120

Live W orld

Figure 4.18. An error has occurred in the execution of the trail-rule method, generating the error object no-method-error.

A n e x a m p l e is sh o w n i n t h e f igure . T h e error b o x c o n t a i ns t hre e b u t t o ns t h a t sp e c i f y rest art o p t i o ns. C l i c k i ng t h e create b u t t o n , f o r i n s t a n c e , c a u s e s a m e t h o d o b j e c t o f t h e appropriate name and type to be created, after w hich the user can fill in its slots.

4.8

Some Unresolved Issues

Li v e W orl d i n its c urre nt state h as a fe w sh ortc o m i ngs a n d i n c o nsiste n c i es i n its d esign , w hich are discussed here. Solutions to some of these problems are also discussed in C hapter 6.

4.8.1

Multiple Views of Actors

The w orkings of the theater/stage/cast mechanism is some w hat ad hoc relative to the rest of the user interface metaphor. These boxes have special relationships bet w een each othber that are n ot fo u n d e lse w h ere i n Li v e W orl d a n d are n ot c a p a b l e of b e i ng e x p l a i n e d b y th e b asi c mechanisms of the system. This magical mechanism is motivated by the need to have multiple v i e w s o f a c t ors. T h e y m ust b e c a p a b l e o f b e i ng se e n b o t h as gra p h i cs a n d as stru c t ure d o b j e cts, a n d so th e i nterfa c e go a l of h a v i ng a p erc e i v e d i d e ntity b et w e e n o b j e ct a n d scre e n representation must be relaxed. T h is is n ot a se v ere pro b l e m for th e i nterfa c e; th e re l ati o nsh i p b et w e e n th e v i e w s is n ot h ard to u n d ersta n d . N e v erth e l ess it is a n n o y i ng th at a sp e c i a l m e c h a n ism is re q u ire d i n th is case. Furthermore, the need for multiple vie ws may not be confined to graphic objects, and this

Live W orld

121

suggests th at th e so l uti o n to th e ad hoc-n ess o f t h e t h e a t er m e c h a n ism sh o u l d b e a general mechanism for supporting multiple views. A related issue has to do w ith the need for actors to be able to change their appearance. Live W orld allo ws graphic properties of actors to be changed, but not the general form, w hich is d eterm i n e d b y th e a ctors prototy p e . So m e oth er a ctor-b ase d syste ms (i . e . Re h e arsa l W orl d (Fin z er and G ould 1984)) separate out an objects appearance into a separate object called a costume , w hich can be attached to an actor and easily changed. O ne solution to these problems is to introduce the idea that an object is distinct from its gra p h i c a p p e ara n c e a n d th at it c a n h a v e m u lti p l e a p p e ara n c es. B oth c ostu m es a n d th e d u a l vie ws of actors and boxes can be handled by a more general mechanism. This vie w mechanism m igh t e v e n b e a b l e t o su bsu m e o t h er asp e c ts o f t h e syst e m su c h as c o m p osi t e a c t ors a n d speciali z ed slots. The problem w ith this solution is that it significantly increases the complexity of the system by introducing ne w objects, and it might interfere w ith the feeling that users are manipulating real objects rather than representations of them.

4.8.2

Uniform Interfaces Have a Downside

Live W orlds box w as designed to fulfill many functions w ith a single uniform construct. This m a k es l e arn i ng t h e syst e m e asi er, b ut m a y i m p ose c ert a i n c ogn it i v e p e n a lt i es as w e l l . T h e elements of the Live W orld system appear rather uniform, both in terms of graphic appearance a n d a t t h e f u n c t i o n a l l e v e l . F or i nst a n c e , o b j e c ts a n d sl o ts l o o k t h e sa m et h e y are b o t h boxesand so it is possible, during the course of an interaction, to confuse one for another. T h e a b i l i t y f or b o x es t o h a v e i c o ns t h a t i n d i c a t e t h e ir t y p e or st a t es w as a l a t e a d d i t i o n t o Live W orld and helps ameliorate the uniformity problem. H o w ever, there is still a tension in the design betw een the desire for uniformity and particularity. The deeper issue is one of abstract vs. concrete constructs. The box, w hich is designed to be capable of being a great many different things, is necessarily abstract in comparison w ith, sa y , a b u t t o n t h a t serv es a si ngl e p urp ose a n d h as o n l y o n e o p era t i o n i t su p p orts. W h i l e c o nstru c t i ng a bro a d c l ass o f f u n c t i o ns o u t o f a sm a l l se t o f stru c t ura l e l e m e n ts is e l ega n t , esthetically pleasing, and reduces the number of things to learn, it can also cause difficulties for n o v i c e s ( d i S e ss a 1 9 8 6 ) . T h e d i f f i c u l t y a r i s e s b e c a u s e t h e m i n i m a l e l e g a n t e l e m e n ts a r e necessarily abstracted from the concrete functional goals of the user. In contrast, systems in w hich each component is speciali z ed by an expert for a particular use are less flexible, but they can be carefully designed so that each component is distinguishable, as are, for instance, the various elements of the standard M acintosh user interface (A pple C omputer 1987).

4.8.3

Cloning and Dependent Objects

In the early versions of Live W orld, sensors had to be contained directly w ithin an actor. This caused a problem w hen trying to define libraries of drop-in behaviors. The behaviors w ere dependent upon the presence of the appropriate sensors, so cloning the behavior alone from the library w ould not, by itself, produce the needed behavior. Someho w the behavior needed 122 Live W orld

t o bri ng t h e se nsor a l o ng w i t h i t . A n u m b er o f so l u t i o ns w ere c o nsi d ere d (a n d so m e w ere implemented). This design issue, w hile fairly minor, is typical of many such issues that arise in an environment like Live W orld. G i v e th e b e h a v i or a n :%install m eth o d th at cre ate d th e n e e d e d se nsors. T h e effe ct for th e user w o u l d b e th at c l o n i ng a n age nt w o u l d resu lt n ot o n l y i n th e age nt a p p e ari ng i n th e d est i n a t i o n , b u t a se nsor a p p e ari ng a l o ngsi d e i t . T h is sc h e m e h as t h e pro b l e m t h a t t w o behaviors might try to create t w o different sensors w ith the same name. A nother, more serious problem is that the install mechanism is intended to be belo w the users level of a w areness, meaning that users cannot (easily) write ne w behaviors w ith included sensors. Equip the model behaviors in the library w ith actual sensor objects, that w ould someho w , w hen cloned, migrate up w ards to the proper place w ith the actor. This solves the problem of having to write :%install methods but not the name conflict problem. It also introduces a rather magical new form of object movement to the interface. The third (and best) approach is to modify the implementation of sensors to allo w them to live any w here w ithin an actor rather than requiring them to be directly beneath. This allo ws prototype behaviors to carry their sensors along w ith them in the natural w ay, eliminates the need for migration, and also eliminates the potential for name conflicts. The only disadvantage is that sensors w ill no w no longer be so directly associated w ith their actors (i.e., it is no longer possible to gain access to all of an actors sensors by opening up only the actor).

4.9
4.9.1

Relations to Other Work


Boxer and Logo

Boxer w as a central influence in the design of Live W orld. As explained in section 4.2.3, Live W orld retains Boxers emphasis on the concrete, its use of hierarchical nesting to hide detail a n d pro v i d e a u n iform m e d i u m , a n d its use of a si ngl e stru cture to p erform a m u lti p l i c ity of c o m p u t a t i o n a l a n d i n t erf a c e t asks. Li v e W orl d e x t e n ds B o x ers i d e as b y m a k i ng B o x es i n t o o b j e cts w ith i n h erita n c e re l ati o nsh i ps a n d a m essage-p assi ng l a ngu age , a n d b y pro v i d i ng a direct manipulation interface. B o x ers i nterfa c e is b ase d aro u n d a ge n era l i z ati o n of te xt e d iti ng. W h i l e th e b e n efits of Live W orlds object-orientation and direct manipulation are many, there is at least one advantage to Boxers approach: the text-based model provides for the ordering of the parts w ithin a box, making it easier to express constructs like lists and arrays. Boxer includes a port mechanism that allo ws references across the box hierarchy. A port is rath er l i k e a n a l i as for a b o x th at c a n b e p l a c e d i n a re m ote p art of th e syste m , a n d i n m ost resp e cts fu n cti o ns l i k e th e origi n a l b o x . T h e p ort d isp l a ys th e v a l u e i n th e origi n a l b o x , a n d setti ng th e c o nte nts of th e p ort c h a nges th at of th e origi n a l b o x . Ports are a n a ltern ati v e to referring to remote boxes by names or by complicated access paths. For the most part a facility l i k e th is h as n ot b e e n n e e d e d i n Li v e W orl d . H o w e v er, p orts c a n b e m i m i c k e d i n Li v e W orl d Live W orld 123

usi ng th e prototy p e re l ati o nsh i p . A p ort is j ust a sp i n off w ith a sp e c i a l i z e d :set m e t h o d t h a t changes the value of the original frame rather than the local value. Its some w hat more difficult, thought not impossible, to handle the other operations on frames in a port-like fashion, such as adding annotations. Logo , a d ire c t a n c est or o f B o x er, w as a lso i n f l u e n t i a l i n m a n y w a ys, b u t pri m ari l y a t a conceptual rather than design level (see sections 1.3.3 and 3.3.3). The turtle, of course, derives from Logo.

4.9.2

Self

Self ( U ngar and Smith 1987) is the prototypical prototype-based object-oriented language. Its chief feature is an extremely simple object and inheritance model, w hich makes it easy to teach and implement. From the standpoint of object-oriented programming, Live W orlds (really mostly Framers) major contributions over and above w hat Self provides are in providing slots that are first-class objects, and dynamic inheritance. A nother difference is that in Self, an object ge n era l l y d o es n ot i n h erit v a l u es fro m its prototy p e , b ut fro m a se p arate o b j e ct (c a l l e d th e p are nt). W h i l e th is h as c erta i n a d v a ntages, Fra m ers m eth o d is i n m a n y resp e cts si m p l er to u n d ersta n d , a n d it is e asi er to re prese nt th e i n h erita n c e re l ati o nsh i ps i n a d y n a m i c gra p h i c environment like Live W orld. Se l f h as a n e x p l ora t ory gra p h i c i n t erf a c e ( C h a ng a n d U ngar 1 9 9 3) w h i c h h as m u c h i n c o m m o n w ith Li v e W orl d s i nterfa c e . B oth syste ms e m p h asi z e a n i m ati o n , b ut use it i n v ery different w ays. The Self interface animates its object representations (akin to Live W orlds boxes) in a fashion designed to make them seem real to the user (i.e., w hen a ne w object is made, it d o es n o t si m p l y a p p e ar, b u t s w o o ps i n fro m t h e si d e o f t h e scre e n), b u t t h is a n i m a t i o n is outside the realm of the users control. Live W orld is more concerned w ith allo w ing the user to control the animation of graphic objects, leaving the more abstract, structural representation of objects unanimated.

4.9.3

Alternate Reality Kit

ARK, or the A lternate Reality Kit (Smith 1987), is another environment w ith goals similar to that of Live W orld. In this case the commonality is in providing a lively, reactive feel, and in i n t egra t i ng gra p h i c o b j e c ts w i t h c o m p u t a t i o n a l o b j e c ts. O t h er sh are d pro p ert i es i n c l u d e prototypes (ARKs prototypes w ork more like those of Self), step methods to drive concurrent objects, and a special limbo state (called MetaReality in ARK) for objects in a state of transition. B o t h A RK a n d Re h e arsa l W orl d , as w e l l as m a n y o t h er v isu a l e n v iro n m e n ts, re l y o n a separation of user levels. C omponents are built by sophisticated users, generally outside of the visual environment, w hile more naive users are allo w ed to connect these components together graphically but not to open them up or modify them. Live W orld, on the other hand, tries hard to make every object openable and accessible.

124

Live W orld

4.9.4

Rehearsal World

T h e Re h e arsa l W orl d syst e m (F i n z er a n d G o u l d 1 9 8 4) e x p l ore d t h e use o f t h e a tri c a l metaphors as an interface to an object-oriented programming environment. Rehearsal w orld prese n ts o b j e c ts as p l a y ers w h i c h c o m e i n tro u p es a n d c a n b e m o v e d o n t o st ages , objects are controlled by cues , and putting objects through their paces is, of course, done v i a re h e arsa l , w h i c h i n pra cti c e is a w e a k form of progra m m i ng-b y-d e m o nstrati o n ( C y p h er 1993) in w hich objects can record user actions and play them back on command. Live W orld borro ws from Rehearsal W orld the theatrical metaphor, and the idea of providing a large set of existing players (a troupe) w hich users can use as components and starting points for furth er d e v e l o p m e nt. T h e p urp ose a n d fe e l of th e t w o syste ms a lso h a v e m a n y p o i nts of commonality: both aim to provide a friendly and dynamic w orld w here programming and direct manipulation are integrated. The main differences are Live W orlds unusual object system and its e m p h a s i s o n c o n c u rr e n t r e a c t i v e o b j e c ts . R e h e a rs a l W o r l d s p r o gr a m s , i n c o n tr a st , a r e generally button-driven, that is, driven directly by user actions. Li v e W orl d a lso i n c orp ora t e d a f orm o f re h e arsa l -b ase d progra m m i ng, w h ere o b j e c ts could record a sequence of message sends for later playback. This facility w as not developed very far, ho w ever.

4.9.5

gora

gora (M archini and M elgarejo 1994) is a platform for modeling distributed simulations based on graphic objects, concurrent iterated programs, and communication bet w een them. O n e o f g o r a s m o r e i n n o v a t i v e i d e a s i s t h e n o t i o n o f a communication medium , w h i c h provides a metaphor for broadcast style of inter-actor communication. In this model, any actor can connect itself to one or several communication media. O bjects communicate w ith each o t h er b y se n d i ng m essages t o a m e d i u m w h i c h t h e n re bro a d c asts i t t o t h e o t h er o b j e c ts prese nt. A m e d i u m c a n c orresp o n d t o v ari o us se nsory m o d a l i t i es su c h as v isi o n or sm e l l . T h e v ari o us m e d i a c a n h a v e d iffere nt b e h a v i ors a n d pro p erti es th at d eterm i n e th e d urati o n a n d disposition of messages. M ediums thus take the place of Live W orlds sensors. In Live W orld, sensors compute values obtained directly from the w orld. The sensors themselves are trusted to l o o k o n l y at sl ots th at m a k e se nse gi v e n th e se nsors d esign e d-i n l o c a l ity . H a v i ng m e d i a objects encapsulates this constraint into a separate object. By reifying the idea of a medium, gora prese n ts a n a l t ern a t i v e t o t h e tra d i t i o n a l o n e-t o-o n e i m age o f m essage p assi ng a n d pro v i d es a c o n c e p t u a l b asis f or t h i n k i ng a b o u t o b j e c t i n t era c t i o n i n a v ari e t y o f d i ff ere n t circumstances.

4.9.6

IntelligentPad

IntelligentPad (Tanaka 1993) is a media architecture visually quite similar to Live W orld. T h e b asi c u n i t is t h e p a d , gra p h i c o b j e c ts w h i c h c a n b e gi v e n v ari o us a p p e ara n c es a n d Live W orld 125

b e h a v i ors a n d p ast e d w i t h i n o t h er p a ds t o f orm h i erarc h i c a l stru c t ures. Pa ds w h e n p ast e d establish message-passing links bet w een them. Pads serve as displays, buttons, containers, and can represent complex simulation objects like springs and gears. W hile the pad environment allo ws end users to manipulate and combine given sets of pads, it does not support full programming capabilities. U sers cannot modify the behavior of the basic p a ds n or cre ate n e w k i n ds of o b j e cts. In th is resp e ct its d esign p h i l oso p h y resemb l es th at of Agentsheets (see section 6.2.2).

4.10

Conclusion

I w ish that I hadnt needed to spend the time I did building Live W orld. In fact, I w as both annoyed and some w hat pu z z led that there w as no system like this available alreadyan objectori e nte d syste m c o u p l e d w ith a p o w erfu l u n d erl y i ng l a ngu age , w ith a n i nterfa c e th at c o u l d support multiple moving objects and concrete vie w ing. This seemed like something that should, i n t h is d a y a n d age , b e a lre a d y c o m m erc i a l l y a v a i l a b l e a n d i n t h e h a n ds o f c h i l dre n . T h e absence of such systems is, I think, a reflection of the fact that w e dont have languages that are ori e n t e d t o w ards progra m m i ng i n su c h e n v iro n m e n ts. A n d o f c o urse t h e a bse n c e o f su ita b l e l a ngu ages is i n p art d u e to th e a bse n c e of e n v iro n m e nts! I c h ose to bre a k th is n oc h i c k e n-a n d-n o-egg c y c l e b y b u i l d i ng th e e n v iro n m e nt first, p artl y to a v o i d fa l l i ng i nto th e common language-design trap of elegant languages that cant do anything tangible. Because of this, Live W orld is oriented to w ards agents but not itself based on agents. N onetheless, it has u n i q u e fe atures w h i c h d eri v e fro m th e age nt-b ase d p o i nt of v i e w . W h i l e th e l a ngu age a n d environment may be formally separable, the design values that inform them are the same.

126

Live W orld

Chapter 5

Programming with Agents


Putting the control inside was ratifying what de facto had already happenedthat you had dispensed with G od. But you had taken on a greater, and more harmful, illusion. The illusion of control. That A could do B. But that was false. Completely. N o one can do. Things only happen, A and B are unreal, are names for parts that ought to be inseparable...
Thomas Pynchon, Gravitys Rainbow p34

Earlier chapters sho w ed that the discourse of computation is founded on a diverse set of metaphors, w ith anthropomorphic or animate metaphors playing a particularly central role. This chapter presents a series of agent-based systems and languages that are explicitly designed to exploit animate metaphors. Several implementations of agents w ithin Live W orld are presented here, ranging from extremely simple agents that have only implicit goals, to some w hat more c o m p l e x age nt syste ms th at a l l o w age nts to h a v e e x p l i c it go a ls a n d th us m o n itor th e ir o w n activity, and finally to D ynamic Agents, a system w hich allo ws agents to dynamically create ne w go a ls a n d age nts. T h is syste m is fl e x i b l e e n o ugh to b u i l d age nt syste ms th at o p erate w ith a variety of control structures and can perform a variety of tasks in the problem domains set out in C hapter 1.

5.1

Simple Agent Architectures

In this section w e develop and examine a couple of toy agent architectures that illustrate so m e o f t h e issu es i n v o l v e d i n usi ng age n ts i n a d y n a m i c e n v iro n m e n t . In t h e f irst syst e m , Simple Agents, goals are implicit and agents are simply repeating procedures. Trivial though it is, the Simple Agents system still illustrates some of the issues involved in agent concurrency and c o nfl i ct h a n d l i ng. In th e se c o n d syste m , G o a l A ge nts, age nts are m ore stru cture d a n d h a v e explicit goals that can be used for a variety of purposes. Both systems offer an essentially static agent model, that is, agents are not created or deleted during the course of activity. Systems that allo w for the dynamic creation of agents w ill be the subject of the next section.

5.1.1

Simple Agents

T h e si m p l est form of age nt th at w e w i l l c o nsi d er is esse nti a l l y j ust a pro c e d ure th at c a n arrange for itself to be invoked repeatedly, or in other w ords, a procedure that can be readily c o n v erte d i nto a pro c ess. T h ese age nts h a v e n o e x p l i c it go a ls or d e c l arati v e asp e ct, n or d o they have any convenient w ay to communicate w ith other agents. Their agenthood rests solely w ith their ability to carry out their function independent of outside control. L i v e W o r l d p r o v i d e s a w a y t o t u r n a n y m e t h o d o f z e r o a rg u m e n t s i n t o a n a g e n t b y dro p p i ng i n a n a n i m a (se e se c t i o n 4 . 6 . 1). T h us, t h e Si m p l e A ge n ts syst e m is re a l l y j ust a stra ightfor w ard e xte nsi o n of th e e x isti ng Li v e W orl d m eth o d stru cture . A n i m as are h o o ks for

Figure 5.1: a turtle executing a classic turtle circle using two simple agents, one to go forward, and one to turn by a variable amount.

Live W orlds activity driver, so to understand the action of simple agents in more detail, w e w ill need to look at the anima driver mechanism, and modify it to handle some of the issues raised by agents. The default anima driver is a simple loop w hich calls the function run-animas repeatedly. Each call is considered an anima cycle. This driver is sho w n in Listing 5.1. N ote that this driver ensures that anima-driven agents run in lock-step w ith each other, in the sense that each gets to e x e c u t e e x a c t l y o n c e d u r i n g e a c h c l o c k c y c l e . T h i s f o r m o f c o n c u rr e n c y m a k e s a g e n ts sy n c hro n i z e d b y d e f a u l t , a l l o w i ng t h e m t o b e si m p l er t h a n t h e y w o u l d h a v e t o b e i f t h e y needed to achieve synchroni z ation through explicit constructs. (defun r u n - a n i m a s () (dolist (a *running-animas*) (send a :step)))
Listing 5.1: The very simplest anima driver.

5.1.1.1

Simulating Concurrency

W hen several animas are active, issues of concurrency and conflict can arise. The default anima driver sho w n in Listing 5.1 basically ignores these issues. Each agent simply executes in turn, creating problems of unpredictability and order-dependency. The unpredictability comes from the fact that the ordering of agents in this round-robin execution is arbitrary, so that t w o seemingly identical agent systems might exhibit different behavior if the animas happen to be l iste d i ntern a l l y i n d iffere nt ord ers. A d d iti o n a l l y , th e e x e c uti o n of o n e age nt m a y affe ct th e subsequent action of another. Ideally, all agents w ould execute concurrently, so that the results of one could not affect the other and the results of execution w ould al w ays be predictable. A form of simulated concurrent execution can be accomplished rather easily in Live W orld b y m o d i f y i ng t h e a n i m a dri v er. T h e b asi c i d e a is t h is: a l l e f f e c ts o f age n ts are u l t i m a t e l y expressed as side-effects to the values of boxes. So if all side effects are delayed until the end of an agent cycle, the effects of concurrent execution can be simulated. To do this, the agent

128

Agents

driver needs to be changed. Rather than simply stepping each anima in turn, it needs to operate in t w o phases: one to compute the ne w values, and another to make those ne w values current. T h e a b i l ity to a n n otate b o x es m a k es th is si m p l e to i m p l e m e nt. A l l th at is n e c essary is to modify the global :set method so that instead of actually altering the value of a box, it w ill store the ne w value in an annotation on the box. Then this action is made conditional on the value of a variable *phase*. The master anima driver no w w ill step all animas w ith *phase* se t t o 1 , t h e n go b a c k a n d u p d ate th e a ctu a l v a l u es of a n y c h a nge d b o x es. T h e i m p l e m e ntati o n of th is is sho w n in Listing 5.2. This code basically says that w hen *phase* is 1 , th e n e w v a l u e is store d on the annotation named :new-value of the given box, and the box is saved in a global list for later processing in phase 2. If *phase* is 2 , a n orm a l set is d o n e usi ng set-slot-1, the primitive f u n c t i o n f or c h a ngi ng a sl o t s v a l u e . T h e a n i m a dri v er is c h a nge d so t h a t i t dri v es t h e t w o phases alternately. (defvar * p h a s e * 0) (defvar * p h a s e 2 - b o x e s *) (def-lw-method : s e t # / g l o b a l (new-value) (case *phase* (1 (progn ;; use lower-level mechanism to save new value in annotation (set-slot-1 (getb-force self :new-value) new-value) (pushnew self *phase2-boxes*) new-value)) ; return the new value ((0 2) (set-slot-1 self new-value)))) (defun r u n - a n i m a s () (let ((*phase* 1) (*phase2-boxes* nil)) (dolist (a *running-animas*) (send a :step)) (setf *phase* 2) (dolist (f *phase2-boxes*) (send f :set (slot f :new-value)))))
Listing 5.2: two-phase slot setting in Simple Agents.

In a d d iti o n to pro p erl y si m u l ati ng c o n c urre n c y , th is t w o-p h ase-c l o c k te c h n i q u e h as a n additional advantage and one severe dra w back. The advantage is that it also gives us the hooks to deal w ith conflict in a systematic w ay, a topic dealt w ith in the next section. The dra w back is that it significantly changes the semantics of the languages. U nder the two-phase clock regime, if a method sets a slot value and then uses that slot value in further computation, it w ill no longer o bta i n th e right a ns w er. T h is seri o us pro b l e m is so m e w h at offset b y th e fa ct th at age nts are usually quite simple and rarely need to examine the value of a slot that has been set in the same cycle.

5.1.1.2

Handling Conflict

D elaying the operation of :set to achieve concurrency also gives some leverage for dealing w ith conflict. A conflict occurs w hen t w o or more agents try to specify different values for the sa m e sl ot. If th is h a p p e ns u n d er th e syste m as d escri b e d a b o v e , w e w i l l aga i n suffer ord erdependencies among the agents (since the last agent to run during phase 1 w ill be the one that Agents 129

ends up supplying the ne w value). To deal w ith this, w e can extend the above scheme to keep track of all th e :sets done to a slot during the course of a single agent cycle (during phase 1), and then during phase 2, figure out for each slot w hich value w ill prevail. (def-lw-method : s e t # / g l o b a l (new-value) (case *phase* (1 (progn (push (list new-value *agent*) (slot self :proposals)) (pushnew self *phase2-boxes*))) ((0 2) (set-slot-1 self new-value)))) (defun r u n - a n i m a s () (let ((*phase* 1) (*phase2-boxes* nil)) (dolist (a *running-animas*) (let ((*agent* (box-home a))) (send a :step))) (setf *phase* 2) (dolist (f *phase2-boxes*) (send f :resolve-set)))) (def-lw-method :r e s o l v e - s e t # / g l o b a l () (let ((proposals (slot-or-nil self :proposals))) (case (length proposals) (0 (error "No proposals for ~A" self)) (1 (send self :set (caar proposals))) (t (send self :resolve-conflict))) (setf (slot self :proposals) nil))) (def-lw-method : r e s o l v e - c o n f l i c t # / g l o b a l () (let* ((proposals (slot self :proposals)) (best (maximize proposals :key #'(lambda (proposal) (let ((agent (cadr proposal))) (or (ask-if agent :urgency) 0)))))) (send self :set (car best))))
Listing 5.3: Conflict handling in Simple Agents.

T o m a k e t h is w ork , w e n e e d so m e w a y t o arb i tra t e b e t w e e n c o n f l i c t i ng age n ts. T h is is accomplished by equipping them w ith an :urgency sl o t . W h e n a n age n t se ts a sl o t s v a l u e , a pointer to the agent gets saved along w ith the proposed ne w value, so the phase 2 code can compare the urgency values of conflicting agents (w e assume that no agent sets the same slot twice on the same cycle). In this version of the system, during phase 1 each slot collects pro p osa ls for w h at its n e w v a l u e s h o u l d b e . Pr o p o s a l s c o n s i st o f t h e n e w v a l u e a n d a p o i n t e r t o t h e a g e n t t h a t i s responsible for suggesting it. D uring phase 2, the proposals are evaluated and resolved by the :resolve-set a n d :resolve-conflict m e t h o d s . maximize is a uti l ity fu n cti o n th at w i l l se l e ct a n element from a list (in this case the list of proposals) that yields the maximum value of a key function (in this case, the urgency of the agent that generated the proposal).The code above is not as efficient as it could be, since there is no real need to store all the proposals and find the 130 Agents

maximum later, but w e w ill see that keeping the proposals around w ill be useful for generating user displays and for establishing alternative conflict resolution strategies. Since urgency values are just slots, they can be dynamically updated by additional agents (for instance, the urgency of a find-food agent might increase w ith time and decrease w hen food w as found).

Figure 5.2: Three simple agents, with urgency.

A n example w here agents conflict is sho w n in Figure 5.2. This is the same as the previous example w ith the addition of a ne w agent, bounce-agent, a se nsor, a n d a n e w re cta ngl e a ctor. Bounce-agent checks to see if the turtle overlaps this rectangle, and if so it makes it back up a n d t urn aro u n d . T h e :urgency sl ot of b o u n c e-age nt is 1 , a l l o w i ng it to su p erse d e th e oth er age n ts, w h i c h h a v e t h e d e f a u l t urge n c y v a l u e o f 0 . T h e resu l t is t h a t t h e n orm a l c irc l i ng behavior prevails except w hen the turtle is in contact w ith the rectangle, w hen bounce-agent takes charge. A fe w other things to note about this example: it is obviously necessary for bounce-agent to move the turtle as w ell as changing its heading, since otherw ise, the turtle w ould still overlap the rectangle and the :turn-right a cti o n w o u l d b e re p e ate d o n th e n e xt c y c l e. Less o b v i o us is the fact that the tw o asks in bounce-agent are effectively done in parallel, because of the delay b u i l t i n t o sl o t-se tt i ng i n t h is age n t syst e m . T h a t is w h y t h e t urt l e m ust b a c k u p ra t h er t h a n s i m p l y t u r n i n g a r o u n d a n d t h e n g o i n g f o r w a r d . Ess e n t i a l l y , n o s e q u e n t i a l l y - d e p e n d e n t operations can appear inside the action of a single agent w hen the t w o-phase-clock method is used. The t w o asks can appear in either order w ithout changing the effect of the agent. N ote th at th is m eth o d of c o nfl i ct reso l uti o n c a n resu lt i n p art of a n age nts a cti o n b e i ng carried out w hile another part is overridden by another agent w ith a higher urgency. In other w ords, c o nfl i cts are reso l v e d at th e sl ot l e v e l rath er th a n at th e age nt l e v e l . W h eth er th is is desirable or not depends on ho w one interprets the anthropomorphic metaphor. A partiallysuccessful action might be interpreted as a compromise. Agents 131

(def-lw-method : r e s o l v e - c o n f l i c t # ^ / c a s t / t u r t l e / h e a d i n g () (let* ((proposals (slot self :proposals)) (average (/ (reduce #'+ proposals :key #'car) (length proposals)))) (send self :set average)))
Listing 5.4: An alternative conflict resolution method.

A lso n o t e t h a t o t h er m e t h o ds o f reso l v i ng a c o n f l i c t are p ossi b l e . F or i nst a n c e , f or a numerical slot like heading, the values of all proposals could be averaged rather then selecting o n e of th e m . T h ese a ltern ate reso l uti o n m eth o ds c a n b e i m p l e m e nte d o n a p er-sl ot b asis b y specializing the :resolve-conflict method. Listing 4 sho ws an example in w hich proposals to set the heading of any turtle will be averaged.

5.1.1.3

Presenting Conflict Situations to the User

T h e a b i l i t y o f t h e si m p l e age n t syst e m t o c a p t ure c o n f l i c t c a n b e e x p l o i t e d t o ge n era t e d isp l a ys f or t h e user. T h is a l l o w s t h e user t o sp e c i f y t h e reso l u t i o n t o c o n f l i c ts, a n d c a n automatically generate agent urgency values.

Figure 5.3: Presenting the user with an agent conflict situation.

A n example of this is sho w n in Figure 5.3. In bet w een phase 1, w hen each agent has made its attempt to set slots, and phase 2, w hen actions must be selected and performed, the system surveys the changed slots for agent conflicts. If conflicts are found that cannot be arbitrated by t h e u rg e n c y m e c h a n i s m ( b e c a u s e t h e a g e n ts i n v o l v e d h a v e e q u a l u rg e n c y ) , t h e s y st e m generates a display illustrating the effects of each agent and presenting the choice of agents to the user. Each agent generates a corresponding box containing copies of the slots it effects, and a thumbnail snapshot of the w orld as it w ould be if that agent alone w as allo w ed to execute. Thumbnails are based on a special kind of slot w hose value is a picture. In this case, the conflict is a complex one: bounce-agent is i n c o nfl i ct w ith turn-agent o v e r t h e heading sl o t , a n d i n conflict with fd-agent over the xpos and ypos slots. The user then has to select some combination of agents that avoids conflicts. In the figure, bounce-agent c o u l d b e s e l e c t e d b y i t s e l f , o r turn-agent a n d fd-agent c o u l d b e s e l e c t e d 132 Agents

together, since they dont conflict w ith each other. The system can then adjust the urgencies of the selected agents so that this particular conflict will be arbitrated the same way automatically in the future. In a more complicated system (for instance, one w ith multiple active actors) there are likely to be multiple sets of conflicting agents. This situation could be handled w ith multiple sets of thumbnails to choose among, although this could get confusing rather quickly.

5.1.1.4

Behavior Libraries

The simpler agent systems lend themselves particularly w ell to a mode of programming in w hich behaviors are selected from a library and cloned and dropped into an actor. A n example o f su c h a l i brary is sh o w n i n F igure 5 . 4 . T h is l i brary c o n t a i ns b o t h si m p l e age n ts a n d go a l age nts ( w h i c h are d escri b e d b e l o w ). Li brary age nts ge n era l l y refer to oth er o b j e cts thro ugh relative boxpath references (see 4.5.4) so that their clones w ill w ork properly in any context. A d d iti o n a l l y , l i brary age nts m a y refer to sl ots of th e ir o w n , w h i c h a l l o w s th e m to b e parameteri z ed (see behavior get-to in the figure for an example).

Figure 5.4: A library containing a variety of drop-in behaviors.

Agents

133

Figure 5.5: A library of objects containing agents.

F igure 5 . 5 i l l ustrates h o w age nts c a n b e e m b e d d e d i nto a l i brary of oth er o b j e cts. T h is l i brary c o n t a i ns a v ari e t y o f t urt l es a n d p a t c h es (a c t or o b j e c ts t h a t are st a t i o n ary b u t d o so m eth i ng w h e n a n oth er o b j e ct c o nta cts th e m). Velocity-turtle, f o r e x a m p l e , h a s a s i m p l e agent, f d, t h a t gi v es i t a c o nst a n t f or w ard v e l o c i t y , a n d a n o t h er G o a l A ge n t (se e t h e n e x t section) that implements the wrapping behavior seen in most Logo environments. The soundpatch object plays a sound w hen another object passes over it (the sound, like the agent that generates the behavior, is an internal annotation to the patch object itself). The other patches, curve-patch and slow-patch, w ill change the motion of turtles that pass over them.

5.1.2

Goal Agents

This section describes a slightly more sophisticated form of agent-based programming called G oal Agents. This system illustrates several additional aspects of agents. Specifically, it sho ws h o w a g e n ts c a n b e b a s e d a r o u n d g o a l s , a n d h o w t h i s f u rt h e r e n a b l e s t h e u s e o f s i m p l e anthropomorphic metaphors to illustrate agent activity. A go a l-age n t c o nsists o f a b o x w h ose v a l u e is a go a l i n t h e f o r m o f a L i s p p r e d i c a t e expression. The agents task is to keep this goal satisfied. In addition to the goal itself, the box display includes an icon that indicates the state of the agent. A satisfied goal displays a smiley face icon, w hile an unsatisfied one produces a fro w n. G oal agents have a fe w other properties w h i c h are store d as i ntern a l a n n otati o ns. O f th ese , th e m ost sign ifi c a nt is th e action , w h i c h specifies ho w the agent is to attempt to satisfy its goal. In Figure 5.6 w e see an instance of a satisfied goal agent inside an actor ( O pus). The agents go a l is th at th e o v erl a p-se nsor h a v e a v a l u e of :no, or i n o t h er w ords t h a t i ts p are n t a c t or should not be in contact w ith any other actor.

134

Agents

Figure 5.6: A satisfied goal-agent.

In Figure 5.7 the turtle has moved, causing the agent to become unsatisfied, as indicated by th e c h a nge d i c o n . T h e age nt h as b e e n o p e n e d to re v e a l th e a cti o n w ith i n . T h is a cti o n w i l l execute repeatedly until the agent is once again satisfied. In this case the action moves the actor 20 pixels in a randomly chosen direction, so eventually (assuming the turtle is static) O pus w ill elude the turtle and the goal will once again be satisfied.

Figure 5.7: The goal-agent, unsatisfied and open.

G oal-agents act some w hat like an iterative construct of a procedural language, such as the repeat...until construct of Pascal, running the action until the test is satisfied. G oal Agents are also some w hat similar to situation/action rules, w ith the difference that instead of specifying a triggering condition and action, a goal-agent contains the negation of the triggering condition as its go a l , a n d a cts o n l y w h e n th is go a l is u nsatisfi e d , or as th e eth o l ogist H i n d e p ut it, T h e concept of a goal refers al w ays to a situation w hich brings a sequence of behaviour to an end. ( H inde 1978, p. 624). Its w orth w h i l e n oti ng th at th is age nt (a n d a l l th e oth er ty p es of age nts prese nte d i n th is chapter) operate concurrently w ith user interaction. For example, the above agent allo ws the user to chase O pus around by dragging another object. It is this property, the ability to interact with running agent programs, that gives Live W orld its feeling of liveliness. G o a l - a g e n t s c a n a l s o h a v e p r e c o n d i t i o n , u rg e n c y , a n d s a t i s f i e d - a c t i o n s l o t s . T h e precondition sl o t c o n t a i ns a n o t h er pre d i c a t e a n d d e t erm i n es w h e t h er or n o t t h e age n t is Agents 135

allowed to run its action. Satisfied-action is an action to take if the goal is satisfied , as o p p ose d to the normal action w hich is done if the goal is unsatisfied. The satisfied-action slot is included mainly for the sake of symmetry, although since it is some w hat in conflict w ith the goal-seeking metaphor its use is discouraged. (def-lw-method : s t e p # / g o a l - a g e n t () (if (ask self :precondition) (if (ask-self self) ; are we satisfied? (progn (ask self :satisfied-action) (setf (ask self :icon) *smile-icon*)) (progn (ask self :action) (setf (ask self :icon) *frown-icon*)))))
Listing 5.5: Step method for goal agents.

G oal Agents (as described so far) can be implemented by equipping a Live W orld object w ith the :step method sho w n in Listing 5.5. Implementing goal-agents also requires installing defaults for th e sl ots i n v o l v e d , th at is, go a l age nts m ust h a v e a d efa u lt :satisfied-action m e t h o d t h a t d o es n o t h i ng, a n d a d e f a u l t :precondition t h a t i s a l w a y s tr u e . S o m e o t h e r m a p p i n gs i n t o emotional icons are possible; for instance, an agent w hose goal w as unsatisfied but could not act because of a precondition might appear as frustrated. As described so far G oal Agents dont really have much more computational po w er than Simple Agents, since simple agents can simulate the goal/precondition/action mechanism of goal age n ts w i t h ord i n ary Lisp c o n d i t i o n a ls. H o w e v er, G o a l A ge n ts pro v i d e so m e a d d i t i o n a l stru cture , in that the separate parts of the conditional are no w separate objects and can thus be accessed separately. This means that the system no w has the ability to kno w more about the state of agents. This property is w hat enables the anthropomorphic icon display. It also enables some alternative control strategies. Agents can test the satisfaction condition of other agents, and conflict resolution strategies can be used that take into account the kno w ledge about w hich age nts n e e d to ru n , b ase d o n th e state of th e ir go a ls. T h is p erm its age nts to b e arra nge d i n sequences, albeit a w k w ardly (see the next section). A useful v aria nt of goal agents can be ma de by re placing the goa l w ith a condition. Th e result is an if-then-agent , w hich consists of three clauses corresponding to the usual parts of a conditional statement: if, then, and else (see section 5.4.1 for an example). Sometimes this is a more natural w ay to formulate an agent, but because it is not based on a goal it is less amenable to anthropomorphi z ation.

5.1.3

A Comparison: Teleo-Reactive Programming

It is instructive to compare G oal Agents w ith other goal-based formalisms for controlling action. The teleo-reactive program formalism ( N ilsson 1994) w as developed to address one of the same issues that motivated Live W orld: the fact that sequential programming is not al w ays su ite d to th e c o ntro l of age nts th at are i n a c o nti n u o us re l ati o nsh i p w ith th e ir e n v iro n m e nt. O t h er l a ngu ages a t t h is l e v e l i n c l u d e G A PPS (K a e l b l i ng 1 9 8 8), C h a p m a n s c irc u i t-b ase d architecture (C hapman 1991), and universal plans (Schoppers 1987).

136

Agents

The teleo-reactive program formalism is particularly simple to understand. A teleo-reactive progra m c o nsists of a n ord ere d set of ru l es, rath er l i k e pro d u cti o n ru l es. U n l i k e tra d iti o n a l production systems, ho w ever, actions are not discrete events (such as adding a token to a list) b ut d urati v e a cti o ns l i k e move . D ura t i v e a c t i o ns p ersist as l o ng as t h e triggeri ng c o n d i t i o n remains the first satisfied condition in the program. N ilsson suggests thinking of the program in t erms o f a c irc u i t , w h i c h is c o nst a n t l y se nsi ng t h e w orl d a n d t urn i ng o n a sp e c i f i c a c t i o n . Equivalently, one can think of the T-R program as being called repeatedly in a loop w hose cycle time is short compared w ith the typical length of time of actions. Rules are tested in order until o n e o f t h e l e ft-h a n d si d es is tru e , a n d w h e n o n e is f o u n d i ts righ t-h a n d si d e a c t i o n w i l l b e executed. Then the process is repeated. For instance, here is a sample program (from N ilsson) that is intended to get the actor to navigate to a bar and grab it: is-grabbing at-bar-center & facing-bar on-bar-midline & facing-bar on-bar-midline facing-midline-zone T nil grab-bar move rotate move rotate

The equivalent program in Lisp w ould be something like this, w ith the understanding that the program is enclosed in a rapidly-repeating loop: (if is-grabbing nil (if (and at-bar-center facing-bar) grab-bar (if (and on-bar-midline facing bar) rotate (if ... W hile this language is rather simple, there are a fe w nonintuitive peculiarities about it. O ne thing to note is that actions are not directly associated w ith their goals. Instead, the action of ru l e n is i n t e n d e d t o a c h i e v e t h e go a l o f ru l e n-1 . A n o t h er is t h a t c o nsi d ere d as a p l a n f or action, it reads back w ards: the last action to be performed, grab-bar, comes first. T o e x p r e ss t h e e q u i v a l e n t p r o gr a m w i t h G o a l A g e n t s r e q u i r e s c r e a t i n g a n a g e n t corresponding to each rule as follo ws (the notation G n is short for agent n s goal is satisfied):

n
5 . 5 . 5 . 5 . 5 .

goal
is-grabbing at-bar-center & facing-bar on-bar-midline & facing-bar on-bar-midline facing-midline-zone

action
grab-bar move rotate move rotate

precondition
G2 G3 & ~G1 G4 & ~ G1 & ~G2 G5 & ~ G1 & ~ G2 & ~G3 T & ~ G1 & ~ G2 & ~ G3 & ~G4

Table 5.1: A teleo-reactive program expressed in goal agents.

Agents

137

This transformation makes for a more natural modularity (actions are associated w ith the goals they achieve) but necessitates explicit preconditions, rather than having them be implicit in the order of productions. There is no simple w ay to express any ordering of the goals. O n e pro b l e m w i t h t h is is t h a t t h e pre c o n d i t i o ns ge t ra t h er c o m p l i c a t e d f or l o ng a c t i o n chains. Agent n has to check that agent n + 1 has been satisfied a n d check that all agents 1... n -1 have not been satisfied! The reason for this is our refusal to have any sort of central arbitrator or seriali z er that decides w hich agent should run. Instead w e w ant each agent to figure out for itself if it is applicable, but that means that each agent has to kno w about all the other agents involved that come before it in the sequence. This is hardly modular.

Figure 5.8: A teleo-reactive program expressed as G oal Agents. The long visible sensor of the ant is the facing-midline-zone sensor; other predicates are implemented with overlap-sensors. The bar is the thick rectangle, the bar midline is visible as a guideline.

The G oal Agents system thus provides a richer w ay to allo w agents to interact than does Simple Agents, but still does not make it very natural to talk about sequences of action. This issue (and others) are addressed by D ynamic Agents.

138

Agents

5.2

Dynamic Agents

T h e a g e n t - b a s e d p r o gr a m m i n g s y s t e m s i n t r o d u c e d s o f a r a r e q u i t e l i m i t e d i n t h e i r expressive po w er. W hile agents can pursue goals, they are limited to a single fixed method for achieving them. Agent systems have fixed sets of agents and cannot readily modify their goals d uri ng e x e c uti o n . T h ere is n o e asy w a y to sp e c ify se q u e n c es of a cti o n or l ists of go a ls to b e achieved sequentially. This essentially means that actors driven by simple agent systems are limited to a single fixed response to a given situation. D ynamic Agents ( D A) w as designed to overcome some of these limitations, and is the most po w erful agent language implemented w ithin Live W orld. In contrast to earlier systems in w hich agents w ere basically static entities, in D ynamic Agents, ne w goals can be created on the fly and agents created to reali z e them. As in G oal Agents, agents are responsible for a single goal or task. But to carry out their task, they can create ne w tasks w hich in turn results in the creation of ne w , subordinate agents. The agents in a D A system thus form a hierarchy, but a hierarchy that can dynamically change over time. Imagine an agent as a person. It has a job to do, w hich can involve either keeping a goal satisfied or carrying out an action. It is created and activated by its superior, but otherw ise acts a u t o n o m o u s l y . Its a c t i o n s c a n c o n s i st o f d i r e c t c h a n g e s t o t h e w o r l d , o r i t c a n r e c r u i t subordinate agents to pursue subtasks that contribute to its o w n success. I n t e r m s o f t h e a n t h r o p o m o r p h i c m e t a p h o r , t h e h i e r a r c h y c o n s i sts o f m a n a g e rs a n d w orkers. M anagers can have goals, w hich they monitor but take no direct action to achieve. Inste a d th e y cre ate a n d su p erv ise th e a cti v ity of oth er age nts. W ork er age nts a ctu a l l y m a k e changes to the w orld. M anagers have some flexibility in the manner in w hich they activate their su b ord i n ates. F or e x a m p l e , a n age nt to sta c k b l o c ks m ight h a v e a su b ord i n ate i n c h arge of finding blocks, another in charge of moving the hand to the block, another to grasp the block, another to move the hand so that the block is on top of the stack, and another to release the block from the hand. This agent w ould w ant to activate its subagents sequentially and in a fixed order. A n agent w hich maintains a set of graphic constraints w ould have a subagent for each constraint, but w ould typically not care about the order in w hich they w ere achieved. It w ould, ho w ever, need to make sure that one agent did not interfere w ith the goals of another agent. The language for specifying agents has to be flexible enough to accommodate these different sorts of managers.

Agents

139

little-person model

Tinbergen model reactive drive centers

dynamic agents task-driven agents

basic model units

procedural little people (procedure invocations) dynamic n o su p p ort executing procedures LPs ask other LPs to perform procedures no model one LP per procedure call none

persistence goals action communi cation conflict multiple methods failure handling state

static implicit releasing energy passing energy

dynamic explicit performing tasks agents post tasks w hich generate ne w agents slot conflict and goal conflict can have multiple agents for a task agents can fail, allowing other methods to be tried dormant,[un]satisfied, failed, succeeded, determination multiple active agents

intra-layer inhibition one unit per behavior

none (except repetition)

running, dormant, waiting exactly one LP active at a time chief LP initiates activity primitive procedures

blocked; activation energy one active unit per layer

concurrency

to p

top-center

G od agent organi z es activity

bottom

motor units

w orker agents

Table 5.2: Programming models compared.

T w o earlier forms of hierarchical control system have influenced the design of the agent hierarchy underlying D A . The first of these is the hierarchy of procedure calls generated by the activity of an interpreter for a procedural programming language, and the little-person metaphor sometimes used to illustrate it (see 3.3.2.1). The notion of a society of experts performing tasks o n d e m a n d is reta i n e d , b ut e xte n d e d i n se v era l sign ifi c a nt w a ys. A l ittl e p erso n e x e c utes a procedure once then disappears, but a dynamic agent is a persistent entity. This allo ws agents to have significantly greater capabilities. Agents operate in parallel, they can monitor goals as w ell as carry out procedures, and there can be more than one agent created to accomplish a 140 Agents

given task. Because agents can have goals, there is a basis in the model for thinking of agents as satisfied or unsatisfied, successful or failed, and for handling conflict. T h e o t h er m a j or m o d e l f or D A s h i erarc h y o f age n ts is T i n b erge n s m o d e l o f a n i m a l behavior control systems (Tinbergen 1951), and computational attempts to reali z e it such as (Tra v ers 1 9 8 8) a n d (T yrre l l 1 9 9 3). Li k e T i n b erge n s dri v e u n i ts a n d re l e asi ng m e c h a n isms, agents in a D A hierarchy are constantly checking their state against the w orld, and so can take control w hen necessary, possibly overriding other agents. This flexibility is not found in the st a n d ard pro c e d ura l m o d e ls o f progra m m i ng. In so m e se nse , D A c a n b e u n d erst o o d as a n attempt to integrate the reactive hierarchies of Tinbergen with the formal simplicity and power of the procedural model. T a b l e 5 . 2 sh o w s a p o i n t-b y-p o i n t c o m p ariso n o f d y n a m i c age n ts w i t h t h e l i tt l e-p erso n m o d e l o f pro c e d ura l progra m m i ng a n d T i n b erge n s m o d e l o f a n i m a l b e h a v i or. T h e b asi c metaphor behind procedural programming is seriali z ed follo w ing of instruction, w hile in the Tinbergen model it is reacting to environmental stimuli. D ynamic Agents attempts to integrate these by basing its model of an agent on tasks w hich can specify both sequences to execute and goals to be achieved. From the LP model, D A takes the idea that agents can dynamically cre ate su b age nts as p art of th e ir a cti v ity . Fro m th e T i n b erge n m o d e l , D A ta k es th e i d e a th at a g e n t s w h i l e a rr a n g e d i n a h i e r a r c h y h a v e a m e a s u r e o f a u t o n o m o u s c o n t r o l , c a n r u n concurrently, can constantly check on the state of the w orld and can sei z e control from each oth er. T h e p ossi b i l ity of c o m b i n i ng th e b est fe atures of th ese t w o rath er d iffere nt m o d e ls of control w as the inspiration behind the design of D ynamic Agents.

5.2.1

Overview

This section presents a technical overvie w of the structures, concepts, and operation of the D ynamic Agents system. The D A system w orks by building a hierarchy of agents (see Figure 5.8) based on user specified tasks. In a cyclic process, the agents are activated and may take a cti o ns w h i c h c o nsist of e ith er a d ire ct a cti o n w h i c h c h a nges th e w orl d , or th e cre ati o n of subtasks and subagents. Agents may come into conflict by attempting to perform incompatible actions or by interfering w ith another agents goal. The system attempts to resolve conflicts and schedule agent activity in such a w ay as to satisfy as many agents as possible. Each agent is in charge of a single task, w hich determines its type and behavior. Primitive t asks specify a direct action to take in the w orld. O ther kinds of tasks can specify goals to be a c h i e v e d , or c o m p l e x pro c e d ures t o p erf orm t h a t i n v o k e a n u m b er o f su b t asks. T asks are sp e c ifi e d usi ng a v o c a b u l ary of b u i lt-i n c o ntro l c o nstru cts a n d user-d efi n e d te m p l ates. F or i n s t a n c e a n and t a s k s p e c i f i e s a n u m b e r o f s u b t a s k s , a l l o f w h i c h m u s t b e s a t i s f i e d simultaneously for the and task to b e satisfi e d . A script task , o n th e oth er h a n d , a cti v ates its subtasks sequentially. Agents have a numerical determination value w hich corresponds roughly to ho w hard they try to take their action in the face of conflicts. A t th e to p of th e age nt h i erarc h y is a n age nt w ith a sp e c i a l task c a l l e d (god). T h is age n t serves to organi z e the activity of the next lo w est layer of agents, w hich embody top-level tasks.

Agents

141

(god)

This agent supervises activity.

top task

top task Satisfied agents don't need to template create subordinates

top task

These agents handle top-level tasks.

template

template Templates specify subordinate agents.

task task

Worker agents take action in the world.

prim. task

prim. task

Figure 5.9: An agent hierarchy.

These tasks can be specified explicitly by the user in task objects, or arise implicitly from user actions. They can also be part of objects in a simulation or library. Agents can be in a number of different states. Agents w hose task is a goal can be satisfied o r unsatisfied . A g e n ts t h a t c a rr y o u t a n a c t i o n c a n b e successful , failed, o r waiting f o r a subordinate. W orker agents succeed w hen they are able to carry out their action. They can fail f or a v ari e t y o f re aso ns, i n c l u d i ng c o m i ng i n t o c o n f l i c t w i t h o t h er age n ts. M a n ager age n ts generally succeed or fail based on the success or failure of their subordinates. For example, the failure of a single subordinate w ill cause an and agent to fail, w hile a similar subordinate failure under an or agent w ill instead cause a different subordinate to be activated. The agent interpreter begins its process of activating agents from the top agent and w orks its w ay do w n w ards. At each level, the task of an agent determines w hich subagents, if any, w ill become activated. For instance, a script agent w ill only activate one subagent, w hereas an and agent w ill activate all of its subagents. A n agent that is satisfied needs to take no action and w ill not activate any subagents. Ev e ntu a l l y th is pro c ess b otto ms o ut i n w ork er age nts w h o atte m pt to e x e c ute pri m iti v e tasks. The actions of these agents are deferred so that concurrency and conflict resolution can w ork right, in a manner very similar to that used in simple agents (see 5.1.1.2). The conflicts are resolved using the determination values of the agents involved. Agents that prevail (or are not i n c o nfl i ct) are m ark e d as su c c essfu l , w h i l e l osers are m ark e d as fa i l e d . Su c c ess a n d fa i l ure propagate up w ards in a manner determined by the tasks involved. The successful actions are 142 Agents

reali z ed, that is, their proposed changes for Live W orld slots become the current values. This may cause other agents to become unsatisfied. Agent determination values can change as other agents fail and succeed, so that conflict resolution is not permanentthe balance of po w er can shift. This cycle is repeated either indefinitely or until all top-level tasks are satisfied.

5.2.2

Structures

T h is se c t i o n e x p l a i ns t h e m a j or stru c t ures use d i n d y n a m i c age n ts: t asks, age n ts, a n d t e m p l a t es. T o bri e f l y su m m ari z e t h e re l a t i o nsh i p b e t w e e n t h ese t hre e se p ara t e b u t c l ose l y related concepts: A task is an expression that specifies a job to do; An agent is a structure created to carry out a particular task; A template is a structure that specifies, for some set of tasks, ho w to create agents to carry them out.

Templates extend the kinds of tasks that can be handled and thus in some sense constitute th e progra m sp e c ifi c ati o n of a n age nt syste m . T o e xte n d th is ro ugh a n a l ogy w ith tra d iti o n a l pro c e d ura l progra m m i ng, t asks c orresp o n d t o pro c e d ure c a l ls, w h i l e age n ts c orresp o n d (ro ugh l y) t o t h e st a c k fra m es or o t h er i n t ern a l stru c t ures use d t o k e e p tra c k o f pro c e d ure i n v o c a t i o n s . H o w e v e r , a g e n ts a r e l o n g e r- l i v e d , k e e p m o r e i n f o r m a t i o n , a n d h a v e m o r e complicated associated control mechanisms than stack frames.

5.2.2.1

Tasks

A task is a n e x pressi o n i n Lisp sy nta x th at re prese nts e ith er a go a l to b e a c h i e v e d or a n a c t i o n t o b e t a k e n . W h i l e t asks are i n t h e f orm o f Lisp stru c t ures, t h e y are n o t (i n ge n era l) interpreted as Lisp expressions. The first element of a task specifies the general type of task, and may be a special symbol such as and o r do , or th e n ame of a d oma i n task . Be c a use tasks and agents are closely coupled, w e w ill use the terminology for tasks and agents interchangeably (for instance, w e might refer to the type of agent, w hich is simply the type of its task). There are a number of different general classes of task:

goals a r e t a s k s t h a t h a v e a n i n t e r p r e t a t i o n a s a p r e d i c a t e ( i n o t h e r w o r d s , t h e y a r e satisfiable. Some special tasks (such as and-type tasks) are also goals, and tasks that are in the form of user or system-defined predicates are also goals. actions are tasks that are not predicates. primitive tasks are action tasks that take direct action in the w orld. manager tasks i n c l u d e a l l n o n-pri m iti v e tasks. A ge nts w ith m a n ager tasks ta k e n o d ire ct action on the w orld. Instead they specify and control some number of subordinate agents. special tasks are m a n ager t asks w h ose t y p e is a m e m b er o f t h e v o c a b u l ary o f c o n tro l c o nstru cts prese nt e d b e l o w . T h e y ge n erat e t h e ir su b ord i n at e age nts a c c ord i ng t o ru l es presented in section 5.2.4. In general, special tasks have one or many subforms, each of w hich is a task and generates a single subordinate agent.

Agents

143

domain tasks are manager tasks w ith a user-defined, domain-dependent type. D omain tasks generate subagents according to templates that match the task.

T o su m m ari z e: tasks c a n b e sp l it a l o ng se v era l d i m e nsi o ns i nto d isj o i nt p a irs of c l asses. G o a ls a n d a c t i o ns are o n e su c h p a ir, as are m a n ager a n d pri m i t i v e t asks; a n d sp e c i a l a n d domain tasks. For instance, an and task is a special task, a goal, and a manager task. So m e sa m p l e tasks are prese nte d h ere . M ore d eta i l e d e x a m p l es m a y b e fo u n d l ater (se e especially section 5.4). (= #^/rect/xsiz #^/rect/ysiz) This task is a goal since it has a predicate value. The task it denotes is to keep the values of t w o slots equal (it ensures that the #/rect object is a square). A n agent for this task w ould take no action if the task w as satisfied. If it w as unsatisfied, the agent w ould create subagents to try to achieve satisfaction. (go-to #^/ant #^/food-3) This is a user-defined goal task. The goal is satisfied w hen the ant is in contact w ith food-3, a n d w h e n u nsatisfi e d w i l l cre ate su b age nts th at w i l l c a use th e a nt to mo v e to w ards its go a l . These subagents w ill manage the ants direction and movement. (do (ask #^/turtle :forward 20) This is a primitive task. A n agent w ith this task w ill make the turtle go forw ard w hen it is activated. (script (find-free-block @^/marker/) (go-to @^/hand @^/marker/) (grasp @^/hand)) T h is activate instructs to grasp generate scri p t t ask fro m t h e b l o c ks w orl d i nstru c ts t h e age n t t o m a k e t hre e su b age n ts a n d t h e m seri a l l y . T h e f irst i nstru c ts a m ark er o b j e c t t o f i n d a fre e b l o c k , t h e se c o n d the actor representing the hand to go to the marker, w hile the third instructs the hand w hatever object it finds. A ll three of these subtasks are high-level domain tasks that manager agents.

5.2.2.2

Agents

A n age n t is a stru c t ure cre a t e d t o c arry o u t a n d m o n i t or a t ask . A ge n ts are arra nge d hierarchically as described above. Internally agents are represented by lo w-level Lisp structures for efficiency, but they also have representations in box form for presentation to the user. The most important property of an agent is its task. A n agent also contains an assortment of additional state variables that are used to control its activity. This includes its precondition, its current subordinate agent (for script tasks and others that activate only one subagent at a time), its determination, and its success or failure state including information about lost conflicts. A ge nts a lso c o nta i n th e n e c essary p o i nters to m a i nta i n th e age nt h i erarc h y . If a n age nt w as

144

Agents

ge n erate d b y a te m p l ate , it c o nta i ns a p o i nter b a c k to th at te m p l ate a l o ng w ith th e v ari a b l e bindings that resulted from the match of the templates task-pattern to the agents task. A ge nts are i nte n d e d to b e u n d ersto o d a nthro p o m orp h i c a l l y as th e a cti v e a n d i ntereste d components of the system. To that end, a set of icons are used to represent the state of agents in terms suggestive of human emotion. In addition to the icons for goal satisfaction used in goalagents (see 5.1.2), dynamic agents can express the state of their action (succeeded, failed, or w aiting) and the presence of conflict. The icons and their interpretation are: inactive (asleep) The agent is inactive. satisfied (happy) The agent is active and its goal is satisfied. unsatisfied (sad) The agent is active and its goal is not satisfied.

in conflict (angry) The agent w as satisfied, but w as made unsatisfied by another agent. failed (thumbs-do w n) The agent failed. succeeded (thumbs-up) The agent succeeded. waiting (tapping fingers) The agent is w aiting for a subordinates to complete.

Roughly, an iconic face is used to indicate the satisfaction state of the task, w hile an iconic hand is used to sho w the state of any action taken to achieve that task. These are some w hat independent, since an agents task can become satisfied w ithout direct action by the agent.

5.2.2.3

Templates

A te m p l ate sp e c ifi es a m eth o d for c o nstru cti ng a n age nt to h a n d l e a p arti c u l ar c l ass of d o m a i n t ask . T h e re l a t i o nsh i p b e t w e e n t e m p l a t es a n d age n ts is si m i l ar t o t h e re l a t i o nsh i p b e t w e e n a pro c e d ure sp e c i f i c a t i o n a n d a pro c e d ure i n v o c a t i o n i n a st a n d ard pro c e d ura l l a ngu age: t h a t is, t h e t e m p l a t e is a st a t i c , ge n era l i z e d stru c t ure t h a t serv es as a p a tt ern f or dynamically creating other structures (agents) to deal w ith particular instances of tasks. Thus, templates correspond to w hat is normally thought of as the program, that is, they contain the specifications of w hat the computer is to do.

Agents

145

W hen an agent w ith a domain (non-special) task is expanded, the system matches its task 18 against all templates. If exactly one template matches, then a single subagent is created using that templates information. If more than one template matches the task, an intervening O N E O F task is created to manage the multiple agents that result. Templates consist of a number of fields. Some of these have values that are patterns used to match and generate tasks. The most important of these are the task-pattern and the actionpattern, w hich specifies a ne w task. The semantics of a template are (roughly) that if there is an active task that matches the task-pattern of the template, then a subagent should be built that incorporates the ne w task specified by the action-pattern. Templates can also specify preconditions for the agent and other relevant agent properties. In this document, templates are sho w n defined by Lisp forms. It is also possible to create te m p l ates i n th e form of b o x stru ctures w ith i n Li v e W orl d , b y th e usu a l m eth o d of c l o n i ng a specialized object and filling out the appropriate slots. Patterns are specified using a pattern-matching language based on the one in ( N orvig 1992). A p attern c o nsists of a Lisp l ist i n w h i c h so m e of th e e l e m e nts are p attern v ari a b l es. Pattern variables are symbols beginning w ith the ? character. For example, the pattern (= ?a ?b) w ould match the task (= @^/rect/x @^/rect/y), binding the variables ? a a n d ? b t o t h e a p pro pri a t e matched values. This information is used to substitute the values for pattern variables in the other patterns in the template, such as the action. H ere is an example of a template from an animal-behavior simulation: (deftemplate ( g e t - f o o d - f o r w a r d ? a ) :precondition (and (yes? (ask ?a :left-food)) (yes? (ask ?a :right-food))) :action (repeat (do (ask ?a :forward 10)))) T h e t ask-p a t t ern o f t h is t e m p l a t e is (get-food-forward ?a), a n d t h e e f f e c t o f t h e t e m p l a t e is t o sa y t h a t i f a t ask o f t h a t f orm is assert e d (f or so m e a c t or t h a t w i l l m a t c h t h e pattern variable ?a), and the t w o food sensors are both returning :yes v a l u es, th e n go for w ard . T h e p attern v ari a b l e ?a w i l l b e b o u n d t o t h e a c t or w h e n t h e t e m p l a t e is m a t c h e d aga i nst outstanding tasks, and the precondition and action are evaluated in a context that includes the resultant bindings of the pattern variables. In th e a b o v e e x a m p l e , th e p attern m atc h i ng fa c i l ity d o es n ot a d d m u c h p o w er o v er a n d a b o v e t h e age n t syst e ms a lre a d y se e n . H o w e v er, t h e n e x t e x a m p l e uses m u l t i p l e p a t t ern variables to establish templates for tasks that involve relations betw een slots: (deftemplate ( = ( + ? b ? c ) ? a ) :name +left :precondition (settable ?b) :action (= ?b (- ?a ?c)))

A ctually the implementation organi z es templates into buckets based on their first element in order to minimize the relatively expensive process of pattern-matching. This is an implementation detail.

18

146

Agents

This template specifies one method for satisfying a particular form of arithmetic constraint by reducing it to a simpler constraint. This template is part of the systems general arithmetic capabilities. As this example suggests, there can be more than one template matching a task. W hen a task matches w ith multiple templates, the system w ill generate multiple agents under a oneof agent (see 5.2.4.4). The fields of a template specification are: The task pattern (the header or second element of the deftemplate form) is used to match the template against a task. It can contain pattern variables that get bound to elements in the original task. T h e action pattern (sp e c ifi e d b y th e :a cti o n k e y w ord) ge n erates a n e w task b ase d o n th e v a l u es of p attern v ari a b l es b o u n d i n th e go a l p attern . T h is task b e c o m es th e b asis for a subagent of the original tasks agent. This field must be supplied (or calculated from the satisfied field, see below). T h e precondition pattern sp e c i f i es a pre c o n d i t i o n t h a t a lso b e c o m es p art o f t h e n e w l y created agent. The default value is t, that is, by default agents are al w ays able to run. The satisfied field allows a predicate and action to be defined together (see below). T h e name f i e l d assigns t h e t e m p l a t e a n a m e t h a t u n i q u e l y i d e n t i f i es i t f or p urp oses o f debugging and redefinition. The default value of the name is the goal-pattern. This means that if multiple templates are being defined for a single goal-pattern, they had better have unique names so the system does not interpret them as redefinitions of one template. The determination-factor field is a number used to scale the determination value assigned to the agent (see 5.2.7). The default value is 1.

U s e rs c a n d e f i n e t h e i r o w n g o a l s b y u s i n g t h e :satisfied p ara m e t er o f t e m p l a t es. T h is essentially defines both the declarative and procedural parts of a high-level goal simultaneously. For instance, (deftemplate ( s q u a r e ? a ) :satisfied (= (ask ?a :xsiz) (ask ?a :ysiz))) This template definition both defines a one-argument Lisp predicate square w ith the obvious definition, and creates a template that if given a square task w ill attempt to achieve it by posting t h e a p pro pri at e e q u a l it y t ask . T h is pro c ess i n v o l v es c o n v ert i ng t h e t ask-p att ern i nt o a Lisp function specifier and argument list, and for this reason a template that includes a :satisfied field must have a task-pattern that is of the form ( <symbol> <pattern-var>*). The pattern-matcher is actually more po w erful than described so far. M ost of its capabilities (for instance, matching a variable to a segment of arbitrary length) have not been used. O ne extension that has proved useful is syntax that allo ws patterns to specify that a pattern variable must match a box of a particular type. For instance, the pattern (yes? (?spinoff ?sensor #/sensors/overlap-sensor)) w i l l m a t c h a n y t a s k o f t h e f o r m ( y e s ? foo ) , i f a n d o n l y i f foo i s a s p i n o f f o f #/sensors/overlap-sensor. Agents 147

5.2.3

Control

From the implementation standpoint, agents do not really operate independently but instead are controlled through a centrali z ed agent interpreter. This interpreter is in charge of creating agents for the initial tasks, finding templates to match tasks and creating the ne w tasks specified by the templates, and so on recursively. The interpreter is also in charge of determining w hat subset of these agents are to be active at any time. T h e i n t erpre t er is c y c l i c , t h a t is, i t c o nsists o f a pro c ess t h a t re p e a t e d l y e x a m i n es a n d updates the structure of agents. There are a number of different w ays such an interpreter could w ork. For instance, it could pick a single agent to activate on each cycle, or pick a single agent on each level, or activate as many agents simultaneously as it can. To be true to the distributed form of th e a nthro p o m orp h i c m eta p h or, w e h a v e c h ose n th e l atter, e v e n th o ugh th e si ngl eage nt-at-a-ti m e m eth o ds m ight b e m ore tra cta b l e . So a si ngl e m a j or c y c l e of age nt a cti v ity c o nsists o f a c t i v a t i ng as m a n y age n ts as are a p pro pri a t e , a n d , i f a n y a c t i o ns are pro p ose d , resolving conflicts and executing them. This section describes the internal mechanics of agent a cti v ati o n a n d c o ntro l . F or a n e xte n d e d e x a m p l e of th e c o nse q u e n c es of su c h a cti v ity , se e section 5.3.5.

5.2.3.1

Activation and Expansion

Activation is t h e pro c ess o f m a k i ng a n age n t c h e c k i ts go a l (i f a n y) a n d t a k e n e c essary action. Agents are activated in a top-do w n process, starting from the top-agent and w orking do w n to the w orker agents. A ctivating one agent may result in the creation of subagents and their subsequent activation.
W hen an agent is activated, it first performs several checks. First, if the agent has already completed, nothing is done. This does not necessarily mean that each agent can run only once, since the completion state of an agent can be reset (see belo w). If the agent is not complete, it checks w hether it may already be satisfied (if it is a goal) and w hether or not its precondition is met (if it has one). After passing these checks, an agent has determined both that it needs to run and that it can. At this point if it is a primitive agent it runs its action. O therw ise it expands itself and marks its subordinate agents for later activation. Expansion is the process of creating subagents for an agent. This involves different processes for different types of agents. For agents w ith domainsp e c ifi c tasks, e x p a nsi o n i n v o l v es fi n d i ng te m p l ates th at m atc h th e task a n d usi ng th e m to create subagents. For special tasks, the process varies but most typically involves making one subagent per clause of the task. For the god task, expansion involves collecting all the top-level tasks and making a subagent for each. Each agent is expanded at most one time.

5.2.3.2

Cycles

The process of agent interpretation is essentially iterative. The system activates some set of age n ts, t h e y p erf orm t h e ir t asks, a n d t h e pro c ess is re p e a t e d . In t h e e arl i er syst e ms t h is p r o c e ss w a s r e l a t i v e l y s i m p l e , w i t h a n a n i m a - b a s e d d r i v e r t h a t c l o c k e d e a c h a g e n t i n d e p e n d e n t l y , w i t h a g l o b a l c o n f l i c t r e s o l u t i o n p h a s e . T h e d y n a m i c a g e n ts s y st e m i s 148 Agents

significantly more complex and requires a more complex driver. I have found it useful to think of three different levels of cycle for the different levels of agent activity: A microcycle is th e sm a l l est-sc a l e c y c l e , a n d a si ngl e m i cro c y c l e c o nsists of a cti v ati ng a single agent. A major cycle o r millicycle is a ro u n d o f m i cro c y c l es t h a t st arts fro m t h e t o p age n t a n d proceeds do w n w ards until the leaves of the agent tree are reached, w hich w ill be w orker age nts e x e c uti ng pri m iti v e tasks. T h is is fo l l o w e d b y a c o nfl i ct reso l uti o n p h ase a n d th e actual state change. A major cycle is like a single unit of real-time, in which all the agents can act if they need to. A macrocycle consists of initiali z ing the agent tree and performing millicycles until the top agent successfully completes. N ote that a complete macrocycle is possible only if all the toplevel tasks are able to be completed.

M i cro c y c l es are use f u l m ost l y f or t h e p urp ose o f user st e p p i ng, a n d m a cro c y c l es o n l y make sense for constraint-like problems w here all the top-level tasks are goals. The millicycle is really the fundamental unit of dynamic agent activity, and w hen the system is being driven by an anima (see 4.6.1) it is essentially performing a millicycle per anima clock.

5.2.3.3

Success and Failure

A n age nt c a n su c c e e d or fa i l at v ari o us p o i nts i n its a cti v ity . Su c c ess or fa i l ure h a lts th e agent activity and signals the agents boss agent, w hich w ill take action dependent upon its task. Agents succeed w hen: a w orker agent successfully executes its action. an agent with a goal-task is activated and finds its goal already satisfied. a subordinate agent succeeds and appropriate task-specific conditions are met.

Agents fail when: a w orker agent gets a Lisp error. a w orker agent loses a slot conflict to another agent. an agents precondition is unsatisfied. no templates can be found for a domain-specific task. a subordinate agent fails and appropriate task-specific conditions are met. subordinate agents succeed but the agents goal is still not satisfied.

Lisp errors m a y o c c ur d u e to b ugs i n th e sp e c ifi c ati o n of pri m iti v e tasks, of c o urse , b ut they may also be generated by general templates being applied in situations w here they dont w ork. For instance, an agent that attempts to satisfy the task (= a (* b c) ) b y se tt i ng b equal to ( / a c) will get a Lisp error (and thus fail) if c h a p p e ns to b e z ero . W h e n th is h a p p e ns, th e Lisp error is caught by the agent interpreter, the agent is marked failed, and other methods are tried. This means that the user can be rather free in specifying methods.

Agents

149

The task-specific conditions mentioned above refer to the w ay in w hich agents react to success or failure for different special tasks. For instance, the failure of an agent w hose boss is a n and age n t w i l l c a use t h e b oss t o f a i l as w e l l . In t h e c ase w h ere t h e b oss is a n or age nt, ho w ever, the failure w ill cause a different subordinate of the boss to be activated during the next millicycle. W hat happens next depends on the parents action type. For instance, if a child of an agent w ith an and special action (which we will call an and age nt for sh ort) fa i ls, th e n th e parent agent w ill fail as w ell. If a child of a script agent succeeds, it makes the next sequential child the current one so that it will be activated on the next agent cycle. Agent success and failure persists across cycles but may be reset in some circumstances, a l l o w i ng th e age nt to atte m pt to ru n aga i n . T h ese c irc u msta n c es i n c l u d e w h e n a su c c essfu l agents goal becomes unsatisfied (a goal conflict, see 5. 2. 6. 2) or w hen a failed agent has its determination increased due to sibling failures.

5.2.4

Special Tasks

This section describes the vocabulary of control constructs that are used to create special and primitive tasks, and ho w they are interpreted by the agent system. The interpretations of other types of tasks (that is, domain tasks) are specified by templates. Special tasks allo w tasks to be combined in different w ays, and in some sense represent different managerial styles or w ays of accomplishing a complex task by parceling it out to subordinate agents. Some tasks activate all their subordinates at once, w hile others activate them one at a time. O f the latter, some specify a fixed order of activation w hile others dont care. Some tasks are goals that can be satisfied or not, w hile others are just actions. These distinctions are some w hat confusing, b ut e a c h task re prese nts a d iffere nt strategy for a c c o m p l ish i ng a c o m p l e x task . Ex a m p l es of special tasks in use may be seen in section 5.4 and else w here.

5.2.4.1

Combining Tasks

These special tasks serve to combine several subordinate tasks in various w ays. (AND goal*), (OR goal*) T h ese sp e c i a l task ty p es are d u a ls of e a c h oth er i n m a n y resp e cts. And a n d or t asks are goals, and their satisfaction is a function of the satisfaction of their subtasks (w hich must also be goals). A n and agent activates all of its subagents simultaneously, and expects them all to be satisfied eventually. If any of them fail, the and agent fails. A n or agent activates its subagents o n e a t a t i m e , i n a n u nsp e c i f i e d ord er, c h o osi ng a n o t h er i f o n e f a i ls a n d o n l y f a i l i ng i f a l l subagents fail. (ALL <task>*), (ONE <task>*) All a n d one are similar to a n d a n d or, b u t are a c t i o ns ra t h er t h a n go a ls, a n d c a n h a v e a cti o ns as th e ir su btasks. A n all agent activates all of its subagents, in parallel, and completes successfully w hen all of the subagents complete successfully. A failed subagent w ill cause it to fail. one acts like or in activating subtasks one at a time in arbitrary order, but requires only one

150

Agents

s u c c e ss f u l s u b t a s k t o s u c c e e d . I n o t h e r w o r d s , w h e r e a s a n d a n d o r p a y a t t e n t i o n t o satisfaction, all and one only care about success. (SCRIPT <task>*) Script tasks are actions. A script causes its subordinate tasks to be activated one at a time, i n th e ord er sp e c ifi e d . Ea c h task m ust c o m p l ete su c c essfu l l y b efore th e n e xt task is b egu n . Scripts succeed w hen the last task is done and fail if any subtask fails. (TRY <task>*) Try is similar to script, i n t h a t su b t asks are a c t i v a t e d o n e a t a t i m e a n d i n t h e sp e c i f i e d ord er. H o w e v er, o n l y o n e o f t h e su b t asks n e e ds t o su c c e e d f or t h e try t a s k t o s u c c e e d . I n oth er w ords, try tries running each subtask until one succeeds, at w hich time it succeeds itself. Roughly, try is to script as or is to and . (AND-SCRIPT <goal>*) This special task combines the semantics of a n d w ith th e se q u e nti a l pro p erti es of script. Like the former, and-script tasks must be satisfiable goals and their subtasks must be as w ell. But unlike and , a n d l i k e script, t h e y a c t i v a t e t h e ir su b ord i n a t es o n e a t a t i m e , i n t h e ord er specified by the task. T h e d iffere n c e b et w e e n and-script a n d script i s t h a t t h e f o r m e r r e q u i r e s t h a t i ts t a s k s remain satisfied after they are completed. That is, once a subagent of a script is finished, it no longer cares about its goal, but all steps of an and-script u p to th e c urre nt ste p m ust re m a i n satisfied even after they are completed. If they become unsatisfied, the and-script fails (there is n o or-script because its behavior would be identical to the more general try construct).

5.2.4.2

Control Tasks

(REPEAT <task>) REPE A T tasks are a cti o ns th at n e v er c o m p l ete , a n d th us c a use th e ir i n n er task to re m a i n activated indefinitely. G enerally, REPEA T tasks are used as the expansion of goals, so that the inner task w ill be executed only until the goal is satisfied. REPEA T is most useful for actions that achieve a goal only after multiple iterations. For an example, see the template for G ET-T O tasks in section 5.2.5.3. The REPEA T construct allo ws for iteration at the agent level. Iteration in primitive actions (that is, at the Lisp level) is discouraged, because it blocks other agents from running. U sing REPEAT allows the iteration to be interleaved with other agent actions.

5.2.4.3

Primitive Tasks

(DO <lisp>*)

Agents

151

Primitive tasks are specified using the do task type. Primitive tasks are handled by w orker agents that have no subordinates and al w ays complete immediately. They can fail due to Lisp errors or b y c o m i ng i nto c o nfl i ct w ith a m ore d eterm i n e d age nt. W h i l e pri m iti v e tasks c a n specify the execution of arbitrary Lisp programs, they are expected to be simple and fast, and w ill typically involve nothing more complicated than sending an object a message, or changing the value of a slot or tw o.

5.2.4.4

Internal Special Tasks

Some special tasks are for the internal use of the system, and are not meant to be used in user-specified tasks and templates. (ONEOF task*) oneof t a s k s a r e u s e d o n l y i n t e r n a l l y : t h e y c a n n o t a p p e a r i n u s e r-s p e c i f i e d t a s k s o r templates. They act essentially like one tasks, b ut are ge n erate d b y th e syste m w h e n m u lti p l e subagents are required for a single domain task. So for instance, a goal of ( = @ / a @ / b ) w ould generate t w o subtasks corresponding to the t w o obvious w ays to make an equality constraint be true: (do (setf @/a @/b)) (do (setf @/b @/a)) Because domain tasks can have only one subagent, a oneof task and subagent is created to i nterv e n e b et w e e n th e e q u a l ity c o nstra i nt a n d th e t w o m eth o ds. H ere a n o utl i n e n otati o n is use d to sh o w th e re l ati o nsh i p b et w e e n a n = c o nstra i nt, its su b ord i n ate oneof t a s k , a n d t w o further subordinates: a 1 : (= @/a @/b) a 2 : (oneof <a3> <a4>) a 3 : (do (setf @/a @/b)) a 4 : (do (setf @/b @/a)) N ote that since oneof tasks are used only internally, they are able to refer directly to their subagents. In actuality the treatment of equality is some w hat more complicated; see section 5.2.5.1 for more details. (GOD) The G O D special task is used internally by the system for the top agent. It gathers together all the top-level tasks, makes them into subagents, and otherw ise acts essentially like an all task.

5.2.5

Domain Tasks and Templates: Examples

D o m a i n t a s k s a r e i n t e r p r e t e d a c c o r d i n g t o t e m p l a t e s; t h a t i s , t h e u s e r s p e c i f i e s a n interpretation for them. This section presents some detailed examples of domain tasks and the templates that interpret them.

152

Agents

5.2.5.1

Numerical Constraints; Equality

N u m eri c a l c o nstra i n ts are e x presse d as a lge bra i c re l a t i o ns. F or e x a m p l e , o n e w a y t o e x press a task to m a i nta i n th e re l ati o nsh i p b et w e e n F a hre n h e it a n d c e ntigra d e te m p erature representations looks like this: T1: (= @^/Fahrenheit (+ 32.0 (* 1.8 @^/centigrade))) Equality constraints are usually handled by templates that propose t w o subagents: one that proposes to make the equality constraint hold by making the expression on the left-hand side be equal to the one on the right, and the inverse. These tasks are expressed by means of the <== operator, kno w n as one-w ay equality . This operator has the same declarative meaning as =, that is, it is satisfied if its tw o arguments are numerically equal. Its procedural meaning is that equality can only be achieved by altering left hand side to match the right. A similar construct, <=equal , is a v a i l a b l e f or n o n-n u m eri c v a l u es. T h e b asi c d e f i n i t i o n o f o n e- w a y e q u a l i t y is provided by the follo w ing set of templates: (deftemplate ( < = = ? a ? b ) :satisfied (= ?a ?b) :precondition `(settable? '?a) :action (do (setf ?a ?b))) (deftemplate ( = ? a ? b ) :name =left :action '(<== ?a ?b)) (deftemplate ( = ? a ? b ) :name =right :action '(<== ?b ?a)) The temperature conversion task w ould result in the t w o subtasks: T3: (<== @^/Fahrenheit (+ 32.0 (* 1.8 @^/centigrade))) T4: (<== (+ 32.0 (* 1.8 @^/centigrade)) @^/Fahrenheit) If the left-hand side of a one-w ay equality constraint is settable, it can be expanded into a w ork er age n t b y t h e f irst t e m p l a t e sh o w n a b o v e . Se tt a b l e-n ess is d e f i n e d b y t h e settable? function, and is true of anything that can be a legitimate first argument to the C ommon Lisp setf macro. @ ^ / F a h r e n h e i t is settable, so T3 can be expanded into: T5: (do (setf @^/Fahrenheit (+ 32.0 (* 1.8 @^/centigrade))) T 4 , h o w e v er, h as a l e f t-h a n d si d e t h a t is n o t se t t a b l e . T h is d o es n o t m e a n t h e t ask is h o p e l ess, h o w e v er! O t h er t e m p l a t es c a n m a t c h i t a n d tra nsf orm i t i n t o su b t asks t h a t w i l l eventually allow action to be taken: (deftemplate ( < = = ( + ? b ? c ) ? a ) :name +right Agents 153

:action `(<== ?c (- ?a ?b))) This template says that a one-w ay equality task that is trying to change the value of a sum (( + ? b ? c )) can be transformed into a ne w task that sets one of the items being summed (in this case, ? c). The template will match T4 and generate a new subtask: T6: (<== (* 1.88 @^/centigrade) (- @^/Fahrenheit 32.0)) In effe ct, th e temp l ate h as p erforme d a n a lge bra i c tra nsformati o n o n T 4. T h is pro c ess of transformation continues, controlled by other templates w hich have forms similar to the +right template, until it results in a runnable worker agent. In this case, the penultimate task, which will expand directly into a w orker agent, is: T11: (<== @^/centigrade (/ (- @^/Fahrenheit 32.0) 1.8)) A re w ri t i ng syst e m l i k e t h is p oses a d a nger o f ge n era t i ng a n o n-t erm i n a t i ng c h a i n o f tra nsform e d tasks, e ith er thro ugh l o o p i ng or thro ugh i nfi n ite e x p a nsi o n . T h e b u i lt-i n set of templates for handling numerical constraints avoids this problem by ensuring that templates al w ays generate ne w tasks w hose left side is a sub-part of the left side of the original task. Since each transformation must produce a ne w task w hose left side is strictly smaller than the starting task, the process of transformation must eventually terminate.

5.2.5.2

Geometry

G eometrical constraints ultimately turn into numerical constraints of the type sho w n above. The combination of the template pattern language and Live W orlds object facilities allow them to be expressed as higher-level relationships. F or e x a m p l e , th e (rectangle <actor>) f orm o f go a l is h e a v i l y use d i n gra p h i c c o nstra i n t p r o b l e m s s u c h a s t h e gr a p h i c v e rs i o n o f t h e t e m p e r a t u r e c o n v e rt e r . T h e d i m e n s i o n s o f Li v e W orl d a c t ors are d ire c t l y c o n tro l l e d b y t h e f o ur sl o ts xpos , ypos , xsiz a n d ysiz. T h e rectangle constraint defines t w o additional slots, bottom a n d right, a n d e nforc es ge o m etri c consistency among the resulting set of six slots. Rectangle does not by itself put any constraint on the appearance of an actor, instead it allo ws other constraints to be placed on any one of a re c t a ngl e s si d es or d i m e nsi o ns. It sh o u l d a lso b e n o t e d t h a t rectangle c o n str a i n ts c a n b e applied to any actor, or indeed anything w ith the appropriate slots. For instance, it makes sense to give ovals a rectangle constraint. The constraint actually means enforce consistency on an objects rectangular bounding box. The rectangle constraint is defined by the following template: (deftemplate ( r e c t a n g l e ? r ) :satisfied (and (= (ask ?r :right) (+ (ask ?r :xpos) (ask ?r :xsiz))) (= (ask ?r :bottom) (+ (ask ?r :ypos) (ask ?r :ysiz)))))

154

Agents

This means that an unsatisfied rectangle task w ill expand into an and task w hich w ill in turn expand into tw o equality tasks. G e o m etri c c o nstra i nts c a n a lso e x press i nter-o b j e ct re l ati o nsh i ps. T h e within c o nstra i n t specifies that one object should lie entirely within another: (deftemplate ( w i t h i n :satisfied (and (>= (<= (>= (<= ?a ?b) (ask ?a (ask ?a (ask ?a (ask ?a :xpos) (ask ?b :xpos)) :right) (ask ?b :right)) :ypos) (ask ?b :ypos)) :bottom) (ask ?b :bottom))))

A within t ask e x p a n ds t o a n and su b t ask w i t h f o ur su b t asks o f i ts o w n . Ea c h o f t h ese enforces a numeric relationship. W hen >= and <= tasks are unsatisfied, they are expanded into equality tasks. That is, if the task ( > = a b ) is encountered and unsatisfied, the system w ill attempt to enforce it by trying to equate a and b. This technique obviously is incomplete, in that it only tries a very small subset of the possible w ays to make the constraint true. H o w ever, it produces reasonable interactive behavior in the case of the w ithin constraint. If the user drags an object constrained to be w ithin another, the agents w ill do nothing as long as the constraint i s s a t i s f i e d . I f t h e o b j e c t g o e s o u t s i d e t h e b o u n d a r i e s o f t h e s u rr o u n d i n g o b j e c t , t h e surrounding object w ill be moved as if bumped and dragged. N o t e t h a t t h e t w o o b j e c t s c o n s t r a i n e d b y a within t a s k m u s t a l s o h a v e rectangle constraints defined so that their bottom and right slots are defined and maintained properly.

Figure 5.10: A world combining numerical and geometrical tasks. The conversion task (T1 in the text) appears in the task object within temperature. W ithin the centigrade bar, task-1 asserts that the bar is a rectangle while task constrains its vertical size to be equal to the computed centigrade temperature.

Agents

155

5.2.5.3

Behavior

T a s k s a n d t e m p l a t e s fr o m b e h a v i o r a l d o m a i n s t e n d t o m a k e m o r e u s e o f t h e repeat construct, reflecting the fact that the actions that satisfy goals in this domain generally do not satisfy immediately, as they do in the more abstract domains above. Instead, they achieve their goal only by repeated application. A simple example: (deftemplate ( g e t - t o ? c r e a t u r e ? p l a c e ) :satisfied (eq (ask (ask ?creature :overlap-sensor) :other) ?place) :action '(repeat (script (head-towards ?creature ?place) (do (ask ?creature :forward 10))))) This template defines a goal called get-to, t h a t e x p e c ts t o h a v e a c t ors m a t c h i ts p a t t ern variables. The goal is satisfied w hen its t w o actor arguments are in contact, as defined by the cre ature a ctors o v erl a p-se nsor. T h is te m p l ate ge n erates a su b age nt w ith a repeat t a s k . T h i s means that the innermost task (the script) w ill be repeated until the get-to task is satisfied. The scri pt first atte m pts to satisfy th e head-towards go a l , a n d w h e n it is satisfi e d w i l l pro c e e d to a cti v ate th e do age n t , w h i c h w i l l m o v e t h e cre a t ure f or w ard . T h e script t a s k e n s u r e s t h a t forw ard motion only happens if the head-towards goal is satisfied, that is, only if the creature is f a c i ng t h e t arge t . T h e f a c t t h a t t h e re p e t i t i o n is o u tsi d e o f t h e scri p t e nsures t h a t t h e headtowards goal will remain monitored and if the target object moves, the creature will realign itself before moving forw ard. By contrast, a goal of the form: (script (head-towards ?creature ?place) (repeat (do (ask ?creature :forward 10)))) w o u l d a d j ust t h e h e a d i ng o n c e , a n d t h e n go f or w ard i n d e f i n i t e l y w i t h n o f urt h er c o urse corrections.

5.2.6

Conflict

There are t w o ty pes of c onflict that can oc cur during the exe c ution of a D A system. Th e first, slot conflict , occurs w hen t w o or more agents attempt to set a slot to different values. The second, goal conflict, occurs w hen a successful action results in another agents goal becoming unsatisfied. These t w o types of conflict represent different constraints on agent activity. Slot c o nfl i ct m o d e ls th e p h ysi c a l i m p ossi b i l ity of a n o b j e ct b e i ng i n t w o states at o n c e or ta k i ng simultaneous actions that are physically incompatible (for instance, an actor cannot move in t w o different directions at once). G oal conflict, on the other hand, reflects the fact that agents w ill often interfere w ith each others goals, and that either compromises must be reached or some agents will remain unsatisfied.

5.2.6.1

Slot Conflict

Each major cycle might result in many w orker agents attempting to take action. This raises the possibility that they might come into conflict. As in Simple Agents, all the actions of w orker 156 Agents

agents are ultimately expressed as changes to the values of slots, and so slot conflict is defined as m ore t h a n o n e age n t try i ng t o se t a sl o t t o i n c o m p a t i b l e v a l u es. T h e D A syst e m uses techniques similar to the t w o-phase clock technique used in the simpler agent systems. U nder t h is t e c h n i q u e , t h e a c t i o ns o f w ork er age n ts are n o t a c t u a l l y p erf orm e d w h e n t h e age n t is activated but instead get deferred and turned into proposals for each slot. A t th e e n d of e a c h m a j or c y c l e , th erefore , a c o nfl i ct reso l uti o n pro c e d ure is re q u ire d to determine w hich slots have conflicting proposals and w hich agents shall prevail. This involves c o l l e cti ng a l l th e sl ots th at h a v e pro p osa ls, a l l th e w ork er age nts th at h a v e m a d e pro p osa ls, computing sets of agents that are in conflict, and for each set, picking an agent to prevail. This is d o n e b y c o m p ari ng t h e d e t erm i n a t i o n o f t h e age n ts i n t h e c o n f l i c t i ng se t . T h e age n t t h us selected gets to make its proposals take effect, and is marked as successful, w hile the losing agents fail. In some cases, it is important to detect conflicts bet w een agents that do not necessarily get activated during the same major cycle. This is the case for agents that are jointly underneath an and agent, for instance. W h e n a n age n t s pro p osa l is re a l i z e d , t h e sl o ts t h a t are c h a nge d re c ord w h i c h age n t provided the value, and the current clock tick. W hen the persistent-slot-values s w i t c h is o n , this data is used in future cycles. In this case, in addition to any proposals suggested by agents running in the current cycle, the prevailing value and the agent that set it are also compared in th e c o nfl i ct reso l uti o n stage . T h is esse nti a l l y m e a ns th at i n ord er to c h a nge a sl ot v a l u e , a n agent must have a higher determination than the last agent to successfully set that slots value.

5.2.6.2

Goal Conflict

G oal conflict occurs w hen the action of one agent causes another agent, previously marked as satisfi e d , to b e c ome u nsatisfi e d . W h e n th is h a p p e ns, th e n e w l y-u nsatisfi e d age nt is reset , that is, its completion state is revoked so that it can run again. In addition, it is marked as the v i c t i m o f a c o n f l i c t , w h i c h c a u s e s n o a d d i t i o n a l p r o c e ss i n g b u t c a u s e s t h e gr a p h i c r e p r e s e n t a t i o n o f t h e a g e n t st a t e t o b e a n a n gr y i c o n r a t h e r t h a n t h e l e ss d e s c r i p t i v e unsatisfied icon. The intent of the goal-conflict handling mechanism is to allo w these angry goals to have another chance to satisfy themselves. In the most usual case, the goal w as originally satisfied w i t h o u t t a k i ng a n y a c t i o n , so i t h a d n o t assert e d i ts c o n tro l o v er a n y sl o ts. N o w t h a t t h e c o nf l i ct i ng age nt h as ru n , w h e n t h e origi n a l age nt ru ns aga i n it is l i k e l y t o e n c o u nt er sl otc o nfl i cts w ith th e age nt th at c a use d th e go a l-c o nfl i ct. T h e sl ot-c o nfl i ct m e c h a n ism is m ore sp e c ifi c , a n d gi v es th e c o nfl i cti ng age nts a c h a n c e to se arc h for n o n-c o nfl i cti ng m eth o ds of attaining their goals.

5.2.7

Determination

Each agent has a determination value betw een 0 and 1 that is used to resolve conflicts. The metaphorical interpretation of determination is a measure of ho w much the agent w ants to be

Agents

157

su c c essf u l , a n d h o w stro ngl y i t w i l l press i ts c ase w h e n c o m i ng i n t o c o n f l i c t w i t h o t h er agents. A n agents determination value can depend on a number of factors: the determination and type of its superior agent; ho w many siblings exist, and ho w many of them have failed; the determination scaling factor of the creating template.

The default determination value is 1. Agents that have subordinates pass the determination do w n to them according to their type. and-type agents, that require all of their subordinates to be successful, w ill give each subordinate the same determination as itself. or-type agents (w hich include or and oneof agents) will split their determination among their subordinates. M ore precisely, an O R-type agents determination is split up among those subordinates that have not failed. W hen a subordinate does fail, the determinations of its remaining siblings are recalculated. T h e e f f e c t o f t h is d e t erm i n a t i o n c a l c u l a t i o n i n c o nstra i n t-t y p e d o m a i ns is ro ugh l y t o implement local propagation of kno w n states. A fully kno w n state, in this interpretation, is a slot th at is b e i ng h e l d to a v a l u e b y a n age nt w ith a d eterm i n ati o n of 1 . A c o nstra i nt age nt th at supervises several different methods w ill initially give each method a determination less than 1. If a method tries to set a slot that has been locked (that is, set by a highly-determined agent) it w ill fail. If all methods fail, the system tries to determine w hich agents have failed permanently (for reasons other than conflict) and w hich still have a chance for succeeding if their activation is increased. Then each of the latter class is given a chance to run w ith the full determination of its parent. Figure 5.11 illustrates a typical sequence of events that make up a propagation. W hen slot1

2) goal becomes unsatisfied

(= ...

ONEOF

4) runs with increased determination

1) slot-1 value set by agent with high determination

DO...

DO...
3) fails due to conflict with slot-1

DO...

slot1

slot-2 5) changes the value of another slot

Figure 5.11: H ow agents implement local propagation of constraints.

158

Agents

is se t b y a n age n t w i t h a h igh d e t erm i n a t i o n (st e p 1), i t c a uses t h e go a l age n t t o b e c o m e unsatisfied (step 2). The goal agent activates its subordinates, and w hile the first one no w fails w here previously it might have succeeded (step 3), the second one succeeds (step 4) because it alters a different slot, w hich might result in further propagation. For a detailed example of ho w this method of propagation w orks in practice, see section 5.3.5.

5.3

Interface

W e h a v e d escri b e d h o w age nts w ork b ut h a v e n ot y et d escri b e d h o w th e user sp e c ifi es and controls them. The most important need for the interface is to allo w the user to create and re m o v e to p-l e v e l tasks. In a d d iti o n th e user n e e ds to b e a b l e to e x ert so m e c o ntro l o v er th e agent interpreter, such as cycling manually for debugging or controlling certain parameters that affect the operation of the interpreter.

5.3.1

Top-Level Tasks

Top-level tasks are those specified directly by the user. They are used to create the initial population of agents directly subordinate to the top agent. Top-level tasks can be created in a couple of different w ays: they can be explicitly specified by the user by using task objects, o r they can be automatically generated as a result of user actions such as dragging, w hich allo ws the users intentions to be represented to the agent system as tasks. Ex p l i c it to p-l e v e l tasks are sp e c ifi e d b y m e a ns of task o b j e cts (se e F igure 5 . 1 0 for so m e examples). Like other Live W orld objects, these are created by cloning a prototype. The task is entered as the value of the object. Task objects also incorporate a toggle button, w hich allo ws them to be turned on or off, and icons that indicate the tasks status. Relative box paths (see 4.5.4.2) may be used in the specification of tasks, w hich makes it possible to incorporate task objects into other objects w hich can then be used as prototypes for further objects (that is, the task objects w ill be cloned along w ith their container objects, and the ne w tasks w ill properly refer to the ne w object).

5.3.2

Auto-tasks and Locks

In ord er f or D A t o b e use d as a n i n t era c t i v e c o nstra i n t syst e m , t h e users a c t i o ns m ust so m e h o w b e re prese nte d w ith i n th e syste m . T h is is d o n e b y tra nsl ati ng user a cti o ns su c h as dragging, si z e changing, or setting the value of a slot into goal tasks. A uto-tasks generally have the form: (<== (v <slot>) <value>) T h a t is, t h e y use o n e- w a y e q u a l i t y t o sp e c i f y t h a t t h e sl o t is t o h o l d a c ert a i n v a l u e . In ge n era l a u t o-t asks p ersist o n l y bri e f l y , a n d are re m o v e d as so o n as t h e user t a k es a n o t h er action. For example, during a drag, each time the user moves the mouse, tw o tasks are created,

Agents

159

one to hold the x position at a constant value and similarly for the y position. D uring the next move, these tasks are removed and ne w ones w ill take their place. Lock tasks are similar in form to auto-tasks, in that they specify that a slot or slots are to be h e l d to c o nsta nt v a l u e . Lo c k tasks, h o w e v er, are cre ate d e x p l i c itl y b y se n d i ng a sl ot a :lock command. This command simply creates the appropriate task and marks the slot w ith an icon.

5.3.3

The Agent Display

Agent activity may be monitored through an agent display that sho ws the status of every active agent in the system. The graph uses Live W orlds hierarchical box display to convey the hierarchical structure of the agent tree. This also allo ws the user to control the level of detail by c l osi ng u n i nteresti ng b o x es. Ea c h age nt sh o w s its state b y m e a ns of a nthro p o m orp h i c i c o ns (see 5.2.2.2). W hen active, the agent display is dynamically updated as agents change state.

Figure 5.12: The agent display.

5.3.4

Controlling When and How Agents Run

The agent system is designed to run concurrently w ith user interaction. There are several w ays to do this, the best method being dependent upon on the type of problem being modeled. O n e te c h n i q u e is to h a v e th e age nt syste m dri v e n b y a n a n i m a . T h is is b est for d o m a i ns i n w h i c h th e mo d e l e d system is b asi c a l l y i n d e p e n d e nt of th e user, su c h as a n a n ima l b e h a v i or simulation. For constraint domains, w here objects do not move except in response to the user, a smoother interface is obtained by triggering the agent interpreter explicitly after each user action. 160 Agents

A number of user-settable sw itches are available to control the details of agent activation. These sw itches appear in the agent control panel (see Figure 5.13). agents-on? W hen this sw itch is on, agents w ill be activated automatically after every user action. That i s , a f t e r e v e r y u s e r o p e r a t i o n (s u c h a s d r a gg i n g a n o b j e c t e a c h i n d i v i d u a l m o u s e movement counts as an operation) the system w ill execute a macrocycle. auto-tasks? This sw itch controls w hether or not user actions get translated into auto-tasks. eager-locks? This sw itch, w hen on, causes lock-type tasks (including auto-tasks) to execute early on in each macrocycle. This makes constraint-solving faster by ensuring that all locked slots have t h e ir v a l u e assert e d e arl y o n . W h e n t h e s w i t c h is o f f , l o c k age n ts m ust f irst b e c o m e unsatisfied before they can run, w hich leads to extra cycles of activity. hide-activity? This sw itch controls w hen redisplay happens, but does not affect agent activity. W hen off, re d isp l a y h a p p e ns after e v ery m i l l i c y c l e , th at is, after e v ery age nt o p erati o n . W h e n o n , re d isp l a y o n l y h a p p e ns a ft er e v ery macrocycle , t h a t is, i t h a p p e ns o n l y a ft er t h e age n t system is quiescent w ith all satisfiable agents satisfied. Turning this sw itch on can make constraint solving seem smoother at the cost of hiding the processing from the user.

The remaining sw itches in the control panel control ho w much information is displayed but d o n ot affe ct age nt o p erati o n . show-auto-tasks?, f or i nst a n c e , c o n tro l w h e t h er or n o t a u t otasks are turned into visible task objects. These sw itches exist only for the sake of allo w ing the user to save on both time and the consumption of screen real estate.

Figure 5.13: The agent control panel.

T h e c o ntro l p a n e l a lso c o nta i ns m eth o ds th at a l l o w th e user to m a n u a l l y i n iti ate age nt cycles, an anima-based agent driver (run-tasks), the prototype for task objects, and other agentrelated miscellany. Agents 161

5.3.5

Agent Displays and Storyboards

The operation of a system of agents is a complex affair, w ith possibly hundreds of agents acting and interacting. It is a challenge to present this activity to the user in a comprehensible m a n n e r . S i m i l a r p r o b l e m s a r e p r e s e n t i n a n y p r o gr a m m i n g s y s t e m , o f c o u rs e , b u t t h e concurrency and distributed control model of D A makes follo w ing a sequence of action even more difficult than it might be otherw ise. The anthropomorphic metaphor underlying agents suggests t h a t n arra t i v e f orms m igh t b e use f u l f or t h e p urp ose o f c o n v e y i ng t h e u n d erl y i ng structure of activity (see section 3.4.3). U sers of D ynamic Agents can generate st ory b o ards, o r comic-strip-like graphic representations, as one method of visualizing agent activity. Story b o ards h a v e a n a d v a ntage o v er oth er m eth o ds for re prese nti ng te m p ora l pro c esses (su c h as a n i m ati o n) i n th at a story b o ard m a ps ti m e i nto sp a c e , so th at a n u m b er of d iffere nt moments of time may be seen together and compared visually. The comic-strip form, defined as j u x t a p ose d i m ages i n d e l i b era t e se q u e n c e ( M c C l o u d 1 9 9 3), h as a ri c h v o c a b u l ary f or e x pressi ng b o t h t e m p ora l a n d sp a t i a l re l a t i o ns, a t a v ari e t y o f sc a l es. C o m i cs are a lso a narrative form, meaning that they lend themselves to expressing the vicissitudes of intention in Bruners phrase. In plainer terms, stories deal w ith characters w ith goals, their attempts to reali z e those goals, and their success or failurea format w hich nicely supports the activity of agent systems. T h e story b o ards a uto m ati c a l l y ge n erate d b y D A o n l y scratc h th e surfa c e of th e representational and narrative language available. A storyboard is composed of a sequence of panels, each of w hich represents some segment of time in the evolution of the agent system. Panels can contain a variety of relevant types of information, such as graphic snapshots of the changing w orld that the agents are manipulating, textual description of the action (modeled after comic-strip captions), or other representations of activity. In ge n era l , th ere is to o m u c h go i ng o n i n a n age nt syste m to p ut e v ery age nt a n d e v ery action in a storyboard. Thus the problem of storyboard generation requires selectivity i n terms of th e i nform ati o n d isp l a y e d , as w e l l as th e a b i l ity to tra nsl ate e v e nts i nto su ita b l e gra p h i c re prese ntati o ns. T h e syste m m ust se l e ct w h i c h m o m e nts to tra nsl ate i nto p a n e ls, a n d w h at details of those moments are significant enough to take up space in the storyboard. T h e stra t egy use d t o ge n era t e D A st ory b o ards is t o e m p h asi z e c h a nge a n d t h e age n ts responsible for it. Each panel of a storyboard represents a moment in w hich the w orld changes, and the panel includes both the results of that change (in the form of a snapshot of the relevant parts of the w orld) and information about the agents responsible for the changes. There are too many agents involved in a typical step to display them all, so further selectivity is called for. The generator chooses agents from the top and bottom of the agent hierarchy that reflect the w hy and ho w behind the actions. This selectivity is in contrast w ith the more direct, lo w er-level representations used in the fu l l age nt d isp l a y (se e 5 . 3 . 3). T h ese ta k e d iffere nt a p pro a c h es to i l l ustrati ng th e sa m e th i ng, namely agent activity. The agent graph display is intended to be a direct, transparent, and literal picture of the agents, w hile the storyboard is intended to tell a story about agent activity. Thus the displays are quite different, albeit with certain common features. 162 Agents

F igure 5 . 1 4 is a n e x amp l e of a fa irl y simp l e story b o ard , i l l u str a t i n g a s e q u e n c e o f a c t i o n fr o m t h e gr a p h i c t e m p e r a t u r e c o n v ersi o n pro b l e m (se e se c t i o n 5 . 2 . 5 . 1). Ea c h p a n e l o f a storyboard represents a major cycle, a reasonable choice given that a m a j o r c y c l e c o rr e s p o n d s t o a u n i t o f w o r l d t i m e . H o w e v e r , storyboard panel time does not include a panel for every major cycle o f t h e age n t i n t erpre t er. O n l y m a j or c y c l es t h a t a c t u a l l y resu l t i n c h a nge to th e w orl d are i n c l u d e d , or i n oth er w ords, m a j or c y c l es that include no successful executions of w orker agents are excluded. T h i s i s t o c o n s e r v e s p a c e , t o k e e p t h e n a rr a t i v e i n t e r e st i n g ( b y o m i t t i ng p a n e ls w h ere n o t h i ng v isi b l e h a p p e ns) a n d t o l i m i t t h e d isp l a y t o t h e m ost sa l i e n t i n f orm a t i o n . F or e x a m p l e , t h e sa m p l e st o r y b o a r d s h o w n h a s 6 p a n e l s , b u t w o u l d h a v e 1 4 i f a l l m a j o r cycles were included. The omitted major cycles include agent activity, but in these cycles all agents fail and so take no action in the world. This policy has interesting narrative consequences. As it stands, each panel of the storyboard represents a moment of change in the w orl d . If t h e e x c l u d e d st e ps w ere i n c l u d e d , t h e st ory b e i ng t o l d w ould be more internal, reflecting not just the actions of the agents, but their internal starts, pauses, proposals, and failures. This level of d e t a i l m igh t b e o f v a l u e u n d er c ert a i n c irc u mst a n c es, b u t f or t h e prese nt p urp oses, th e prese ntati o ns of su c h i ntern a l d eta i l w i l l b e m i n i m i z e d (as i m p l e m e n t e d , t h e st ory b o ard ge n era t or h as usersettable sw itches that control the level of detail presented). Ea c h p a n e l i n c l u d es a sn a psh o t o f t h e c h a n g e d p a r t s o f t h e w orld, w hich may include both changes to graphic actors or changes t o t h e v a l u es o f o t h er b o x es. Si n c e t h e p i c t ure is n o t e n o ugh t o convey the reasons and sources of change, panels must also include some information about the agents responsible for the action in the panel. Listing all agents involved in a single cycle w ould be too much d eta i l . T h e syste m se l e cts th e age nts th at b est c o n v e y th e h o w a n d t h e w h y b e h i n d t h e a c t i o n o f t h e p a n e l . In pra c t i c e , t h is m e a ns including the w orker agents that actually performed the action (the h o w ) a n d t h e t o p-l e v e l age n ts t h a t t h e w ork ers are w ork i ng f or, w h i c h c o n v e y th e p urp ose (th e w h y) of th e a cti o n . T h e effe ct is to i n c l u d e b o t h t h e u l t i m a t e go a l or p urp ose o f t h e a c t i o n a n d t h e concrete physical events that w ere taken to reali z e it, w hile omitting the intermediate stages of computation. A lso included are any top-level agents that have experienced a change in their state as a result of the action of the major cycle, even i f t h e y t h e mse l v es h a v e n o t t a k e n a c t i o n . In pra c t i c e t h is m e a ns age nts th at w ere satisfi e d b ut h a v e b e c o m e u nsatisfi e d d u e to th e Agents

Figure 5.14: A storyboard.

163

a c t i o n o f a n o t h er age n t (t h a t is, t h ere h as b e e n a go a l c o n f l i c t; se e se c t i o n 5 . 2 . 6 . 2). T h e narrative rationale for including these is to illustrate the further effects of the panels action, beyond the immediate physical effects. G enerally such agents w ill become the active agents of the next panel, so this is also a device for linking the panels of the storyboard together. Panels illustrate changes Each agent that is sho w n in a i l l ustra t i ng t h e st a t e o f t h e information sho ws that some in agent state by using a variant of the usual agent icon notation. panel is sho w n w ith a pair of icon sets, separated w ith an arro w , age n t b e f ore a n d a f t er t h e a c t i o n o f t h e p a n e l . T y p i c a l l y t h is agents w ent from being satisfied to unsatisfied, or the reverse.

Figure 5.15: The first panel of the storyboard.

T h ere are si x p a n e ls i n th is e x a m p l e story b o ard , w h i c h is a re c ord i ng of a cti v ity i n th e c o nstra i n t syst e m sh o w n i n F igure 5 . 1 0 . T h e a c t i o n b egi ns j ust a ft er t h e user h as m a d e a c h a nge (b y m o v i ng th e p ositi o n of th e first b ar) b ut b efore th e age nts h a v e h a d a c h a n c e to resp o n d to th e c h a nge . T h is state is sh o w n i n panel-1. The changes sho w n reflect the first activation of the various top-level task agents involved in this system. A ll the agents except a7 have managed to satisfy themselves. a7s task is to k e e p th e re cta ngl e sl ots of bar consistent. Since bar/xpos has changed, a7 is no longer consistent. N ote that a4 is satisfied and has succeeded in panel 1, indicating not only that the value of bar/bottom is set at 200 (at the level of the baseline) but also that, since a4 has run, it w ill be

164

Agents

att e m pt i ng t o h o l d the slot at that value throughout the computation. This has consequences for the next panel. In the next p a n e l , a7 i s a c t i v a t e d a n d su cceeds in becoming satisfi e d . B y o p e ning up the box repr e s e n t i n g a7, w e c a n se e th at it w as the w orker agent a29 t h a t b r o u g h t Figure 5.16: Panel 2. this about by alteri ng t h e ysiz s l o t o f bar. This omits much of the internal agent activity involved in accomplishing the end state, such as a n a t t e m p t t o sa t isf y a7 b y s e t t i n g bar/bottom i n s t e a d o f bar/ysiz . T h is a tt e m p t f a i l e d because it came into conflict w ith the previously successful (and more determined) agent a4. a29 s a c t i o n h a s satisfi e d a7 b u t h a s also caused a6, w h o re l ates th e v erti c a l s i z e o f bar t o t h e v a l u e o f t h e Fahrenheit s l o t , t o become unsatisfied. In panel-3 a similar pattern is rep e a t e d . a6 s a t i s f i e d itself by changing the v a l u e o f Fahrenheit, c a u s i n g a11 , w h i c h re l a t es t h e v a l u es o f Fahrenheit a n d centigrade, t o b e come unsatisfied.

Figure 5.17: Panel 3.

Since Fahrenheit is not a graphic slot, the system cannot illustrate the action of this panel w i t h a sn a psh o t o f t h e a c t ors i n v o l v e d . Inst e a d , i t se l e c ts t h e a p pro pri a t e b o x es a n d t h e ir surrounding context. Agents 165

Figure 5.18: The final panel of the storyboard.

This pattern of propagating goal conflicts and resolutions continues in successive panels. In panel-4, a11 s e t s centigrade to its c orre ct v a l u e . In panel-5, th e w a v e of c h a nge pro p agates b a c k i nto th e gra p h i c p art of th e w orl d , c a usi ng a c h a nge i n bar-1s vertical si z e. Finally, in panel-6, bar-1s vertical position is adjusted w ithout violating any further constraints, so the agents finally become quiescent, and the story is complete.

5.4

Additional Examples of Agent Systems

Some additional examples of agent based systems are presented here. The first t w o are a ga m e a n d a si m u l a t i o n t h a t use t h e si m p l er f orms o f age n ts, w h i l e t h e rest are b u i l t usi ng D ynamic Agents.

166

Agents

5.4.1

A Video Game

Figure 5.19: A video game.

T h is si m p l e v i d e o ga m e w as c o nstru cte d b y a n o v i c e user ( w ith assista n c e) fro m sets of pre-b u i lt c o m p o n e nts. T h e c o m p o n e nts i n th is c ase c o m e fro m a l i brary d esign e d for videogames w hich includes behaviors such as motion, shooting and collision detection, agents that implement keyboard commands, and the score actors. In this game, t w o players attempt to drive each other back w ards by shooting fruit at each other. Each player controls a turtle from the keyboard. H ere one turtle is open to reveal its agents, w hich are mostly if-then agents, a variant of goal agents (see section 5.1.2). The left-key-agent is built out of a general purpose key agent, so the constructor needs to fi l l i n o n l y th e k e y a n d th e a cti o n , w h i c h is p erform e d re p e ate d l y w h e n e v er th e k e y is h e l d do w n. In this case the left-arro w key results in the turtle moving left. A nother agent, if-touch, detects w hen a player is hit by an opponent and moves back w ards.

Agents

167

5.4.2

A Physical Simulation

Figure 5.20: An orbital simulator.

Physical forces can be modeled by simple agents. This example sho ws a simulation of a sp a c esh i p orb iti ng a p l a n et. It w as asse m b l e d fro m a k it of p arts th at pro v i d e b asi c p h ysi c a l simulation capabilities, such as velocity and acceleration. A simple agent, move, pro v i d es t h e ship w ith motion by constantly incrementing its position by t w o velocity variables. The planet exerts its force on the ship through another simple agent, gravity. Because the gravity agent is p art o f t h e p l a n e t , c l o n i ng t h e p l a n e t cre a t es a n o t h er gra v i t y so urc e w h i c h w i l l h a v e a n immediate effect on the ship. The user can control the ships bearing and acceleration (w ith sound effects) from the keyboard, w hich is monitored by other agents (i.e. left-key) as i n th e video game example. This example illustrates ho w simple agents can be used to simulate physical systems, w hile gi v i ng t h e user d ire c t t a ngi b l e a c c ess t o t h e v ari a b l es (sl o ts) a n d f orc es (age n ts) i n v o l v e d . Simulations like this admit to a variety of different modes of use: as a game in which the object is to put the spaceship in a stable orbit around the planet w ithout colliding w ith it or shooting off the screen; as a vehicle for experimentation (say, by observing the effects of different masses, gravitational constants, or la ws of gravity); or as both an example and kit of parts for building further simulations.

168

Agents

5.4.3

A More Complex Graphic Constraint Problem

Figure 5.21: A complex constraint example.

This example sho ws a more complex constraint problem, involving the kinds of tasks found in realistic graphic design problems. The scenario is based on one presented in (M ac N eil 1989), w hich involves designing a series of labels for a line of pesticides. H ere w e see an example of a l a b e l f or re p e l l i ng p e ngu i ns. T h is syst e m i n v o l v es a b o u t 2 2 t o p-l e v e l t asks a n d t y p i c a l l y ge n erates aro u n d 1 0 0 age nts. T h e to p tasks sp e c ify re l ati o ns amo ng th e p ositi o n a n d si z e of the four graphic elements in the design. For example, these user tasks:

c o nstra i n th e gra p h i c (pict) t o b e s q u a r e , a n d t o h a v e i ts l e f t s i d e a b u t t i n g t h e w o r l d Penguin (pestname). O ther tasks include rectangle c o nstra i nts for a l l th e o b j e cts, a n d textblock constraints that ensure that the text actors are exactly large enough to contain their text Agents 169

(th ese e nsure th at if th e user sh o u l d a lter th e te xt, th e o b j e cts w i l l a d j ust th e mse l v es accordingly). Still others specify the left and right edge alignments, hold the bars vertical height to be 1/3 the height of the main text, and ensure that the t w o w ords maintain the relative scale of their font si z e. This example illustrates a w ell-kno w n problem w ith graphic constraint systems. A typical constrained diagram involves far more individual constraints than can be easily specified by hand. D ynamic Agents ameliorates this problem a bit by allo w ing abstract constraints, such as within, so that fe w er individual constraints have to be specified. Still, the task can be daunting. O n e p ossi b l e so l u t i o n is t o h a v e age n ts t h a t c a n cre a t e c o nstra i n t age n ts b y a u t o m a t i c a l l y inferring them from user examples, as in (Kurlander and Feiner 1991).

5.4.4

A Creature in Conflict

This is a fairly simple behavioral system, w hich illustrates arbitration bet w een competing behaviors. Task-1 specifies that the turtle should attempt to get to the goal, w hile task specifies th at th e turtl e is to a v o i d o v erl a ps w ith o b j e cts. T h ese t w o go a ls are c o ntra d i ctory (b e c a use ge tt i ng t o t h e go a l re q u ires o v erl a p p i ng w i t h i t), b u t o f e v e n gre a t er c o n c ern is t h e b arri er obstacle which lies in between the turtle and its goal. This example indicates the use of determination in animal behavior w orlds. W hen the t w o tasks specify conflicting actions, the w inner is the agent w ith the higher determination. In this case, determination can be controlled by the user through annotations to the user task objects. I f t h e get-to task h as h igh er d eterm i n ati o n , th e turtl e w i l l bra v e l y p e n etrate th e u n p l e asa nt obstacle on its w ay to the goal, w hile if the avoid-overlaps task is stronger, as in the figure, it w i l l e n d u p go i ng aro u n d i t . T h is i l l ustra t es h o w d e t erm i n a t i o n m a y b e se t b y t h e user as annotations to tasks.

Figure 5.22: A conflicted creature.

T h e get-to t ask a n d t e m p l a t e are d escri b e d i n se c t i o n 5 . 2 . 5 . 3 . Avoid-overlaps i s o n l y satisfi e d w h e n th ere is n o o v erl a p b et w e e n its ?creature argu m e n t a n d a n y o t h er a c t or. Its 170 Agents

action is a script that backs off from the overlap, then turns randomly and moves forw ard. The effect of this is to move in a rather groping fashion around the edge of the obstacle. (deftemplate ( a v o i d - o v e r l a p s ? c r e a t u r e ) :satisfied (no? (ask ?creature :overlap-sensor)) :action `(repeat (script (do (ask ?creature :forward -15)) (do (ask ?creature :turn-right (arand 0 180))) (do (ask ?creature :forward 15)))))

5.4.5

An Ant

T h is is a sl igh t l y m ore c o m p l i c a t e d b e h a v i ora l si m u l a t i o n , b ase d o n t h e re a l ist i c a n t si m u l ati o n of A gar (Tra v ers 1 9 8 8). It i l l ustrates so m e oth er m eth o ds for orga n i z i ng m u lti p l e goals. In this case, the goals are controlled by special tasks that sequence them. script a n d try tasks specify a series of subtasks to be performed in order. This is a different style than in the previous example, w here both agents w ere active concurrently and conflict w as resolved at the slot level using determination.

Figure 5.23: An ant..

The top-level be-an-ant task arranges three subgoals in a strict priority. The latter ones w ill not be processed until the earlier ones are satisfied. The use of and-script r a t h e r t h a n script m e a ns t h a t i f t h e e arl y t asks i n t h e se q u e n c e b e c o m e u nsa t isf i e d (f or i nst a n c e , i f find-food moves and thereby makes avoid-walls become unsatisfied) then control w ill revert to the earlier goal (see section 5.2.4.1). A plain script goal could cause the ant to get stuck in its find-food subtask and w ander off the screen. (deftemplate ( b e - a n - a n t ? a ) :action '(repeat (and-script Agents 171

(eat ?a) (avoid-walls ?a) (find-food ?a)))) This some w hat oddly-structured eat age n t is sa t isf i e d w h e n t h e a n t is n o t o n t o p o f a n y food, and w ill eat any such food until it is gone. The actual eating is accomplished by a method named eat. (deftemplate (e a t ? a ) :satisfied (no? (ask ?a :on-food)) :action '(do (ask ?a :eat))) A n avoid-walls agent w ill be satisfied w hen the ant is not touching any w alls, and backs a w ay from w alls w hen necessary. (deftemplate ( a v o i d - w a l l s ? a ) :satisfied (no? (ask ?a :wall-sensor)) :action '(do (ask ?a :forward -10) (ask ?a :turn-right (arand 180 30)))) The following find-food agent is satisfied w hen the ant i s touching food 19 . N ote the duality bet w een script a n d try . Try is usefu l for pre c o n d iti o n-b ase d su btasks th at are l i k e l y to fa i l , script (a n d and-script) w orks w ell w ith goal-based tasks. N ote that the goal-tasks like avoidwalls could easily be expressed in precondition/action form rather than as a goal. U nfortunately it is hard to mix these t w o types of task underneath one manager. (deftemplate ( f i n d - f o o d ? a ) :satisfied (yes? (ask ?a :on-food)) :action '(repeat (try (find-food-forward ?a) (find-food-left ?a) (find-food-right ?a) (find-food-random ?a)))) (deftemplate ( f i n d - f o o d - f o r w a r d ? a ) :precondition '(and (yes? (ask ?a :right-eye)) (yes? (ask ?a :left-eye))) :action '(do (ask ?a :forward 10))) (deftemplate ( f i n d - f o o d - l e f t ? a ) :precondition '(yes? (ask ?a :left-eye)) :action '(do (ask ?a :turn-left 10))) (deftemplate ( f i n d - f o o d - r i g h t ? a ) :precondition '(yes? (ask ?a :right-eye)) :action '(do (ask ?a :turn-right 10))) (deftemplate ( f i n d - f o o d - r a n d o m ? a )

19 N ote that this means that the and-script age nt th at m a n ages th e be-an-ant goal can never itself be satisfied, because it contains t w o contradictory terms. This is permissible, and it means that the repeat around the and-script is not strictly necessary.

172

Agents

:action '(do (ask ?a :turn-left (arand 0 90)) (ask ?a :forward 20)))

5.4.6

A Recursive Function

W hile the D A system deliberately de-emphasi z es computation in the literal sense, it is still c a p a b l e of p erf orm i ng t h e re c ursi v e c o m p ut at i o ns t h at are t h e sp e c i a lt y of pro c e d ura l a n d functional languages. Because D A tasks cannot return values, making this w ork requires a bit of tri c k ery , w h i c h is t o use Li v e W orl d s h i erarc h y t o st ore i n t erm e d i a t e v a l u es i n t e m p orary b o x es.

Figure 5.24: Computing factorial with agents.

(deftemplate ( f a c t o r i a l ? x ? x - f a c t ) :name fact-end-test :precondition '(= ?x 1) :action '(<== ?x-fact 1)) (deftemplate ( f a c t o r i a l ? x ? x - f a c t ) :name fact-recurse :precondition (> ?x 1) :action (let ((temp (getb ?x-fact :iresult))) `(all (factorial (- ?x 1) (v ,temp)) (<== ?x-fact (* ?x (v ,temp)))))) T w o t e m p l a t e s d e f i n e a g e n ts t h a t i m p l e m e n t t h e e n d -t e st a n d r e c u rs i o n st e p s o f t h e standard recursive factorial definition. The recursion step involves creating an intermediate box, as an annotation of the final result, and posting t w o subtasks: one to compute the intermediate result that w ill be stored in the ne w box; and another to relate this intermediate result to the final result. The user task specifies that anytime the value of n changes, fact-n w ill be set to the factorial of the ne w value, w ith intermediate result boxes being created as necessary. N ote that the tasks here involve one-w ay equality (<==) rath er th a n th e e q u a l ity re l ati o ns fo u n d i n th e constraint examples. This means that changing fact-n w ill just result in a failed and unsatisfied task, rather than an attempt to compute the (generally undefined) inverse of factorial.

Agents

173

5.4.7

A Scripted Animation

W hen young users first encounter a system that allo ws them to create moving objects, their first impulse is often to create a story based on simple movements: Sam the elephant leaves his h o use , go es to th e p ark , th e n go es to sc h o o l , th e n go es b a c k h o m e . U nfortu n ate l y syste ms that are purely reactive make this simple task difficult. In D A , the script c o nstru c t a l l o w s t h is task to be done naturally.

Figure 5.25: A scripted journey.

(deftemplate ( j o u r n e y ? c r e a t u r e ? i t i n e r a r y ) :action `(script ,@(mapcar #'(lambda (place) `(get-to ?creature ,place)) ?itinerary))) This template for journey tasks uses a Lisp macro to allo w the task to take a variable-length iti n erary , w h i c h is c o n v erte d i nto a script t ask w i t h t h e a p pro pri a t e n u m b er o f argu m e n ts. Because it uses get-to tasks (see above), it w orks even w hen the destinations are in motion the train w ill simply re-orient as necessary. The effect is that the train w ill seek its goal, even if it is moving, but as soon as it touches the goal, the train w ill go on to seek the next goal in its script.

174

Agents

5.4.8

BUILDER in the Blocks World

Figure 5.26: Stacking blocks.

T h e so l e user task i n th is w orl d is play-with-blocks, w h i c h h as t w o su b ord i n a t es, build and wreck. The all construct specifies that they should both be activated at once. (deftemplate ( p l a y - w i t h - b l o c k s ? a ) :action `(all (build ?a) (wreck ?a))) The add task is the basic block-building script, w hich serially finds a block, gets it, finds the top of the to w er, and puts the block there. Build simply repeats the add operation until a block intersects the headroom object. (deftemplate ( b u i l d ? a ) :satisfied (yes? (ask #^/cast/headroom :block-sensor)) :action '(repeat (add ?a))) (deftemplate ( a d d ? a ) :action `(script (find-free-block ?a) (get-obj ?a) (find-tower-top ?a) (put-obj ?a))) The find-free-block a n d find-tower-top agents call up behaviors written in the lo w er-level l a ngu age . T h ese fu n cti o ns use th e m ark er as a k i n d of se nsor, b ase d o n th e i d e a of a v isu a l routine ( U llman 1984). For instance, find-free-block m o v es th e m ark er to th e l eft h a n d si d e of the w orld, just above the table, and moves it to the right until it encounters a block. If so, it moves up until it detects either empty space (in w hich case it returns the value of the block it w as just on) or another block (in w hich case it continues its left w ard search). These operations Agents 175

c o u l d h a v e b e e n w ri tt e n i n D A , b u t h a v e b e e n i m p l e m e n t e d as m e t h o ds i n t h e u n d erl y i ng language for speed. (deftemplate ( f i n d - f r e e - b l o c k ? a ) :action '(do (ask (ask ?a :marker) :findfree))) (deftemplate ( f i n d - t o w e r - t o p ? a ) :action '(do (ask (ask ?a :marker) :findtop))) Get-obj and put-obj make use of the marker object to find their argument (the object to get or the place to put it). So get-obj first m a k es th e h a n d get-to to the marker, then activates a grasp task, w hich calls an underlying method that effectively grabs an underlying block object (gra b b i ng is i n fa ct i m p l e m e nte d b y a se p arate si m p l e age nt, w h i c h c o nti n u a l l y m o v es th e grabbed block to the location of the hand as it moves). (deftemplate ( g e t - o b j ? a ) :action `(script (get-to ?a (ask ?a :marker)) (grasp ?a))) (deftemplate ( p u t - o b j ? a ) :action `(script (get-to ?a (ask ?a :marker)) (release ?a))) (deftemplate ( g r a s p ? a ) :satisfied (ask ?a :grasped-object) :action '(do (ask ?a :grasp))) (deftemplate ( r e l e a s e ? a ) :satisfied (null (ask ?a :grasped-object)) :action '(do (ask ?a :release))) Wreck w orks by finding the to w er top, moving the hand to it, and systematically scattering t h e b l o c ks. Si n c e wreck is a c t i v a t e d c o n c urre n t l y w i t h build, w e n e e d t o g i v e i t a l o w e r determination so that build has a chance to w ork. O nce build is satisfied (w hich happens w hen the to w er is tall enough), then it w ill no longer attempt to run and wreck w ill have a chance. In fact, since wreck is only inhibited w hen there is a slot that both build a n d wreck are attempting to change, wreck might occasionally sei z e control of the hand w hile build is not moving it (for instance, w hen it is moving the marker). This implementation of unconscious destructive urges is considered a feature. If stricter control is necessary, script c a n b e use d i n play-with-blocks to ensure that wreck is dormant until build is done. (deftemplate ( w r e c k ? a ) :determination .9 :action ...)

5.5

Discussion

The design of the dynamic agent system and its predecessors attempts to w eave together a number of different ideas and influences: 176 the deliberate use of anthropomorphic metaphors; Agents

the po w er and generality of procedural programming languages; the responsiveness of behavioral control net w orks; the declarative po w er of constraint systems.

T h e d e v e l o p m e nta l h istory of th e age nt syste ms b ega n w ith th e i d e a of l o ose l y a n t hro p o m orp h i c age n ts. I b u i l t se v era l b e h a v i ora l c o n tro l syst e ms usi ng t h e m , a n d t h e n atte m pte d to i ntegrate th e age nt i d e a w ith a m ore ge n era l-p urp ose l a ngu age . T h is i n v o l v e d thinking about agents driven by goals rather than by situations, and led to the reali z ation that agents could be a good basis for constraint solving systems.

5.5.1

DA as a Procedural Language

D A provides equivalents to most of the basic control and modularity constructs found in procedural languages: sequencing, conditionals, iteration, abstraction, and recursion. These a p p e a r i n d i f f e r e n t f o r m s t h a n t h e y d o i n p r o c e d u r a l l a n g u a g e s , h o w e v e r . It e r a t i o n , f o r example, is to some extent implicit in the concept of an agent. Therefore rather than having an explicit iteration construct, D A provides a construct, repeat, w hich does not generate a loop in the w ay imperative loop constructs do but instead influences the behavior of the iterative agent interpreter. It is w ort h c l ari f y i ng t h e c o n c e p t u a l re l a t i o nsh i p b e t w e e n D A age n ts a n d pro c e d ures. A ge n ts are c l e arl y si m i l ar t o pro c e d ures (or m ore pre c ise l y , pro c e d ure i n v o c a t i o ns): b o t h perform tasks, both are capable of being anthropomorphi z ed; agents can invoke other agents a n d t h us cre at e a h i erarc h y si m i l ar t o a tre e of pro c e d ure i n v o c at i o ns. H o w e v er, t h ere are i m p ort a n t d i ff ere n c es. A ge n ts c a n b e ru n n i ng c o n c urre n t l y , w h ere as o n l y o n e t hre a d o f a procedure tree can be active at any one time. Agents are persistent, and are driven iteratively and thus capable of autonomous activity. A n agents supervisor can activate or deactivate it, but w hile active it is in charge of its o w n operation. W hen an agent has a goal, this means that it is in effect constantly monitoring the goal and taking action to achieve it w hen necessary. O ne notable feature of procedural languages that is missing from D A is the notion of the v a l u e o f a n e x pressi o n . In D A , t asks d o n o t h a v e v a l u es, a n d a l l c o m p u t a t i o n is stri c t l y b y means of side-effects. The choice to omit values w as made to emphasi z e the notion of an agent as something that performs an action , rather than as something that computes a value. In part this w as a reaction (perhaps an over-reaction) to the emphasis on value computation found in f u n c t i o n a l or m ost l y-f u n c t i o n a l l a ngu ages, as w e l l as so m e a tt e m p ts t o m o d e l age n ts i n a functional style (see section 3.4.2.4) w hich did not, to my mind, capture agency adequately. A nother reason for de-emphasi z ing the return of values w as the accessibility of Lisp substrate for doing actual computation w hen necessary. Progra ms t h a t n orm a l l y w ork b y re t urn i ng v a l u es c a n b e tra nsf orm e d i n t o e q u i v a l e n t progra ms t h a t w ork v i a si d e-e ff e c ts, b y cre a t i ng t e m p orary b o x es t o h o l d t h e i n t erm e d i a t e values (see the factorial example above). It might be possible to integrate value-returning back i n t o t h e l a n g u a g e . It d i d n o t f i t i n t o e a r l i e r a g e n t s y st e ms, i n w h i c h a g e n ts w e r e t o t a l l y

Agents

177

i n d e p e n d e nt, b ut si n c e D A preserv es a c a l l i ng h i erarc h y th e i d e a th at a c a l l e d age nt c o u l d return a value w ould be more natural.

5.5.2

DA as a Behavioral Control System

A s a b e h a v i ora l c o ntro l syste m , D A offers c a p a b i l iti es ro ugh l y e q u i v a l e nt to th ose of its predecessor Agar, Brooks subsumption architecture (Brooks 1986), Pengi (Agre and C hapman 1 9 8 7) or te l e o-re a cti v e syste ms ( N i lsso n 1 9 9 4). A ge nts c a n i m p l e m e nt a set of resp o nses to c o n d iti o ns i n th e w orl d th at i m p l e m e nt a d a pti v e b e h a v i or. U n l i k e th ese syste ms (e x c e pt for Agar), D A uses a hierarchy of agents for control. This makes writing agents simpler since sets o f b e h a v i o r s c a n b e t r e a t e d a s a g r o u p ( f o r i n s t a n c e , s e e h o w get-to i s u s e d a s a prepackaged behavior in several of the examples above), and it increases the salability of the system. A nother advantage of D A in comparison to other behavioral control systems is built in structures for implementing sequences. D A s m e t h o d o f h a n d l i ng i n t er-age n t c o n f l i c t is so m e w h a t d i f f ere n t t h a n t h ese o t h er systems, most of w hich require hard w ired conflict links or other methods of arbitration, if they tre at c o nfl i ct at a l l . D A d ete cts c o nfl i cts at th e l ast p ossi b l e m o m e nt, th at is, o n l y if age nts actually attempt to simultaneously take incompatible actions (see section 5.2.6). W hen a conflict is d ete cte d , arb itrati o n is p erform e d b ase d o n th e d eterm i n ati o n of th e age nts. T h e d eterm i n ati o n of age nts is usu a l l y fi x e d , a lth o ugh si n c e it is sp e c ifi e d b y a regu l ar sl ot it is p ossi b l e to a lter its v a l u e b y oth er age nts (sa y , a h u nger-si m u l ati ng age nt th at w o u l d sl o w l y increase the determination of a food-finding agent). M o r e s o p h i st i c a t e d m e t h o d s o f h a n d l i n g d e t e r m i n a t i o n a r e p o ss i b l e w i t h i n t h e D A frame w ork. O ne possibility w ould be to use a system similar to M aes A ction Selection algorithm ( A S), w h i c h spre a ds a c t i v a t i o n e n ergy (m ore or l ess e q u i v a l e n t t o d e t erm i n a t i o n) b e t w e e n b e h a v i or m o d u l es b ase d b oth o n c urre nt go a ls a n d th e state of th e w orl d ( M a es 1 9 9 0). T h is algorithm provides a flexible w ay for modules to string themselves into sequences of action in an emergent fashion. There are some differences in style and goals bet w een this w ork and D A that make this complicated. F irst o f a l l , A S is e x p l i c i t l y n o n-h i erarc h i c a l . T h ere are n o m a n agers or b ure a u cra t i c m o d u l e s ; i n st e a d a l l m o d u l e s e x i st i n a n u n l a y e r e d n e t w o r k , c o n n e c t e d b y s u c c e ss o r , predecessor, and conflict links. To generate these links, AS modules must specify in detail both their preconditions and the expected results of their actions, expressed as lists of conditions. D A is some w hat more flexible, allo w ing agents to be controlled by either preconditions or goals (expected results). D A does no back w ards chaining through the precondition, relying instead on supervisory agents to order goals appropriately. O nly one AS module can run at any one time, so all are essentially in competition w ith one another to run, w hich contrasts w ith D A s emphasis on concurrency. W h ere as A S d e l i b erate l y a v o i ds pre-sp e c ifi e d se q u e n c es of b e h a v i or, preferri ng th em to emerge from the interaction of the available behavior modules, the w orld, and the goals of the creature, being able to specify sequences explicitly is a design goal of D A . This reflects a deeper difference in the purpose of the tw o schemes. AS is deliberately done in an emergent or bottom178 Agents

u p st y l e . T h i s i s c e rt a i n l y a w o rt h w h i l e s c i e n t i f i c g o a l . H o w e v e r, e m e rg e n t s y st e ms a r e n o t ori o usl y d i f f i c u l t t o u n d erst a n d , si n c e t h e ir k n o w l e dge a n d a c t i v i t y is c o n c e a l e d as a c o l l e c t i o n o f o p a q u e n u m e r i c a l v a l u e s . T h i s m a k e s t h e m l e ss s u i t a b l e a s a v e h i c l e f o r e n c o uragi ng c o nstru c t i o n ist n o v i c e progra m m i ng, w h i c h is t o p-d o w n (i n so m e se nse) b y nature. O f c o urse D A m ust m a k e use o f n u m eri c a l v a l u es t o o , as a l ast-resort m e c h a n ism f or reso l v i ng c o nfl i cts. In a n y d istri b ute d c o ntro l syste m , su c h v a l u es a ct as a lingua franca f o r making comparisons bet w een agents. H o w ever, the semantics of such values are difficult to define and their opacity makes systems that use them hard to understand. O ne alternative is to use symbolic statements of preference: that is, explicitly state that behavior a h as pri ority o v er behavior b , rather than hiding this fact behind numbers. This technique has been used in the Pengi and Sonja systems (Agre and C hapman 1987) (C hapman 1991). Symbolic Preferences are e a s i e r t o u n d e rst a n d , b u t m u st b e s p e c i f i e d e x p l i c i t l y f o r e v e r y n e w b e h a v i o r . A n o t h e r advantage they have is that they are easily specified by the user using a conflict display like the one described in section 5.1.1.3.

5.5.3

DA as a Constraint System

D A h as b e e n sh o w n t o b e c a p a b l e o f p erf orm i ng so m e o f t h e f u n c t i o ns o f a c o nstra i n t system. Tasks can be declarations of relationship, and templates can be written that generate agents that enforce these relationships. Since templates can take arbitrary action, it is difficult to characteri z e exactly ho w po w erful the constraint system is. The ability to match task patterns a n d ge n erate n e w tasks is si m i l ar to th e e q u ati o n a l-re w riti ng te c h n i q u es of B ertra n d (Le l er 1988). This ability can be used to implement the simple constraint-solving technique of local propagation of kno w n states, as seen in the temperature conversion example and else w here (se e se c t i o n 5 . 2 . 7). It c a n a lso b e use d t o i m p l e m e n t sp e c i a l-p urp ose m e t h o ds f or so l v i ng c o nstra i nts th at c a n n ot b e p erform e d b y l o c a l pro p agati o n . F or i nsta n c e , a c o nstra i nt of th e form (= a (* b b)) cannot be solved for b by local propagation, but D A allo ws templates to be added that kno w ho w to compute square roots in this particular case. Inequalities are another instance w here D A s agent-based approach w orks w ell. W hile they cannot be solved in general, special-purpose methods can be created to handle them in w ays appropriate to the domain. T h e m a i n pro b l e m w ith D A is th at its c o ntro l syste m is l i m ite d a n d ofte n h ard to understand. H ere is an example that illustrates some of these limits. The w orld belo w contains t w o rectangle tasks as w ell as the within task that is visible (see section 5.2.5.2). This latter task specifies that the solid rectangle is to be contained w ithin the hollo w rectangle. The effect is to allo w the user to drag either object around, and have the other one adjust its position or si z e accordingly.

Agents

179

Figure 5.27: The within world, in working and anomalous states.

H o w ever, if the user should increase the si z e of the inner solid rectangle, the system fails to come to a stable state (that is, a state in w hich all top-level tasks are satisfied). Instead, both objects begin traveling to the left until they are off the stage! The reason for this behavior is a limitation in the w ay conflicts are detected and handled. A w orker agents action w ill be suppressed (that is, fail) only if there is a slot conflict involved that is, if it attempts to alter a slot that another more determined agent has laid claim to. As it turns out, in the situation above there is a conflict but it is a goal conflict: agents interfere w ith e a c h oth ers go a ls, b ut a lter m utu a l l y e x c l usi v e sets of sl ots (se e se cti o n 5 . 2 . 6). T h erefore , rather than picking a better w ay of resolving the conflict, the agents just alternate their actions ad infinitum. There are several possible solutions to this problem: one is to support undoing an action. If an agents action could be w ithdra w n if it w as found to cause a goal conflict w ith a stronger agent, then it could be undone. A nother, perhaps more general technique is to employ another type of manager agent that is separate from the main hierarchy of agents and monitors it for looping behavior, and can intervene if necessary (this idea derives from the Society of M ind c o n c e p t o f a B -Bra i n ( M i nsk y 1 9 8 7)). In f a c t , t h ese i d e as w ere e x p l ore d i n v ari o us e arl y versions of D A , but rejected as too difficult to fit into the agent model. The current model is a compromise between power and simplicity.

180

Agents

5.5.3.1

Related Work

There is a large body of w ork on constraint-based problem solving, and a smaller one on i n t era c t i v e gra p h i c syst e ms b ase d o n c o nstra i n ts, i n c l u d i ng t h e c l assi c syst e ms Sk e t c h p a d (Sutherland 1963) and ThingLab (Borning 1979) as w ell as more recent efforts such as Juno-2 ( H e y d o n a n d N e lso n 1 9 9 4). G arn e t ( M y ers, G i use e t a l . 1 9 9 4), w h i l e n o t pro v i d i ng tru e constraints (it has so-called one-w ay constraints , w hich are more like spreadsheet cells or Live W orlds self-computing slots) is of interest because it also explores prototype-based object syst e ms i n t h e c o n t e x t o f i n t era c t i o n . T h i ngLa b , i n p art i c u l ar, is ori e n t e d t o w ards cre a t i ng dynamic simulations as well as static drawings. (Ishi z aki 1996) applied agents to problems of graphic design. The emphasis of this w ork w as different, ho w ever. Rather than solving static constraints, agents w ere employed to create dynamic designs, or to endo w graphic elements w ith responsive behavior. For instance, in a D ynamic N e ws D isplay, an agent w ould be in charge of creating and placing a headline w hen a ne ws story arrived, based on its contents and the current display. The system (called M odel of D ynamic D esign) had three levels of control, agents, strategies, and actions, w hich correspond roughly to top-level agents, manager agents, and w orker agents in D A . H o w ever, there is no concept of conflict resolution or constraint solving in the model.

5.5.4

DA and Anthropomorphism

D A agents are intended to be understood through animate metaphors. Recall that for our purposes animacy w as defined by three key properties: autonomy (the ability to initiate action); purposefulness (being directed to w ards a goal); reactivity (the ability to respond to changes in the environment).

These qualities are w oven into the w ay D A agents w ork. A n agent is continually clocked (subject to being activated by its superior), w hich allo ws it to take action w henever it needs to. It should be emphasi z ed that the clocking process in D A and the other agents systems exists in some sense at a level beneath the animate metaphor, in the sense that in a person, a heartbeat is something that is necessary for action but is not normally considered a factor in the process leading to action. The clocking process (based on animas in the simpler agent systems) does, in fact, serve to give the agents that are clocked the equivalent of both an energy source and a metronomic pulse that can be harnessed to drive action w hen necessary. This clocking allo ws a n age nt to a p p e ar a uto n omo us b y i n iti ati ng a cti o n at a n y time . It is e q u a l l y resp o nsi b l e for allo w ing agents to be responsive to changing conditions (indeed, autonomy and resp o nsi v e n ess are re a l l y t w o si d es o f t h e sa m e c o i n (se e se c t i o n 3 . 4 . 1). Purp ose f u l n ess is realized by allowing agents to be controlled by goal-like tasks. T h e a nthro p o m orp h i c i c o ns use d i n age nt b o x es serv e to i n d i c ate , i n a l i m ite d w a y , th e state of the agents vis-a-vis their goals and actions. T w o different displays w ere created that make use of these icons. The agent graph sho ws all the agents in the system in their hierarchical structure, and updates them as the system runs through its cycles. It can be used to w atch the Agents 181

a g e n ts st a t e s c h a n g e i n r e a l t i m e . T h e o t h e r f o r m o f d i s p l a y i s t h e st o r y b o a r d , w h i c h i s generated after the fact and selectively presents the dynamics of the agent system in a static narrative form.

5.5.4.1

Creation of Agents

O n e asp e c t o f t h e w a y t h e age n t syst e m w orks se e ms t o v i o l a t e t h e a n t hro p o m orp h i c metaphor, or at least strain it. This is the manner in w hich ne w agents come into being. W hen a template specifies that ne w tasks are to be created, ne w agents are also created to embody and supervise the tasks. H o w ever, this means that agents are constantly coming into being (and are discarded rather unceremoniously as garbage w hen they have outlived their usefulness). This is a rather callo w w ay to treat anthropomorphic beings! O f course, the ease of creating agents is also one of the chief features of D A , so this problem is fundamental in some sense. O n e w a y t o f i x t h is is si m p l y t o c h a nge t h e m e t a p h or a b i t , so t h a t age n ts are recruited instead of created. In this variant of the metaphor, tasks are created, but agents are dra w n from a p o o l o f pre-e x ist i ng age n ts t o d e a l w i t h t h e t asks as t h e y are n e e d e d . W h e n t h e t ask is completed, the agent (and any subordinates it might have recruited) are returned to the pool. W h i l e t h is m a y m a k e age n ts a p p e ar m ore l i k e re a l l i v i ng e n t i t i es, i t c o m p l i c a t es t h e implementation and its presentation. N o w there is a ne w entity, the pool, and there w ill be the problem of ho w many agents it should be staffed w ith, w hat happens w hen it runs out, and so forth . In both variants of the metaphor, an agent is a general-purpose w orker w ho can perform any task. The kno w ledge of ho w to perform these tasks come from templates (w hich might be m e t a p h ori c a l l y prese n t e d as m a k i ng u p a n e m p l o y e e s m a n u a l , w ere w e t o e x t e n d t h e corporate metaphor a bit more). A nother possible modification to the metaphor w ould be to conflate agents and templates. In this variant, an agent w ould be speciali z ed for particular tasks, and emerge from idleness to deal w ith them as necessary. The problem w ith this is that there m a y b e a n e e d f or m u l t i p l e age n ts o f t h e sa m e t y p e , so t h ere is st i l l t h e pro b l e m o f age n t creation, w hich no w cant even be handled by having a pool of general purpose agents (see the next section for further discussion). Perhaps agents could train other ne w hire agents in their expertise. A l l t h is sh o w s t h at t h e d et a i ls of t h e m a p p i ng b et w e e n t h e a n i m at e a n d c o m p ut at i o n a l domains is not at all straightforw ard. In this case the ease w ith w hich soft w are entities come into being, w hich is a principle source of the po w er of any programming system, is in direct tension w ith anthropomorphism.

5.5.4.2

Agents, Tasks, and Templates

The fact that there are three different but closely related entities in D Atasks, agents, and t e m p l a t esse e ms so m e w h a t u n f ort u n a t e . A l t h o ugh t h e y a l l serv e n e c essary a n d se p ara t e functions, it is confusing and can strain the anthropomorphic metaphor. W hile developing D A , I resisted the separation of agents and templates for a long time. M ost of the earlier prototypes did not have this distinction. In my earlier images of ho w the system 182 Agents

should w ork, based on Society of M ind, agents are both program specifications and concrete instantiated mechanisms. Rather than having procedural instantiations and bound variables, their arguments are supplied again by fixed hard w are buses called pronomes (M insky 1987, p226). This picture may be more biologically realistic (in the sense that functionality is closely l i n k e d to a p i e c e of h ard w are), b ut a progra m m i ng l a ngu age th at w orks th is w a y is se v ere l y h a n d i c a p p e d b y t h e l a c k o f b asi c t o o ls su c h as re c ursi o n . It is c o n c e i v a b l e t o a d d t h ese capabilities to a Society of M ind-based model w ith the addition of special stack memory that i n c orp ora t es K-l i n es f or re m e m b eri ng t h e st a t e o f age n ts, b u t t h is is a w k w ard . So m e e arl y implementations of agents did w ork this w ay. H o w ever, my devotion to realism gave w ay to a greater need for simplicity. W orking w ithout the separation betw een program and invocation felt like going back in time to older languages like F O RTRA N that did not support recursion. To address these problems, I developed the idea of templates as entities separate from agents. It m ight b e p ossi b l e to h i d e th is sp l it fro m th e user. F or i nsta n c e , it m ight b e p ossi b l e to combine the functionality of agents and templates, call the results agents, and allo w them to make copies of themselves, thus preserving the ability to support multiple instantiations. It is a lso pro b a b l y p ossi b l e t o d e-e m p h asi z e t asks as a se p ara t e e n t i t y , si n c e t asks are m ost l y matched one-to-one w ith agents. There still needs to be some w ay to talk about the specification of an agents job (the task) as separate from the agent itself, w hich includes a good deal of other information besides the task.

5.5.4.3

Are Agents Too Low-level?

E a c h a g e n t i s v e r y s i m p l e , j u st e m b o d y i n g a n e x p r e ss i o n fr o m t h e r a t h e r b a s i c t a s k l a ngu age a n d e x e c uti ng a si m p l e i nterpreter to a c h i e v e th e m . T h is si m p l i c ity m a k es for a n understandable system, yet it strains some w hat against the anthropomorphic metaphor. C an such simple things be thought of in animate terms? In particular, some constructs force us to p osit m ore p e o p l e i n th e age nt h i erarc h y th a n y o u m ight e x p e ct (i . e . th e repeat c o nstru c t forms an agent w hose only job is to tell its one subordinate to continue doing w hatever it is already trying to do 20). The graphic version of Fahrenheit/centigrade conversion, for instance, can use up to 70 agents to accomplish its task. O ne early version of D A attempted to deal w ith this problem by compressing tasks into an agent that w as slightly more complex than the final version. This agent could have both a goal and an action; that is, it could combine w hat w ould be tw o agents in the final version. Because the pattern of task-generation often alternates bet w een goals and actions, this had the effect of generating about half as many agents as in the final version. It also helped strengthen the notion of an agent as something that tied together declarative and procedural information. H o w ever, the process of packing tasks t w o-to-an-agent w as complex and confusing, and so I decided to use the simpler form of agent described here. This problem w ould only be w orse in a system that w as uniformly agent-based (see section 6.3.4). If all computation w as done w ith agents, rather than offloading some tasks to Lisp, there

20 This may in fact accurately model the role of many real-world managers.

Agents

183

w ould be at least an order of magnitude more agents to deal w ith. The solution, then, might be n o t t o re d u c e t h e t o t a l n u m b er o f age n ts b u t t o use so m e f orm o f h i erarc h i c a l d isp l a y t o normally hide the lo w-level ones from the vie w of the user. This is already done to some extent in the current agent display and storyboard system, and is in keeping w ith the general interface style of Live W orld.

5.5.4.4

Variants of Anthropomorphic Mapping

Part of Live W orlds general design aesthetic is to not hide anything from the user. D etail must often be suppressed to save screen resources and the users attentional resources, but it should al w ays be ultimately accessible. A nother design goal is simplicity and regularity. These goals may sometimes be in conflict w ith the goal of using anthropomorphic metaphors. It may help convey the anthropomorphic feel of the system to suppress some of the internals of the syste m . F or i nsta n c e , th e god age n t stra i ns t h e m e t a p h or o f t h e syst e m a t se v era l p o i n ts. It exists primarily for the sake of internal regularity, making it possible to treat the entire group of age n ts as a si ngl e stru c t ure . B u t fro m t h e users p o i n t o f v i e w , i t is a t v ari a n c e w i t h t h e metaphor of distributed agents. W hy are w e gathering the diverse set of top-level tasks under a single director? Perhaps it w ould be better to hide god from the user, preserving the impression of independent agents for top-level tasks. A n oth er i nsta n c e i n w h i c h th e a nthro p o m orp h i c m a p p i ng is n ot si m p l e is i n th e are a of emotional icons. W e w ould like to use the emotional state anger to indicate that t w o nodes are in conflict. But this cant be done w ith a straightforw ard mapping bet w een the agent states and the displayed emotional states, because in the usual case, at any given time one of the nodes involved in a conflict is going to be satisfied (its goal is currently met) and one is not. Satisfaction a n d b e i ng-i n-c o n f l i c t are t h us so m e w h a t ort h ogo n a l pro p ert i es o f n o d es, a n d i f t h e y w ere translated straightforw ardly into a screen representation, there w ould have to be an angry face a n d a smiling face displayed (in fact an early version of the system w orked in just this w ay). H o w e v er, t h is w o u l d stra i n t h e a n t hro p o m orp h i c m e t a p h or, w h i c h d i c t a t es t h a t a n age n t prese n t a si ngl e f a c e t o t h e w orl d . T h e so l u t i o n w as t o j ust sh o w t h e a ngry f a c e , w h i c h e n c o d e d th e m ore sa l i e nt of th e n o d e pro p erti es. A n oth er so l uti o n w o u l d b e to h a v e ri c h er icons that could represent angry-and-satisfied and angry-and-unsatisfied in a single expression, or even better, generate faces parametrically rather than using fixed icons. This opens up the possibility for incorporating all relevant information about an agent (satisfaction, determination, success, conflict status) in a single highly expressive facial representation generated on the fly (Thrisson 1996). H umans can read a lot into a facew hether the computer can write out its state in such a w ay that it can be so read remains to be seen.

5.6

Summary

The agent metaphor suggests that programs be built out of components that are designed to be understood in anthropomorphic terms. In order to achieve this, w e attempt to endo w our agents w ith purpose, autonomy, and the ability to react to events in their w orld. This chapter prese nts a seri es of age nt systems a n d sh o ws th at th e meta p h or c a n b e use d to u n ite se v era l disparate styles of computation:

184

Agents

t h e b e h a v i or-m o d u l e-b ase d , a c t i o n-se l e c t i o n a p pro a c h t o t h e ge n era t i o n o f cre a t ure behavior (Tinbergen, Brooks, M aes); th e d y n a m i cs, ge n erati v e p o w er, a n d a b i l ity to d e a l w ith se q u e nti a l o p erati o ns fo u n d i n procedural programming languages (Lisp, Logo); th e a b i l ity to i ntegrate d e c l arati v e a n d pro c e d ura l i nform ati o n fo u n d i n e arl y c o nstra i nt systems (Sketchpad, ThingLab).

D A is the most po w erful agent system and integrates these three strands most fully, but it is some w hat hard to understand. The simpler agent systems lack the full po w er of a programming language, but are simple to understand and lend themselves to the drag-and-drop, mix-andmatch construction paradigm of Live W orld.

Agents

185

Chapter 6
6.1 Summary and Contributions

Conclusions
You cant have everything. W here would you put it? Steven W right

T h is d issert at i o n w as m ot i v at e d b y a d esire t o f i n d n e w w a ys of t h i n k i ng a b o ut a ct i o n , progra m m i ng, a n d th e c o ntro l of a n i m ate syste ms. T o th is e n d , it h as e x p l ore d a p arti c u l ar approach to programming based on the central idea of animate agents. There are three main contributions: A n analysis of ho w metaphors in general, and animate metaphors in particular, are used in the construction and comprehension of computation and programming languages; A series of agent-based programming systems that take the insights of the above analysis into account; A n e n v iro nme nt, Li v e W orl d , th at is d esign e d to su p p ort th e c o nstru cti o n of age nt-b ase d syst e ms.

The analysis of metaphor and animacy (chapters 2 and 3) is an attempt to grapple w ith the informal conceptual underpinnings of a domain usually presented in formal terms. The notion of metaphorical models w as chosen as the vehicle for this exploration because of its success in revealing the structure of everyday domains. W hile metaphor has been studied in the realm of c o m p u t e r i n t e rf a c e s , t h e r e h a s b e e n v e r y l i t t l e p r i o r st u d y o f t h e m e t a p h o rs u n d e r l y i n g progra m m i ng l a ngu ages. T h is se cti o n of th e d issertati o n th us to o k a bro a d a p pro a c h to th e subject. Some effort w as necessary to recover the ability to detect the presence of metaphors t h a t h a v e b e c o m e tr a n s p a r e n t . A n u m b e r o f e st a b l i s h e d p r o gr a m m i n g p a r a d i g m s w e r e subjected to an analysis based on their underlying metaphors. Particular attention w as paid to the role of animate metaphors in these paradigms, and in c o m p u t a t i o n ge n era l l y . It w as f o u n d t h a t a n i m a t e m e t a p h ors are p art o f t h e f o u n d a t i o n o f computation, and play a role in most (but not all) programming paradigms. H o w ever, the form of animacy used to construct computation is of a peculiarly limited sort that relies on images of humans behaving in a rote or mechanical fashion. Some of the key properties that otherw ise d e f i n e t h e a n i m a t e r e a l m , s u c h a s a u t o n o m y a n d p u r p o s e f u l n e ss , a r e m i ss i n g fr o m t h i s standard form of computational animism. Agent-based programming is then introduced as an organi z ing metaphor for computation that includes these properties. A variety of computational techniques for reali z ing agents w ere examined. D ifferent aspects of agent-like functionality can be found in the computational w orld in the form of processes, rules, objects, goals, procedures, and behavior modules. The task of d e s i g n i n g a n a g e n t - b a s e d p r o gr a m m i n g s y s t e m i s t o u s e t h e s e e l e m e n t s t o g e n e r a t e a programming system that is both po w erful and can be seen in animate terms.

C hapter 5 presented a number of such systems. Simple Agents is a minimalist version of an agent, offering only concurrency and a form of conflict detection and resolution. G oal Agents extends this model by introducing a more structured version of an agent that includes a goal. It w as sho w n that this can provide the necessary foundation for anthropomorphic interfaces and for organi z ing systems of agents. D ynamic Agents is a more po w erful system that introduces d y n a m i c cre ati o n of n e w age nts, h i erarc h i c a l c o ntro l , se q u e n c i ng, a n d a v ari ety of c o ntro l c o nstru cts. T h is syste m a p pro a c h es th e ge n era l ity of a fu l l-p o w ere d progra m m i ng l a ngu age usi ng t h e age n t m e t a p h or. T h e u t i l i t y o f t h e syst e m f or b e h a v i ora l si m u l a t i o n , c o nstra i n t problems, and a variety of other uses is explored. The Live W orld environment (chapter 4) w as conceived originally as a platform or tool for t h e e x p l o r a t i o n i n t o a g e n t - b a s e d p r o gr a m m i n g l a n g u a g e s , b u t c o n t a i n s s o m e o r i g i n a l contributions in its o w n right. In particular, it combines Boxers style of hierarchical concrete presentation in the interface w ith an underlying object system based on recursive annotation and inheritance through prototypes. Live W orld extends the underlying object system, Framer, in order to make it operate in a dynamic interactive environment. Live W orld contains many features to support agent-based programming, including sensors that allo w objects to react to o n e a n o t h er, a n d a n i m as t h a t a l l o w a u t o n o m o us pro c esses t o b e e asi l y i n tro d u c e d i n t o a constructed w orld.

6.2

Related Work

The individual chapters in the body of the thesis discuss w ork that is related to the separate themes of this thesis. H ere, w e discuss a fe w systems that are related to more than one theme: t h at is, so m e ot h er e n v iro n m e nts t h at are d esign e d f or n o v i c es, stri v e f or a l i v e l y f e e l , a n d contain programming capabilities that are in some sense agent-like.

6.2.1.

KidSim

KidSim (C ypher and Smith 1995) is a programming environment designed to allo w children t o cre a t e gra p h i c si m u l a t i o ns, usi ng a ru l e-b ase d a p pro a c h t o progra m m i ng. K i dSi m h as a c o l orf u l i n t erf a c e w h i c h p erm i ts d ire c t m a n i p u l a t i o n o f a v ari e t y o f o b j e c ts (i . e . age n ts, c ost u m es, a n d ru l es). In K i dSi m , a n age n t is e q u i v a l e n t t o w h a t Li v e W orl d c a l ls a c t ors or creatures (and w hat KidSim calls a rule, w e w ould call an agent). Each agent has a set of rules and a set of properties (slots) that are accessible through a graphic editor. W hile you cannot cre ate e ntire l y n e w k i n ds of o b j e cts as i n Li v e W orl d , age nts o n c e cre ate d c a n b e use d as a basis for creating more agents of the same type. KidSim originally had the ability to support a deep inheritance hierarchy as does Live W orld, but this feature w as eliminated because it w as judged to be too confusing. KidSim avoids text-based programming languages, instead using a form of programming by demonstration to generate graphic re write rules, w hich can then be modified in an editor. The w orld of KidSim is based on a grid of cells w hich can be occupied by various graphic objects. T h e re w rit e ru l es t h us o p erat e o n p att erns of c e l l o c c u p a n c y . Ea c h age nt h as a set of ru l es w hich can be arranged in order of priority. 188 C onclusions

KidSim is based on a simple idea w hich makes it easy to learn, yet permits creating a w ide ra nge of si m u l at i o ns. H o w e v er, t h e re w rit e ru l e a p pro a c h m a k es so m e t h i ngs d iff i c u lt. F or i nst a n c e , i f a n o b j e c t is t o b o t h m o v e a n d d e a l w i t h o bst a c l es i n i ts p a t h , i t m ust b e gi v e n separate rule sets for each of the four possible directions of movement. M ore fundamentally, pure rule-based systems have difficulties dealing w ith sequential action and control in general. They also do not lend themselves to building po w erful abstractions in the w ay that procedural languages do, and thus are limited in their ability to deal with complexity.

6.2.2.

Agentsheets

Agentsheets (Repenning 1993) is not an end-user environment itself, but a tool for creating a variety of domain-specific graphical construction systems. Each such system includes a set of parts (agents) w hich the end-user can arrange on gridded field (the agentsheet). The end-user c a n n ot c o nstru ct th e age nts th e mse l v es; i nste a d th ese are d esige n e d a n d b u i lt b y a se p arate class of expert designers. Agents in this system are autonomous objects that contain sensors, effectors, behavior, state, and a graphical depiction. Agents can move from cell to cell, although not all of the visual languages supported by the system make use of this feature. They can also sense and communicate w ith their neighbors. Their behavior is specified by a Lisp-embedded language called AgenTalk. (In fact there are other w ays to program agents, such as specifying gra p h i c a l re w ri t e ru l es as i n K i dSi m , b u t m ost o f t h e syst e m s f l e x i b i l i t y c o m es fro m t h e AgenTalk level). This simple scheme supports a w ide variety of metaphors. In flo w-based languages, agents are static but change their state based on their neighbor, and so can simulate electrical circuits or fluid flo w . In anthropomorphic metaphors, the agents represent creatures that move around in the w orld and interact w ith one another, and can support behavioral simulations or certain types of videogames. Limited programming can be done at the end-user level w ith languages that provide agents w ith control-flo w metaphors (one example is a visual language for designing the flo w of automatic phone answ ering services). A g e n ts h e e ts h a s b e e n s h o w n t o b e a v e r y f l e x i b l e s y st e m , b u t i ts f u l l r a n g e i s o n l y accessible to experts. There is a sharp division betw een the end user, w ho can only manipulate a set of pre-constructed objects, and the expert designer w ho can build ne w kinds of objects a n d n e w l a ngu ages. T h is is i n c o ntrast to Li v e W orl d s go a l of m a k i ng as m u c h of th e i n n er w orkings of the system accessible to the end-user as possible.

6.2.3.

ToonTalk

ToonTalk is the most unusual of the environments described here, and perhaps the most po w erful. Its interface is entirely visual and highly animated, and its underlying computational model is a version of C oncurrent C onstraint Programming (C CP) (Sarasw at 1993), an advanced programming paradigm descended from logic programming. The system provides an elaborate mapping from the constructs of C CP to animated objects. For example, methods are sho w n as robots; their programs exist in thought bubbles; a communication is a bird flying out of its nest a n d b a c k ; t erm i n a t i ng a n age n t is re prese n t e d w i t h a n e x p l o d i ng b o m b . Just as Logo w as C onclusions 189

designed as a child-friendly version of Lisp, ToonTalk is a version of C CP in w hich mathematical formalisms are replaced by animated characters. ToonTalk is extremely lively, sometimes to the point of causing confusion. The underlying language is inherently concurrent, and so is the environment. G raphic objects or sprites form the basis of user w orlds. G ames and simulations on the order of Pong can be readily constructed. The programming style is a form of programming by example. The user performs a sequence of concrete actions using a set of tools, w hich can be recorded into a robot (method). The user can then make the resulting programs more abstract by explicitly removing constants from them. Program execution is animated, and since there is no textual code other than the graphic actors, Kahn is justified in claiming that the programs themselves are in the form of animations, n o t m ere l y i l l ustra t e d b y t h e m . W h e t h er t h is is re a l l y e asi er t o u n d erst a n d t h a n a t e x t u a l description is debatable, ho w ever. W hile the idiom of animated video characters might be more immediately accessible to a child, it is hard to follo w a complex set of moving objects. Static d escri pti o ns of progra ms a n d th e ir a cti v ity (su c h as story b o ards; se e se cti o n 5 . 3 . 5) h a v e th e advantage of standing still so you can read them! A n oth er pro b l e m is th at so m e of th ese m eta p h ors se e m e d stra i n e dfor i nsta n c e , age nts a n d o b j e c ts are re prese n t e d as h o uses, presu m a b l y b e c a use t h e y c o n t a i n a n assort m e n t o f other objects, w hile an entire computation system is a city. H o w ever, w hen this metaphor is extended via recursion it leads to expectation violations such as objects that have w ithin them w hole cities. In other cases, the metaphor is apt but not extensible: for instance, a scale is used to indicate a comparison bet w een numbers, but this metaphor does not readily extend to other predicates. C CP comes from an essentially declarative logic programming tradition, w hich ordinarily w o u l d m a k e it a n a w k w ard to o l for progra m m i ng d y n a m i c syste ms. N e v erth e l ess T o o n T a l k manages to represent action and perception using extensions to the basic model in the form of sensors and remote control variables w hich cause side effects. Because of these, ToonTalk is quite capable of building animate systems such as videogames despite its declarative heritage.

6.3
6.3.1

Directions for further research


What Can Novices Do with Agents?

L i v e W o r l d h a s h a d o n l y c a s u a l t e st i n g w i t h n o v i c e p r o gr a m m e rs . S e v e r a l st u d e n ts succeeded in building video-game w orlds using simple agents and other objects dra w n from a library of video-game components (see sections 4.2.10 and 5.4.1). O bviously, more evaluation w ith users is needed: of Live W orld, its implementations of agents, and the basic ideas of agentbased programming. D ynamic Agents, at least in its present form, is probably too complex for novices. W hile the b asi c c o n c e pts of th e l a ngu age are n ot th at m u c h m ore c o m p l i c ate d th a n th ose fo u n d i n a 190 C onclusions

procedural language, and it should not be beyond the ability of a novice to create tasks and templates, it can be very difficult to understand the resultant complex concurrent activity of the agent system. A scaled-back version of D A that eliminated concurrency and conflict detection, but retained the goal-directed control structure, might be more tractable although less po w erful. T h ere are m a n y p ossi b l e l a ngu ages t h a t l i e o n t h e c o n t i n u u m b e t w e e n a b asi c pro c e d ura l language and D A , allo w ing for a tradeoff bet w een po w er and comprehensibility. A t the lo wpo w ered end of the spectrum, there are concepts from agent-based programming that could be usefully transferred to purely procedural languages, such as turning invocations into graphic objects and displaying them anthropomorphically. The simpler agent systems might be more promising places to start evaluating the utility of agent-based programming for novices. The ideas behind these systems are sufficiently simple a n d i ntu iti v e (at l e ast to re c e nt ge n erati o ns th at h a v e gro w n u p w ith v i d e o ga m es) th at th e y should be usable by young children. W ork w ith children on programming environments w ith similar capabilities is encouraging: (M arion 1992) describes elementary-school students building a n i m a l b e h a v i or si m u l ati o ns i n Pl a y G ro u n d; (B urgo i n 1 9 9 0) d escri b es a gro u p of so m e w h at o l d er c h i l dre n b u i l d i ng ro b ots th at are c o ntro l l e d b y a ru l e-l i k e l a ngu age; a n d th e syste ms described in section 6.2 also have sho w n that children can create behavioral simulations using age n t-l i k e c o nstru c ts. N o n e o f t h ese syst e ms use e x p l i c i t go a ls or a n t hro p o m orp h i z e t h e ir age nts, so it re m a i ns to b e se e n w h eth er th ese fe atures m a k e age nts e asi er to u n d ersta n d or n ot. It w o u l d a lso b e i nteresti ng to stu d y th e n ature of c h i l dre n s a nthro p o m orp h i z ati o n of c o m p u t ers a n d progra m p arts, a n d w h e t h er t h ese t e n d e n c i es are d i ff ere n t i n age n t-b ase d syst e ms. T h e u n d ersta n d a b i l ity of a n y progra m m i ng syste m w i l l b e b ase d b oth o n th e u n d erl y i ng c o n c e p ts a n d o n h o w w e l l t h ose c o n c e p ts are prese n t e d t o t h e user t hro ugh t h e i n t erf a c e . Thus, the answ ers to this question and the next w ill be linked together.

6.3.2 User?

Can Agent Activity Be Made More Understandable to the

Li k e a n y c o m p l e x syst e m , age n t syst e ms c a n b e h ard t o u n d erst a n d . H o w e v er, age n t syst e ms a lso suggest n e w t e c h n i q u es f or prese n t i ng progra m a c t i v i t y . T h e use o f n arra t i v e techniques to explain (and eventually to produce) agent activity is one of the more interesting are as o p e n e d u p b y age nt-b ase d progra m m i ng. T h e story b o ards th at D A c a n ge n erate o n l y begin to explore this area. Presenting the activity of complex collections of hundreds of agents w ill require more kno w ledge about characters and narrative. T h e r e p r e s e n t a t i o n o f a g e n ts i n a n t h r o p o m o r p h i c t e r m s c a n b e e x t e n d e d . T h e r e a r e additional emotional states that can be used to reflect computational states (such as surprise to i n d i c a t e a n e x p e c t a t i o n v i o l a t i o n (K o z i ero k 1 9 9 3)). T h e m agn i t u d e o f e m o t i o ns su c h as happiness or anger can be conveyed by parameteri z ing facial displays (see section 5.5.4.4). Perhaps more importantly, there is a need to individuali z e agents so that they can be thought of as characters. Libraries of animated characters could be selected as representations that match t h e c h ara c t erist i cs o f t h e u n d erl y i ng age n ts. T h is i d e a w as e x p l ore d i n (Tra v ers a n d D a v is

C onclusions

191

1993), but only for a t w o-agent system. Extending this idea to more complex systems of agents is an interesting challenge. The mappings from agent activity to narrative forms can also be extended. The stories told no w are all of a fairly simple type, and the technique used to tell them is simplistic. W e can imagine other kinds of stories w hen agent systems become more sophisticated, for instance, stori es a b o ut c o nfl i ct b e i ng reso l v e d i nto c o o p erati o n , or d e v e l o p m e nta l stori es i n w h i c h a c h ara cter l e arns fro m e x p eri e n c e . A s for th e prese ntati o n a l forms, th e m e d i u m of th e storyboard has many rich possibilities, such as parallel time tracks and highlighting details, that have yet to be explored.

6.3.3

Can Agent Systems Be Made More Powerful?

The D ynamic Agents system is some w hat limited in terms of the intelligence it can apply to performing its tasks. W hile it has some support for exploring multiple methods of achieving a go a l , i t c a n n o t p erf orm se arc h es f or so l u t i o ns as d o p l a n n ers. Si n c e a n age n t m a y p erf orm arbitrary actions, it is difficult to represent the projected results of a potential action, w hich is p l a n n i ng re q u ires. M ore f u n d a m e n t a l l y , p u tt i ng a c t i o ns u n d er t h e c o n tro l o f a c e n tra l i z e d planner violates the agent metaphor. D ecentrali z ed methods that simulate some of the effects of planning (such as M aes action selection algorithm; see section 5.5.2) might be an acceptable substitute. O t h er m et h o ds f or i m pro v i ng D A p erf orm a n c e t h at are m ore c o nso n a nt w it h t h e age nt metaphor are also possible. For instance, there could be agents that are outside of the standard agent hierarchy and act to improve its performance (see section 5.5.3). M anager agents like this c o u l d a lso b e use d f or m ore so p h ist i c a t e d f orms o f c o n f l i c t reso l u t i o n t h a n t h e c o n t est-o fstrength technique currently employed by Live W orld. Rather than have t w o conflicting agents f igh t i t o u t , t h e y c o u l d re f er t h e ir c o n f l i c t t o a n o u tsi d e m e d i a t or w h o c o u l d i m p l e m e n t negotiation of compromises or make use of non-local information to help resolve the dispute. A ge n ts c urre n t l y d o n o t l e arn fro m e x p eri e n c e , a n d t h us h a v e t o so l v e e a c h c o nstra i n t pro b l e m a l l o v er aga i n e a c h ti m e a n y e l e m e nt of th e syste m c h a nges. Sm arter age nts c o u l d re m e m b er w h i c h m e t h o ds w ork e d a n d u n d er w h i c h c irc u mst a n c es, a n d m a k e t h e c orre c t choices w ithout having to search through failures. M ediator agents too could have memories. So m e of th ese te c h n i q u es w ere e x p l ore d , for e xtre m e l y si m p l e c ases, i n (Tra v ers a n d D a v is 1993). C ase-based techniques w ere used for learning, so that situations and solutions w ould be remembered in a case library and matched w ith ne w situations as they arose. H o w ever, the challenge is to implement such facilities in a w ay that fits into the overall metaphor and makes the behavior of the system more understandable rather than more opaque. There is a tension betw een making the system smarter and making it more comprehensible.

6.3.4

Can Agents be Organized in Different Ways?

The D ynamic Agents system is based on a hierarchical model of agent organi z ation, and e m p l o ys m e t a p h ors b ase d o n h u m a n m a n ageri a l h i erarc h i es. T h is f orm o f orga n i z a t i o n is 192 C onclusions

c o m m o n i n c o m p utati o n a l syste ms, b ut is pro b l e m ati c to so m e b e c a use of its m eta p h ori c a l i m p l i c ati o ns. B ure a u crati c h i erarc h i es c a n b e u n p l e asa nt a n d i n effi c i e nt i n re a l l ife , so w h y duplicate them in the computer? H ierarchy arises in computational systems for the same reason it does in society: to allo w a me asure of c e ntra l i z e d c o ntro l to b e e x erte d o v er a d oma i n th at is to o b ig or c omp l e x to b e controlled by a single individual or agent. H ierarchy allo ws parts of the domain to be controlled by subordinate agents w hile keeping ultimate control centrali z ed. This control is not obtained w i t h o u t a c o st , h o w e v e r . I n s o c i a l s y st e m s , t h e c o sts i n c l u d e t h e e t h i c a l a n d p o l i t i c a l consequences that attend the subordination of individuals to the po w er of others. This sort of c ost is presu m a b l y n o t a d ire c t issu e w h e n d esign i ng a so ft w are syst e m aro u n d so c i a l a n d a n t hro p o m orp h i c m e t a p h ors, e x c e p t i nso f ar as i t m igh t pro m o t e t h e i d e a o f h i erarc h i c a l subordination in general. But there are other problems w ith hierarchical organi z ation that can affect both human and art i f i c i a l so c i e t i es. T h ese st e m fro m t h e f a c t t h a t su c h syst e ms l e a d t o l o ng a n d so m e t i m es unreliable paths of communication bet w een the w orlds they manipulate and the agents that m a k e d e c isi o ns. In f orm a t i o n a b o u t t h e w orl d m ust p erc o l a t e u p w ards t hro ugh a c h a i n o f c o m m a n d w h i l e d e c isi o ns f i l t er d o w n w ards. T h is pro c ess c a n b e sl o w a n d error-pro n e . H i erarc h i c a l orga n i z a t i o n d ise m p o w ers age n ts w h o are m ost i n t o u c h w i t h t h e w orl d a n d isolates the agents w ith po w er from the w orld they seek to control. A llo w ing subordinates a greater degree of independence can alleviate some of these problems, but at the risk (from the managers perspective) of losing control and causing incoherent system behavior. As a result, h i erarc h i c a l orga n i z ati o ns are c o nsta ntl y se e k i ng a b a l a n c e b et w e e n to p-d o w n c o ntro l a n d autonomy. T h e D A syste m w as a lso d esign e d to se e k a b a l a n c e b et w e e n c o ntro l a n d a uto n o m y . In contrast to procedural languages, w hich use a strict top-do w n command regime, D A employs a more fl e x i b l e sty l e of c o ntro l . W h i l e th e y are su b j e ct to h i erarc h i c a l ma n ageme nt stru cture , d y n a m i c a g e n ts e x e c u t e a u t o n o m o u s l y a n d c o n c u rr e n t l y , i n t h e m a n n e r s i m i l a r t o t h a t e m p l o y e d i n h i erarc h i c a l b e h a v i ora l c o ntro l syste ms (se e 5 . 2). M a n agers a ctu a l l y m a n age , rather than command: their role is to activate and coordinate the activities of their subordinates, rather than to directly control them. The control path betw een perception, decision-making and action is shortened, and most commonly only involves a single level of agent. C ertainly there are other w ays to organi z e systems of agents that avoid hierarchical models a n d m e t a p h o rs . P e r h a p s a n a g e n t s y st e m c o u l d b e o rg a n i z e d a r o u n d t h e i d e a o f gr o u p n egoti ati o n to w ards a c o nse nsus, after th e m o d e l of Q u a k er m e eti ngs. Su c h syste ms suffer from scaling problems, ho w ever, and presuppose a more sophisticated agent that is capable of representing and negotiating among alternative courses of action. A nother mode of organi z ation w hich avoids hierarchy is a market-based (or agoric ) system in w hich agents hired others to perform tasks for them (M iller and D rexler 1988). H o w ever, in such systems the relationship bet w een agents is looser, and it is correspondingly harder for a manger to manage the activity of a hired agent w hen (for example) the subtask no longer needs to be accomplished because c irc u mst a n c es h a v e c h a nge d (t h is sort o f c o nstra i n t is presu m a b l y t h e re aso n re a l- w orl d economic activity makes use of both hierarchixal firms and non-hierarchical markets).

C onclusions

193

A ll non-hierarchical schemes have serious problems w ith comprehensibility. A large system of agents is a formidable thing to understand, and organi z ing agents along hierarchical lines is the most po w erful w ay to make such a collection into something that can be understood. The true advantage of hierarchy, from the standpoint of comprehensibility, is that it is the scheme t h a t a l l o w s t h e d e t a i l s o f a g e n t a c t i v i t y t o b e a b str a c t e d a w a y . T h i s i s o n e r e a s o n w h y hierarchical organi z ation is so highly valued in the design of engineered systems. T h e q u esti o n of c o ntro l i n age nt-b ase d syste ms is fra ught w ith p o l iti c a l o v erto n es, a n d f orc es d esign ers a n d users t o t h i n k a b o u t issu es o f c o n tro l , a u t o n o m y , p o w er, a n d organi z ation in the human w orld as w ell as the computational. There are many possible w ays to organi z e the activity of agents. From the standpoint of constructivist education, w hat w ould be most desirable is a system that allo w ed users to create and explore a variety of organi z ational forms.

6.3.5

Can the Environment Be Agents All the Way Down?

O ne legitimate criticism of the system as a w hole is that it has a split personality: the basic Live W orld level and the agent languages are to some extent separate, and organi z ed around different metaphors. Live W orld uses an unusual form of the O O P paradigm, highlighted by an interface w hich emphasi z es the tangibility of objects. The D A system uses the agent metaphor w hich emphasi z es action, goal-seeking, and autonomous behavior. This is partially an artifact of the systems developmental historythe object system had to be in place before the research into agents could take place. But in the future, w ouldnt it be better to use a single paradigm for the system? C an an environment be made that is agents all the w ay do w n? T h ere are se v era l a ns w ers t o t h is q u est i o n . F or o n e t h i ng, i t is n o t c l e ar t h a t a si ngl e metaphor can really w ork at all levels. Agents need to take their action in a w orld of objects, so i n so m e se nse th e o p erati o n of th e age nt-b ase d l e v e l d e p e n ds u p o n a n o b j e ct l e v e l a lre a d y being in place. M aking everything an agent, the w ay some O O P systems make everything an object, might require diluting the concept of agent to the point where it is no longer useful. Still, there could be more integration betw een the levels. O ne interesting prospect is to base the agent system on a more suitable lo w-level general computational mechanism than Lisp and th e Li v e W orl d o b j e ct syste m . O n e c a n d i d ate is th e A ctors progra m m i ng form a l ism ( H e w itt 1976), w hich already supports object-orientation, concurrency, and message-passing. A ctor languages in theory could replace Lisp as the base language in w hich agents are programmed. A ctors are already quite similar to dynamic agents in some w ays. A n actor is like a procedure invocation, but can also persist over time and have state. U nlike procedures, but like dynamic age nts, a ctors d o n ot i m p l i c itl y return v a l u es. If a n i n v o k er of a n a ctor w a nts a resp o nse , it m ust cre ate a n oth er a ctor as a c o nti n u ati o n to h a n d l e th e v a l u e , a n d p ass th e c o nti n u ati o n along as an argument. B u t a c t ors are st i l l esse n t i a l l y dri v e n fro m e x t ern a l m essages ra t h er t h a n ru n n i ng as autonomously independent processes (Agha, M ason et al. 1993). They are not goal-oriented and have no built-in models for conflict resolution. Thus if A ctors is to serve as a basis for an agent system like D A , it w ill be necessary to build a layer of agent-based protocols on top of the 194 C onclusions

basic A ctor model. A nother problem is that the actor model has not, as yet, resulted in many practical programming tools. A ctor programming can be difficult, unnatural, and verbose, and actor languages do not have the sophisticated inheritance mechanisms found in other objectoriented systems. N onetheless the A ctor model looks like a promising w ay to put agent-based programming on a more elegant and rigorous footing.

6.3.6

Agents in Shared Worlds

A nimate systems naturally lend themselves to implementation in distributed and multi-user environments. In such environments, users at various locations w ould construct active objects that w ould be loosed into common areas to interact w ith one another. Text-based systems of this kind (called M U D s or M ulti- U ser D ungeons) have become w idespread in recent years, and sh o w pro m ise as e n v iro n m e nts for l e arn i ng to progra m . T h e so c i a l n ature of su c h artifi c i a l w orlds provides an audience, context, and motivation for constructionist learning (Bruckman 1 9 9 3). H o w ever, the text-based nature of M U D s limits the kinds of interactions that can take place, and the programming languages that are available are often limited in w hat they can express. So m e M U D s are i n h a b i t e d b y so p h ist i c a t e d art i f i c i a l p erso n a l i t i es (F o n er 1 9 9 3), b u t t h ese generally are developed outside of the M U D itself, and simulate a user connected to it from the o utsi d e . U sers c a n n ot ge n era l l y c o nstru ct su c h c omp l e x a uto n omo us a ctors from w ith i n th e environment. The ideas of agent-based programming and the Live W orld environment should fit naturally into shared w orlds and might improve their utility. Programs in shared environments have to resp o n d to a v ari ety of e v e nts a n d c h a ngi ng c irc u msta n c es, a task w e l l-su ite d to th e age ntbased paradigm. Live W orlds design encourages thinking of programs and behaviors as objects t h a t c a n b e m a n i p u l a t e d i nsi d e o f a gra p h i c e n v iro n m e n t . T h is o b j e c t i f i c a t i o n o f progra m components should be particularly useful in a shared social environment, allo w ing programs to become social objects that can be readily discussed and shared.

6.4

Last Word

W e are entering an era in w hich a multitude of ne w forms of media w ill be invented and d e p l o y e d . W h eth er th ese n e w forms b e c o m e to o ls for th o ught or m ere d istra cti o ns d e p e n ds upon ho w easy it is for non-specialists to use them to express their ideas. Programmability has been neglected in the rush to develop ne w media, but w hat is ne w and interesting about the ne w digital forms, namely their interactivity and dynamism, require some grasp of the art of programming in order to be fully utilized. Programming should thus be thought of as a basic intellectual skill, comparable to writing. Like writing, programming has to be learned, sometimes laboriously; and w hile it can certainly be made simpler and more accessible than it has been, it cannot and should not be reduced to triviality or eliminated. In my o w n experience, genuine learning takes place w hen the learner is motivated to learn, w hen the topic is interesting for its o w n sake or is a means to a genuinely C onclusions 195

d esire d e n d . Progra m m i ng c a n b e e i t h er, b u t t o o o ft e n is prese n t e d i n a d yst o n i c m a n n er u n c o n n e c t e d w i t h t h e l e arn ers a c t u a l i n t erests. A n d t o o o ft e n t h e t o o ls t h a t progra m m i ng e n v iro n m e nts pro v i d e are to o w e a k to a l l o w a b egi n n er to a d v a n c e to th e p o i nt w h ere th e ir skills can match their vision. M y project has been an effort to set programming in ne w contexts and put a ne w face on it. Rath er th a n fra m i ng c o m p uti ng a n d progra m m i ng as a m e a ns of m a n i p u l ati ng a bstra ct a n d d ise m b o d i e d d ata , Li v e W orl d fra m es it as a task of b u i l d i ng c o n crete a uto n o m o us gra p h i c w orl ds, a n d su p p l i es t h e t o o ls n e c essary f or b u i l d i ng su c h w orl ds. Ra t h er t h a n t h i n k i ng o f programs in formal or mechanical terms, agent-based programming sees them in animate terms, w ith p urp oses, re a cti o ns, a n d c o nfl i cts of th e ir o w n . T h e h o p e is th at th i n k i ng a b o ut th ese systems can engage the learners thinking about purpose, reaction, and conflict in the w ider w orld, a w orld that is inhabited by and largely determined by the purposeful mechanisms of life.

196

C onclusions

Bibliography

A b e lso n , H . a n d G . J. Sussm a n (1 9 8 5). Stru cture a n d Interpretati o n of C o m p uter Progra ms. C ambridge M A: MIT Press. A c k erm a n n , E. (1 9 9 1). T h e " A ge n c y" M o d e l o f Tra nsa c t i o ns: T o w ard a n U n d erst a n d i ng o f C h i l d r e n 's T h e o r y o f C o n tr o l . I n C onstructionism , e d i t e d b y I . H a r e l a n d S . P a p e r t . N orw ood, N J: A blex. A gh a , G . A . (1 9 8 6). A c t ors: A M o d e l o f C o n c urre n t C o m p u t a t i o n i n D istri b u t e d S yst e ms. C ambridge: MIT Press. A gh a , G . A . , I. A . M aso n , e t a l . (1 9 9 3). A F o u n d a t i o n f or A c t or C o m p u t a t i o n . J o urn a l of Functional Programming 1(1). Agre, P. E. (1992). Formali z ation as a Social Project. Q uarterly N e wsletter of the Laboratory of Comaprative H uman Cognition 14(1), 25-27. Agre, P. E. (1995). C omputational Research on Interaction and Agency. Artificial Intelligence 72((1-2)), 1-52. Agre, P. E. (1996). C omputation and H uman Experience : C ambridge U niversity Press. Agre, P. E. and D . C hapman (1987). Pengi: A n Implementation of a Theory of Situated A ction, Proceedings of A A AI-87. A p p l e C o m p u t er (1 9 8 7). A p p l e H u m a n Interfa c e G u i d e l i n es: T h e A p p l e D eskto p Interfa c e . Reading, M assachusetts: A ddison- W esley. A pple C omputer (1991). Kno w ledge N avigator. V ideotape. A pple C omputer (1992). D ylan: an object-oriented dynamic language . Baron-C ohen, S. (1995). M indblindness: A n Essay on A utism and Theory of M ind . C ambridge, M assa c h usetts: M IT Press. Bateson, M . C . (1972). O ur O w n M etaphor. N e w York: Knopf. Black, M. (1962). M odels and M etaphors. Ithaca, N Y: C ornell U niversity Press. Boden, M . A . (1978). Purposive Explanation in Psychology : H arv ester Press. B o n d , A . H . a n d L. G asser, Eds. (1 9 8 8). Readings in D istributed Artificial Intelligence , M orga n Kaufmann. Borges, J. L. (1962). Labyrinths: S elected S tories & O ther Writings: N e w D irections.

Borning, A . (1979). Thinglab: A C onstraint- O riented Simulation Laboratory. Xerox PARC SSL79-3, July 1979. Borning, A . (1986). D efining C onstraints G raphically, Proceedings of C H I'86, Boston. Boulay, B. d. (1989). D ifficulties of learning to program. In S tudying the N ovice Programmer, edited by E. Solo w ay and J. C . Spohrer. H illsdale, N J: La wrence Erlbaum. B o y d , R . ( 1 9 9 3 ) . M e t a p h o r a n d t h e o r y c h a n g e : W h a t i s " m e t a p h o r" a m e t a p h o r f o r? I n M etaphor and Thought , edited by A . O rtony. C ambridge: C ambridge U niversity Press. Braitenberg, V . (1984). V ehicles: Experiments in S ynthetic Psychology . C ambridge: MIT Press. Brooks, R. A . (1986). A chieving Artificial Intelligence through Building Robots. M assachusetts Institute of Technology Artificial Intelligence Laboratory AI Memo 899. Brooks, R. A . (1986). A Robust Layered C ontrol System for a M obile Robot. IEEE J o urn a l o f Robotics and A utomation 2(1), 14-23. Brooks, R. A . (1991). Intelligence W ithout Representation. Artificial Intelligence 47, 139-159. Bruckman, A . (1993). C ontext for Programming. MIT Thesis Proposal, A ugust 6, 1993. B r u n e r , J . ( 1 9 8 6 ) . A c t u a l M i n ds, Possi b l e W orl ds. C a m b r i d g e , M a ss a c h u s e t ts: H a r v a r d U niversity Press. Bru n er, J. S. (1 9 6 6). O n C ogn iti v e G ro w th: I. In S tudies in C ognitive G ro w th , e d i t e d b y J. S. Bruner, R. R. O liver and P. M. Greenfield. N ew York: W iley. Burgoin, M . O . (1990). U sing LE G O Robots to Explore D ynamics, MS thesis, MIT. C arey, S. (1985). Conceptual Change in Childhood . C ambridge, M assachusetts: MIT Press. C h a n g , B . - W . a n d D . U n g a r ( 1 9 9 3 ) . A n i m a t i o n : F r o m C a rt o o n s t o t h e U s e r I n t e rf a c e , Proceedings of U IST '93, Atlanta, G eorgia. C hapman, D . (1991). V ision, Instruction, and A ction . C ambridge, M assachusetts: MIT Press. C hapman, D . and P. E. Agre (1986). A bstract Reasoning as Emergent from C oncrete A ctivity, Proceedings of 1986 W orkshop on Reasoning A bout A ctions & Plans, Los A ltos, C alifornia. C harles River A nalytics (1994). O pen Sesame. Softw are. C onnell, J. (1989). A C olony Architecture for an Artificial Creature. MIT Artificial Intelligence Laboratory Technical Report 1151. C y p h er, A . , Ed . (1 9 9 3). W atch W hat I D o: Programming by D emonstration . C ambridge, M A , M IT Press. C y p h e r , A . a n d D . C . S m i t h ( 1 9 9 5 ) . K i d S i m : E n d U s e r Pr o gr a m m i n g o f S i m u l a t i o n s , Proceedings of C H I'95, D enver. D ahl, O . J., B. M yhrhaug, et al. (1970). Simula C ommon Base Language. N orw egian C omputing C enter Technical Report S-22, O ctober 1970. D avis, R. and R. G . Smith (1983). N egotiation as a M etaphor for D istributed Problem Solving. Artificial Intelligence 20(1), 63-109. 198 Bibliograpy

D ennett, D . C . (1987). The Intentional Stance . C ambridge, M A: MIT Press. D ennett, D . C . (1991). C onsciousness Explained . Boston: Little Bro w n. D i G i a n o , C . J. , R. M . B a e c k er, et a l . (1 9 9 3). Logo M e d i a: A So u n d-En h a n c e d Progra m m i ng En v iro n m e n t f or M o n i t ori ng Progra m m i ng B e h a v i o ur , Pro c e e d i ngs o f In t er C H I `9 3 , A msterdam. D ijkstra, E. W . (1989). O n the Cruelty of Really Teaching C omputing Science. C A C M 3 2(1 2), 1398-1404. diSessa, A . A . (1986). M odels of C omputation. In U ser C entered S ystem D esign , e d ite d b y D . A . N orman and S. W . D raper. H illsdale N J: La wrence Erlbaum Associates. d iSessa , A . A . a n d H . A b e lso n (1 9 8 6). B o x er: A Re c o nstru cti b l e C o m p utati o n a l M e d i u m . C A C M 29(9), 859-868. D re y f us, H . (1 9 7 9). W hat Computers Can't D o: The Limits of Artificial Intelligence . N e w Y ork: H arper and Ro w . Ed e l , M . (1 9 8 6). T h e T i n k erto y G ra p h i c a l Progra m m i ng En v iro n m e nt , Pro c e e d i ngs of IEEE 1986 C ompsac. Et z ioni, O . and D . W eld (1994). A Softbot-based interface to the Internet. C A C M 3 7(7), 7 276. Fenton, J. and K. Beck (1989). Playground: A n O bject O riented Simulation System w ith Agent Rules for C hildren of A ll Ages, Proceedings of O O PSLA '89. Ferber, J. and P. C arle (1990). A ctors and Agents as Reflective C oncurrent O bjects: A MERI N G IV Perspective. LA F O RIA , U niversit Paris Rapport LaForia 18/90, 1990. Fin z er, W . and L. G ould (1984). Programming by Rehearsal. B y t e 9(6), 187-210. Fisher, D . (1970). C ontrol Structure for Programming Languages, Ph D thesis, C M U . F o n er, L. N . (1 9 9 3). W h at's a n A ge nt, A n y w a y?: A So c i o l ogi c a l C ase Stu d y . M IT M e d i a La b Agent M emo 93-01, M ay 1993. Forgy, C . L. (1982). RETE: A Fast A lgorithm for the M any Pattern/M any O bject Pattern M atch Problem. Artificial Intelligence 19(1). Freeman-Benson, B. N ., J. M aloney, et al. (1990). A n Incremental C onstraint Solver. C A C M 33(1), 54-63. G a m m a , E. , R. H e l m , et a l . (1 9 9 4). D esign Patterns: El e m e nts of Re usa b l e O b j e ct- O ri e nte d Software . Reading, M A: A ddison- W esley. G elman, R. and E. Spelke (1981). The development of thoughts about animate and Inanimate o b j e cts: i m p l i c ati o ns for rese arc h o n so c i a l c ogn iti o n . In S ocial C ognitive D evelopment , edited by J. H . Flavell and L. Ross. C ambridge: C ambridge U niversity Press. G eneral Magic (1995). The Telescript Language Reference. G eneral Magic , O ctober, 1995. G e n t n er, D . (1 9 8 9). T h e M e c h a n isms o f A n a l ogi c a l Le arn i ng. In S imilarity and analogical reasoning, edited by S. V isbuadiy and A . O rtony. : C ambridge U niversity Press.

Bibliography

199

G entner, D . and M . Je z iorski (1993). From metaphor to analogy in science. In M eta p h or a n d Thought , edited by A . O rtony. C ambridge: C ambridge U niversity Press. G i b b s , R . W . ( 1 9 9 3 ) . Pr o c e ss a n d p r o d u c ts i n m a k i n g s e n s e o f tr o p e s . I n M e t a p h or a n d Thought , edited by A . O rtony. C ambridge: C ambridge U niversity Press. G offm a n , E. (1 9 7 4). Fra m e A n a l ysis: A n Essa y o n t h e O rga n i z a t i o n o f Ex p eri e n c e . B ost o n : N ortheastern U niversity Press. G o l d b erg, A . a n d A . K a y (1 9 7 6). Sm a l l t a l k-7 2 Instru c t i o n M a n u a l . X ero x P A R C T e c h n i c a l Report. G o l d b e rg , A . a n d D . R o b s o n ( 1 9 8 3 ) . S malltalk-80: The Language and its Implementation . Reading, M A: A ddison- W esley. G r e i n e r , R . ( 1 9 8 0 ) . RLL- 1 : a R e p r e s e n t a t i o n L a n g u a g e L a n g u a g e . S t a n f o r d H e u r i s t i c Programming Project H PP-80-9. G ross, P. R. a n d N . Le v itt (1 9 9 4). H igher S uperstition: the academic left and its quarrels w ith science . Baltimore: Johns H opkins U niversity Press. H aase, K. (1992). Framer, MIT M edia Lab. Softw are. H arv e y , B . (1 9 8 5). C omputer S cience Logo S tyle: Intermediate Programming. C ambridge, M A : M IT Press. H a v erm ist e , C . (1 9 8 8). T h e m e t a p h ysi cs o f i n t erf a c e . C e n t er f or C o m p u t a t i o n a l T h e o l ogy , U niversity of Ere w hon C C T M emo 23, M ay 23, 1988. H eims, S. J. (1991). The C ybernetics G roup . C ambridge, M A: MIT Press. H enderson, P. (1980). Is it reasonable to implement a complete programming system in a purely functional style? U niversity of N e w castle upon Tyne C omputing Laboratory PM M/94, 11 D ecember 1980. H e t e nry c k , P. V . (1 9 8 9). C onstraint S atisfaction in Logic Programming. C a m bri dge M A : M IT Press. H e w itt, C . (1976). V ie w ing C ontrol Structures as Patterns of Passing M essages. MIT AI Lab AI M emo 410, D ecember 1976. H e w i t t , C . (1 9 8 6). O f f i c es are O p e n Syst e ms. A C M Tra nsa cti o ns o n O ffi c e Inform ati o n S ystems 4(3), 271-287. H e y d o n , A . a n d G . N e lso n (1 9 9 4). T h e Ju n o-2 C o nstra i n t-B ase d D ra w i ng Ed i t or. D igi t a l Systems Research C enter SRC Research Report 131a, D ecember 1994. H inde, R. A . (1978). A nimal Behavior: A synthesis of ethology and comparative psychology . N ew York: Mc Graw-H ill. H udak, P., S. P. Jones, et al. (1991). Report on the Programming Language H askell, A N on-strict Purely Functional Language (V ersion 1.1). Yale U niversity D epartment of C omputer Science Technial Report Y ALE U / D CS/RR777, A ugust 1991. H utchins, E. L., J. D . H ollan, et al. (1986). D irect M anipulation Interfaces. In U ser C e ntere d S ystem D esign , edited by D . A . N orman and S. W . D raper. H illsdale N J: La wrence Erlbaum Associates. 200 Bibliograpy

Ingalls, D ., S. W allace, et al. (1988). Fabrik: A V isual Programming Environment, Proceedings of O O PSLA '88. Ish i z a k i , S. (1 9 9 6). T y p ogra p h i c Perf orm a n c e : C o n t i n u o us D esign So l u t i o ns as Em erge n t Behaviors of A ctive Agents, Ph D thesis, MIT. Jo n es, S. L. P. a n d P. W a d l er (1 9 9 3). Im p erati v e fu n cti o n a l progra m m i ng , Pro c e e d i ngs of A C M Symposium on Principles of Programming Languages, C harleston. Kaelbling, L. P. (1988). G oals as Parallel Program Specifications, Proceedings of Proceedings A A AI-88 Seventh N ational Conference on Artificial Intelligence. Kay, A . (1981). N e w D irections for N ovice Programming in the 1980s. Xerox PARC Technical Report. K a y , A . C . (1 9 9 0). U ser Interfa c e: A Perso n a l V i e w . In The Art of H uman-C omputer Interface D esign , edited by B. Laurel. : A ddison- W esley. Keller, E. F. (1985). Reflections on G ender and S cience . N e w H aven: Yale U niversity Press. K ornfe l d , W . A . a n d C . H e w itt (1 9 8 1). T h e Sc i e ntifi c C o m m u n ity M eta p h or. M IT A I La b A I M emo 641. Ko w laski, R. (1979). A lgorithms = Logic + C ontrol. C A C M 22(7), 424-436. K o z i ero k , R. (1 9 9 3). A l e arn i ng a p pro a c h to k n o w l e dge a c q u isiti o n for i nte l l ige nt i nterfa c e agents., SM thesis, MIT. K u h n , T . S. (1 9 9 3). M e t a p h or i n Sc i e n c e . In M eta p h or a n d T h o ught , e d i t e d b y A . O rt o n y . C ambridge: C ambridge U niversity Press. Kurlander, D . and S. Feiner (1991). Inferring C onstraints from M ultiple Snapshots. C olumbia U niversity D epartment of C omputer Science Technical Report C U CS 008-91, M ay 1991. La k i n , F . (1 9 8 6). Sp ati a l Parsi ng for V isu a l La ngu ages. In V isual Languages, e d i t e d b y S . K . Chang, T. Ichikawa and P. A. Ligomenides. N ew York: Plenum. Lakoff, G . (1987). W omen, Fire, and D angerous Things. C hicago: U niversity of C hicago Press. Lakoff, G . (1993). The contemporary theory of metaphor. In M etaphor and Thought , e d ite d b y A . O rtony. C ambridge: C ambridge U niversity Press. La k o ff , G . a n d M . Jo h nso n (1 9 8 0). M e t a p h ors W e Li v e B y . C h i c ago: U n i v ersity of C h i c ago Press. Lakoff, G . and Z . Kvecs (1987). The cognitive model of anger inherent in A merican English. In C ultural M odels in Language & Thought , edited by D . H olland and N . Q uinn. C ambridge: C ambridge U niversity Press. Lanier, J. (1995). Agents of A lienation. A C M Interactions 2(3). Latour, B. (1987). Science In Action . C ambridge, M assachusetts: H arvard U niversity Press. Laurel, B. (1990). Interface Agents: M etaphors w ith C haracter. In The Art of H uman-C omputer Interface D esign , edited by B. Laurel. Reading, M A: A ddison- W esley.

Bibliography

201

L e l e r , W . ( 1 9 8 8 ) . C o nstra i nt Progra m m i ng La ngu ages: T h e ir sp e c ifi c ati o n a n d ge n erati o n . Reading, M A: A ddison- W esley. Leslie, A . M . (1979). The representation of perceived causal connection, Ph D thesis, O xford. Leslie, A . M . and S. Keeble (1987). D o six-month-old infants perceive causality? Cognition 2 5 , 265-288. Lieberman, H . (1986). U sing Prototypical O bjects to Implement Shared Behavior in O bject O riented Systems, Proceedings of First A C M C onference on O bject O riented Programming Systems, Languages & A pplication, Portland. Lloyd, D . (1989). Simple Minds: M IT Press. Lo p e z , G . , B . Fre e m a n-B e nso n , et a l . (1 9 9 3). K a l e i d osc o p e: A C o nstra i nt Im p erati v e Programming Language. D epartment of C omputer Science and Engineering, U niversity of W ashington Technical Report 93-09-04, September, 1993. M ac N eil, R. (1989). TYR O : A C onstraint Based G raphic D esigner's A pprentice , Proceedings of IEEE W orkshop on V isual Languages. M a es, P. (1 9 8 7). C o n c e pts a n d Ex p eri m e nts i n C o m p utati o n a l Refl e cti o n , Pro c e e d i ngs of O O PSLA . M aes, P. (1989). The D ynamics of A ction Selection, Proceedings of Eleventh Joint C onference on Artificial Intelligence. M aes, P. (1990). Situated Agents C an H ave G oals. In D esigning A utonomous Agents, e d ite d b y P. M aes. C ambridge: MIT Press. M a l o n e , T . W . , R . E . F i k e s , e t a l . ( 1 9 8 8 ) . E n t e r p r i s e : A M a r k e t-L i k e T a s k S c h e d u l e r f o r D istri b ute d C omp uti ng En v iro nme nts. In T h e Ec o l ogy of C o m p utati o n , e d i t e d b y B . A . H umberman. : Elsevier/ N orth-H olland. M arc h i n i , M . Q . a n d L. F . B . M e lgare j o (1 9 9 4). gora: G ro u p w are M e t a p h ors i n O b j e c tO riented C oncurrent Programming , Proceedings of EC O O P 94 W orkshop on M odels and Languages for Coordination of Parallelism and D istribution, Bologna. M arion, A . (1992). Playground Paper. M art i n , F . (1 9 8 8). C h i l dre n , c y b ern e t i cs, a n d progra m m a b l e t urt l es, M S t h esis, M IT M e d i a Laboratory. M ayer, R. E. (1979). A psychology of learning B ASIC . C ommunications of the A C M 2 2(1 1), 589-593. M a y er, R. E. (1 9 8 9). H o w N o v i c es Le arn C o m p u t er Progra m m i ng. In S tu d y i ng th e N o v i c e Programmer, edited by E. Solo w ay and J. C . Spohrer. H illsdale, N J: La wrence Erlbaum. M c C loud, S. (1993). U nderstanding C omics: The Invisible Art . N orthampton, M A : Tundra. M c D ermott, D . (1987). Artificial Intelligence M eets N atural Stupidity. In M ind D esign , e d ite d b y J. H augeland. C ambridge, M assacustts: MIT Press. M ichotte, A . (1950). The Perception of C ausality . N e w York: Basic Books.

202

Bibliograpy

M iller, M . S. and K. E. D rexler (1988). M arkets and C omputation: Agoric O pen Systems. In The Ecology of C omputation , edited by B. H uberman. : N orth- H olland. M insky, M . (1980). K-lines: A Theory of M emory. Cognitive Science 4(2). M insky, M . (1987). S ociety of Mind . N e w York: Simon & Schuster. M i nsk y , M . (1 9 9 1). So c i e t y o f M i n d : a resp o nse t o f o ur re v i e w s. Artificial Intelligence 4 8 , 371-396. M otherw ell, L. (1988). G ender and style differences in a Logo-based environment, Ph D thesis, MIT M edia Laboratory. M yers, B. A ., D . A . G iuse, et al. (1994). M aking Structured G raphics and C onstraints for LargeScale Applications. Carnegie Mellon U niversity CS C M U-CS-94-150, May 1994. N ardi, B. A . (1993). A S mall Matter of Programming. C ambridge, M A: MIT Press. N ass, C . , J. Ste u er, et a l . (1 9 9 3). A nthro p o m orp h ism , A ge n c y , & Eth o p o e i a: C o m p uters as Social A ctors, Proceedings of I N TERC H I'93, A msterdam. N elson, T. H . (1974). Computer Lib/Dream Machines: self-published. N i l ss o n , N . J . ( 1 9 9 4 ) . T e l e o -R e a c t i v e Pr o gr a m s f o r A g e n t C o n tr o l . J ournal of Artificial Intelligence Research 1, 139-158. N orv ig, P. (1 9 9 2). Paradigms of Artificial Intelligence: C ase S tudies in C ommon Lisp : M orga n Kaufmann. O ren, T., G . Salomon, et al. (1990). G uides: C haracteri z ing the Interface. In The Art of H umanC omputer Interface , edited by B. Laurel. Reading, M assachusetts: A ddison- W esley. Pa p ert , S. (1 9 8 0). M i n dstorms: C h i l dre n , C o m p uters, a n d Po w erfu l Id e as. N e w Y ork: B asi c Books. Pa p ert, S. (1 9 9 1). Situ ati ng C o nstru cti o n ism . In C onstructionism , e d i t e d b y I . H a r e l a n d S . Papert. N orw ood, N J: A blex. Papert, S. (1993). The C hildren's M achine: Rethinking S chool in the Age of the C omputer. N e w York: Basic Books. Penrose, R. (1989). The Emperor's N e w M ind . O xford: O xford U n i v ersity Press. Piaget, J. (1929). The Child's Conception of the W orld . London: Routledge and Kegan Paul. Piaget, J. (1970). G enetic Epistemology . N e w York: C olumbia U niversity Press. P i m m , D . ( 1 9 8 7 ) . S p e a k i ng M ath e m ati c a l l y: C o m m u n i c ati o n i n M ath e m ati cs C l assro o ms. London: Routledge & Kegan Paul. Premack, D . (1990). The infant's theory of self-propelled objects. Cognition 36, 1-16. Re d d y , D . R. , L. D . Erm a n , et a l . (1 9 7 3). A m o d e l a n d a syste m for m a c h i n e re c ogn iti o n of speech. IEEE Transactions on A udio and Electroacoustics 21, 229-238.

Bibliography

203

Re d d y , M . J. (1 9 9 3). T h e c o n d u it m eta p h or: A c ase of fra m e c o nfl i ct i n o ur l a ngu age a b o ut l a n g u a g e . I n M e t a p h o r a n d T h o u g h t, e d i t e d b y A . O r t o n y . C a m b r i d g e : C a m b r i d g e U niversity Press. Re p e n n i ng, A . (1 9 9 3). A ge ntsh e ets: A T o o l for B u i l d i ng D o m a i n- O re i nte d D y n a m i c , V isu a l Environments, Ph D thesis, U niversity of C olorado. Resnick, M . (1988). M ultiLogo: A Study of C hildren and C oncurrent Programming, MS thesis, MIT. Resn i c k , M . (1 9 9 2). B e y o n d t h e C e n tra l i z e d M i n dse t: Ex p l ora t i o ns i n M assi v e l y -Para l l e l M icro w orlds, Ph D thesis, MIT. Resnick, M . and F. M artin (1991). C hildren and Artificial Life. In C onstructionism , e d i t e d b y I. H arel and S. Papert. N orw ood N J: A blex. Sarasw at, V . (1993). C oncurrent C onstraint Programming. C ambridge, M A: MIT Press. Sayeki, Y. (1989). A nthropomorphic Epistemology. U niversity of Tokyo. Schaefer, R. (1980). N arration in the Psychoanalytic D ialogue. In O n N arrative , e d ite d b y W . J. T. M itchell. C hicago: U niversity of C hicago Press. Schank, R. C . (1975). C onceptual Information Processing. A msterdam: N orth- H olland. Schoppers, M . J. (1987). U niversal plans for reactive robots in unpredicatable environments, Proceedings of Tenth International Conference of Artificial Intelligence, Milan. Searle, J. R. (1980). M inds, Brains, and Programs. The Behavioral and Brain S ciences 3 , 4 1 7424, 450-457. Shneiderman, B. (1983). D irect manipulation: A step beyond programming languages. I E E E C omputer 16(8), 57-69. S h n e i d e r m a n , B . ( 1 9 9 2 ) . D e s i g n i n g t h e U s e r I n t e rf a c e : S tr a t e g i e s f o r Ef f e c t i v e H u m a n C omputer Interaction . Reading, M A: A ddison- W esley. Shoham, Y. (1993). Agent O riented Programming. Artificial Intelligence 60(1), 51-92. Siskind, J. M . and D . A . M c A llester (1993). N ondeterministic Lisp as a Substrate for C onstraint Logic Programming, Proceedings of A A AI-93. Sloane, B., D . Levitt, et al. (1986). H ookup!, H ip Softw are. Softw are. Smith, B. C . and C . H e w itt (1975). A PLASM A Primier. MIT Artificial Intelligence Laboratory W orking Paper 92, O ctober 1975. Sm i t h , R. (1 9 8 7). Ex p eri e n c es w i t h t h e A l t ern a t e Re a l i t y K i t: A n Ex a m p l e o f t h e T e nsi o n B e t w e e n L i t e r a l i s m a n d M a g i c , Pr o c e e d i n gs o f SI G C H I + G I 8 7 : H u m a n F a c t o rs i n C omputing Systems, Toronto. Solomon, C . (1986). C omputer Environments for C hildren: A Reflection on Theories of Learning and Education . C ambridge, M assachusetts: MIT Press. Solomon, C . J. (1976). Teaching the C omputer to A dd: A n Example of Problem-Solving in an A n t h r o p o m o r p h i c C o m p u t e r C u l t u r e . M I T A rt i f i c i a l I n t e l l i g e n c e L a b A I M e m o 3 7 6 , D ecember 1976. 204 Bibliograpy

Stallman, R. M . (1981). EM A CS: The Extensible, C ustomi z able D isplay Editor. M assachusetts Institute of Technology Artifical Intelligence Laboratory Memo 519a. Steele, G . L. (1976). Lambda: The U ltimate D eclarative. MIT AI Lab AI M emo 379, N ovember 1976. Steele, G . L. (1980). The D efinition and Implementation of a C omputer Programming Language Based on C onstraints, Ph D thesis, MIT. Steele, G . L. (1990). Common Lisp: The Language ( 2nd Edition ): D igital Press. Steele, G . L. and G . J. Sussman (1976). Lambda: The U ltimate Imperative. MIT AI Lab AI M emo 353, M arch 10, 1976. Ste w art, J. A . (1982). O bject M otion and the Perception of A nimacy, Ph D thesis, U niversity of Pennsylvania. Suth erl a n d , I. (1 9 6 3). Sk etc h p a d: A M a n-m a c h i n e G ra p h i c a l C o m m u n i c ati o ns Syste m , Ph D thesis, MIT. S w e e tser, E. (1 9 9 0). Fro m Et y m o l ogy t o Pragm a t i cs: M e t a p h ori c a l a n d c u l t ura l asp e c ts o f semantic structure : C ambridge U niversity Press. Tanaka, Y. (1993). IntelligentPad. J apan C omputer Q uarterly(92). T h risso n , K . R. (1 9 9 6). ToonFace: A System for Creating and A nimating Interactive C artoon Faces. MIT M edia Laboratory Learning and C ommon Sense Section Technical Report 96-01. Tinbergen, N . (1951). The S tudy of Instinct . O xford: O xford U n i v ersity Press. Travers, M . (1988). Agar: A n A nimal C onstruction Kit, MS thesis, MIT M edia Laboratory. Tra v ers, M . (1 9 8 8). A n i m a l C o nstru cti o n K its. In Artificial Life: S FI S eries in the S ciences of Complexity , edited by C . Langton. Reading, M A: A ddison- W esley. Travers, M . and M . D avis (1993). Programming w ith C haracters, Proceedings of International W orkshop on Intelligent U ser Interfaces, O rlando, Florida. T uri ng, A . M . (1 9 3 6). O n c o m p ut a b l e n u m b ers, w it h a n a p p l i c at i o n t o t h e Entscheidungsproblem . Proc. London M ath. S oc., S er 2 42, 2330-265. T urk l e , S. (1 9 8 4). T h e S e c o n d S e lf: C o m p uters a n d th e H u m a n S p irit . N e w Y o r k : S i m o n & Schuster. T urk l e , S. (1 9 9 1). Ro m a t i c re a c t i o ns: p ara d o x i c a l resp o nses t o t h e c o m p u t er prese n c e . In Boundaries of H umanity: H umans, A nimals, M achines, edited by J. Sheehan and M . Sosna. Berkeley, C A: U niversity of C alifornia Press. Turkle, S. and S. Papert (1991). Epistemological Pluralism and the Revaluation of the C oncrete. In C onstructionism , edited by I. H arel and S. Papert. N orw ood N J: A blex. T urn er, M . (1 9 9 1). Re a d i ng M i n ds: T h e S t u d y o f Engl ish i n t h e A ge o f C ogn i t i v e S c i e n c e . Princeton, N J: Princeton U niversity Press. Tyrrell, T. (1993). C omputational M echanisms for A ction Selection, Ph D thesis, U niversity of Edinburgh.

Bibliography

205

U llman, S. (1984). V isual Routines. Cognition 18, 97-159. U ngar, D . and R. B. Smith (1987). Self: The Po w er of Simplicity, Proceedings of O O PSLA '87, O rlando, Florida. W inograd, T. (1991). Thinking M achines: C an There Be? Are W e? In Boundaries of H umanity: H umans, Animals, Machines, edited by J. Sheehan and M . Sosna. Berkeley, C A : U niversity of C alifornia Press. W inston, P. (1982). Learning by A ugmenting Rules and A ccumulating C ensors. MIT Artificial Intelligence Laboratory Report AIM-678. W inston, P. H . (1992). Artificial Intelligence . Reading, M A: A ddison W esley.

206

Bibliograpy

You might also like