Prims - Implement with
[clnl] / src / main / nvm / base.lisp
index ddd429ee265cf9ca01825340f13b340db20960d2..ba895e38456f65da034ceee932b860125cc56001 100644 (file)
@@ -8,6 +8,33 @@
 (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))) (cddr agentset))
+  (t (error "Doesn't seem to be an agentset: ~A" agentset))))
+
+(defun agentset-breed (agentset)
+ (cond
+  ((eql agentset :turtles) :turtles)
+  ((eql agentset :patches) :patches)
+  ((and (listp agentset) (eql :agentset (car agentset))) (second agentset))
+  (t (error "Doesn't seem to be an agentset: ~A" agentset))))
+
+(defun list->agentset (list breed)
+ (append (list :agentset breed) 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)))