:ycor 0d0))))
(incf *current-id*))
+(defun die ()
+ "DIE => RESULT
+
+ARGUMENTS AND VALUES:
+
+ RESULT: undefined, commands don't return
+
+DESCRIPTION:
+
+ The turtle or link dies
+
+ A dead agent ceases to exist. The effects of this include:
+ - The agent will not execute any further code.
+ - The agent will disappear from any agentsets it was in, reducing the size of those agentsets by one.
+ - Any variable that was storing the agent will now instead have nobody in it.
+ - If the dead agent was a turtle, every link connected to it also dies.
+ - If the observer was watching or following the agent, the observer's perspective resets.
+
+ See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#die"
+ (when (not (turtle-p *self*)) (error "Gotta call die in turtle scope, dude (~A)" *self*))
+ (setf (turtle-who *self*) -1)
+ (setf *turtles* (remove *self* *turtles*)))
+
(defun turtles ()
"TURTLES => ALL-TURTLES
See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#create-turtles"
(loop :for i :from 1 :to n :do (create-turtle)))
-(defun create-world (model)
- "CREATE-WORLD MODEL => RESULT
+(defun create-world (&key dims)
+ "CREATE-WORLD &key DIMS => RESULT
+
+ DIMS: (:xmin XMIN :xmax XMAX :ymin YMIN :ymax YMAX)
ARGUMENTS AND VALUES:
- MODEL: A clnl-model:model to use to initialize the vm
RESULT: undefined
+ XMIN: An integer representing the minimum patch coord in X
+ XMAX: An integer representing the maximum patch coord in X
+ YMIN: An integer representing the minimum patch coord in Y
+ YMAX: An integer representing the maximum patch coord in Y
DESCRIPTION:
This should be called before using the engine in any real capacity. If
called when an engine is already running, it may do somethign weird."
- (setf *model* model)
+ (setf *dimensions* dims)
(setf *turtles* nil)
(setf *current-id* 0))
(defmethod dump-object ((o string)) o)
+(defmethod dump-object ((o (eql t))) "true")
+(defmethod dump-object ((o (eql nil))) "false")
+
(defun current-state ()
"CURRENT-STATE => WORLD-STATE