Prims - Optional arguments
[clnl] / src / main / nvm / base.lisp
index dfd3fc2172fb1ce0de5f95c092790e5722a9f1dd..d93089e32e7b1bacb53a7581d4cb6ef55ce197bd 100644 (file)
@@ -3,9 +3,31 @@
 (defvar *current-id* 0)
 
 (defvar *turtles* nil)
+(defvar *patches* nil)
 (defvar *myself* nil)
 (defvar *self* nil)
 (defvar *dimensions* nil)
 (defvar *topology* :torus)
+(defvar *ticks* nil)
 
-(defstruct turtle who color heading xcor ycor)
+(defstruct turtle who color heading xcor ycor (label "") (label-color 9.9d0) (size 1d0))
+(defstruct patch color xcor ycor)
+
+(defun agentset-list (agentset)
+ (cond
+  ((eql agentset :turtles) *turtles*)
+  ((eql agentset :patches) *patches*)
+  ((and (listp agentset) (eql :agentset (car agentset))) (cdr agentset))
+  (t (error "Doesn't seem to be an agentset: ~A" agentset))))
+
+(defun list->agentset (list)
+ (cons :agentset list))
+
+(defun agentset-p (o)
+ (or
+  (eql o :turtles)
+  (eql o :patches)
+  (and (listp o) (eql :agentset (car o)))))
+
+(defun agent-p (o)
+ (or (turtle-p o) (patch-p o)))