Code reformat - Break up nvm files, package declaration based on dictionary grouping
[clnl] / src / main / nvm / world.lisp
1 (in-package #:clnl-nvm)
2
3 (defun clear-patches ()
4  (setf
5   *patches*
6   (loop
7    :for y :from (max-pycor) :downto (min-pycor)
8    :append (loop
9             :for x :from (min-pxcor) :to (max-pxcor)
10             :collect (make-patch
11                       :xcor (coerce x 'double-float)
12                       :ycor (coerce y 'double-float)
13                       :color 0d0)))))
14
15 (defun clear-turtles ()
16  (setf *turtles* nil)
17  (setf *current-id* 0))
18
19 (defun clear-ticks ()
20  (setf *ticks* nil))
21
22 (defun clear-all ()
23  "CLEAR-ALL => RESULT
24
25 ARGUMENTS AND VALUES:
26
27   RESULT: undefined
28
29 DESCRIPTION:
30
31   Clears ticks, turtles, patches, globals (unimplemented).
32
33   See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#clear-all"
34  (clear-turtles)
35  (clear-patches)
36  (clear-ticks))
37
38 (defun display ()
39  "DISPLAY => RESULT
40
41 ARGUMENTS AND VALUES:
42
43   RESULT: undefined
44
45 DESCRIPTION:
46
47   As of yet, this does nothing.  A placeholder method for forced dipslay
48   updates from the engine.
49
50   See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#display"
51  nil)
52
53 (defun reset-ticks ()
54  "RESET-TICKS => RESULT
55
56 ARGUMENTS AND VALUES:
57
58   RESULT: undefined
59
60 DESCRIPTION:
61
62   Resets the tick counter to zero, sets up all plots, then updates all plots.
63
64   See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#reset-ticks"
65  (setf *ticks* 0d0))
66
67 (defun tick ()
68  "RESET-TICKS => RESULT
69
70 ARGUMENTS AND VALUES:
71
72   RESULT: undefined
73
74 DESCRIPTION:
75
76   Advances the tick counter by one and updates all plots.
77
78   If the tick counter has not been started yet with reset-ticks, an error results.
79
80   See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#tick"
81
82  (when (not *ticks*) (error "reset-ticks must be called"))
83  (incf *ticks*))
84
85 (defun ticks ()
86  "TICKS => CURRENT-TICKS
87
88 ARGUMENTS AND VALUES:
89
90   CURRENT-TICKS: A positiv double, representing the current number of ticks
91
92 DESCRIPTION:
93
94   Reports the current value of the tick counter. The result is always a number and never negative.
95
96   If the tick counter has not been started yet with reset-ticks, an error results.
97
98   See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#ticks"
99  (when (not *ticks*) (error "reset-ticks must be called"))
100  *ticks*)