(defvar *current-id* 0)
(defvar *turtles* nil)
+(defvar *turtles-own-vars* nil)
+(defvar *patches-own-vars* nil)
(defvar *patches* nil)
(defvar *myself* nil)
(defvar *self* nil)
(defvar *dimensions* nil)
+(defvar *globals* nil)
(defvar *topology* :torus)
(defvar *ticks* nil)
(defvar *breeds* nil)
WITH-STOP-HANDLER is a convenience macro to handle when
programs issue a stop condition. When one does, a simple
:stop is returned."
- `(handler-case (progn ,@forms) (stop (s) :stop)))
+ `(handler-case (progn ,@forms) (stop (s) (declare (ignore s)) :stop)))
-(defstruct turtle who color heading xcor ycor (label "") (label-color 9.9d0) (size 1d0) shape)
-(defstruct patch color xcor ycor)
+(defstruct turtle who breed color heading xcor ycor (label "") (label-color 9.9d0) (size 1d0) shape own-vars)
+(defstruct patch color xcor ycor own-vars turtles)
(defun agentset-list (agentset)
(cond
((eql agentset :turtles) *turtles*)
((eql agentset :patches) *patches*)
((and (listp agentset) (eql :agentset (car agentset))) (cddr agentset))
+ ((find agentset *breeds* :key #'car)
+ (remove agentset *turtles* :key #'turtle-breed :test-not #'eql))
(t (error "Doesn't seem to be an agentset: ~A" agentset))))
(defun agentset-breed (agentset)
(cond
((eql agentset :turtles) :turtles)
((eql agentset :patches) :patches)
+ ((find agentset *breeds* :key #'car) agentset)
((and (listp agentset) (eql :agentset (car agentset))) (second agentset))
(t (error "Doesn't seem to be an agentset: ~A" agentset))))
(or
(eql o :turtles)
(eql o :patches)
+ (find o *breeds* :key #'car)
(and (listp o) (eql :agentset (car o)))))
(defun agent-p (o)