13-001 // Sugarscape in Swarm. Copyright © 2004 Paul Johnson
13-002 // This program is distributed without any warranty; without even the
13-003 // implied warranty of merchantability or fitness for a particular purpose.
13-004 // See file LICENSE for details and terms of copying.
13-005 
13-006 
13-007 #import <objectbase/SwarmObject.h>
13-008 #import <space.h>				  // we use Space features
13-009 #import <gui.h>
13-010 #import "SugarSpace.h"
13-011 
13-012 // The definition of a SugarAgent object. We inherit code from the generic
13-013 // SwarmObject, which provides memory allocation and other niceties. It
13-014 // does not provide any sort of agent behaviour, though, that's up to us.
13-015 // First, there are a lot of state variables
13-016 
13-017 @interface Predator: SwarmObject
13-018 {
13-019   SugarValue currentSugar;			  // how much sugar I hold
13-020   SugarValue metabolism;			  // how much sugar I need
13-021   int vision;					  // how far I can see
13-022   int age;					  // how old I am
13-023   int deathAge;					  // how old I can get
13-024   int numKilled;
13-025   
13-026   id modelSwarm;				  // my swarm
13-027   SugarSpace *sugarSpace;			  // the sugarspace I live in
13-028   id <Pixmap> myPixmap;
13-029 
13-030   @public
13-031   int x, y;					  // my position
13-032   // I won't change this myself
13-033 }
13-034 
13-035 // The main behaviour of an object - do one 'time step', one action.
13-036 - step;
13-037 
13-038 // The agent movement rule M.
13-039 - move;
13-040 
13-041 // data accessor functions.
13-042 - (SugarValue)getMetabolism;
13-043 - (int)getVision;
13-044 - (int)getAge;
13-045 - (int)getNumKilled;
13-046 - (SugarValue)getCurrentSugar;
13-047 - setModelSwarm: s;
13-048 - setCurrentSugar: (SugarValue)cs;
13-049 - setMetabolism: (SugarValue)m;
13-050 - setVision: (int)v;
13-051 - setDeathAge: (int)a;
13-052 
13-053 // display code so you can see the agents moving.
13-054 - drawSelfOn: (id <Raster>)r;
13-055 
13-056 @end

