Quellcode durchsuchen

netlogo variant

Simon Van Mierlo vor 7 Jahren
Ursprung
Commit
6c86df709d
100 geänderte Dateien mit 11036 neuen und 0 gelöschten Zeilen
  1. 647 0
      debugging_environment/NetLogo/.BouncingBalls.tmp.nlogo
  2. 647 0
      debugging_environment/NetLogo/BouncingBalls.nlogo
  3. 1 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/.gitignore
  4. 55 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/README.md
  5. 17 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/build.sbt
  6. 1 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/project/build.properties
  7. 1 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/project/plugins.sbt
  8. 1 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/project/scripted.sbt
  9. 5 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/scripted.sbt
  10. 169 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/main/scala/org/nlogo/build/NetLogoExtension.scala
  11. 20 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/.gitignore
  12. 22 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/build.sbt
  13. 1 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/project/build.properties
  14. 7 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/project/plugins.sbt
  15. 22 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/src/main/Hello.scala
  16. 4 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/test
  17. 20 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/.gitignore
  18. 28 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/build.sbt
  19. 1 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/project/build.properties
  20. 7 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/project/plugins.sbt
  21. 22 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/src/main/Hello.scala
  22. 8 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/test
  23. 11 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/build.sbt
  24. 1 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/project/build.properties
  25. 7 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/project/plugins.sbt
  26. 21 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/src/main/Hello.scala
  27. 4 0
      debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/test
  28. 1 0
      debugging_environment/NetLogo/Reflection-Extension
  29. 0 0
      debugging_environment/NetLogo/__init__.py
  30. 117 0
      debugging_environment/NetLogo/client.py
  31. BIN
      debugging_environment/NetLogo/extensions/arduino/arduino.jar
  32. BIN
      debugging_environment/NetLogo/extensions/arduino/jssc-2.6.0.jar
  33. BIN
      debugging_environment/NetLogo/extensions/array/array.jar
  34. BIN
      debugging_environment/NetLogo/extensions/bitmap/bitmap.jar
  35. BIN
      debugging_environment/NetLogo/extensions/cf/cf.jar
  36. BIN
      debugging_environment/NetLogo/extensions/csv/commons-csv-1.0.jar
  37. BIN
      debugging_environment/NetLogo/extensions/csv/csv.jar
  38. BIN
      debugging_environment/NetLogo/extensions/gis/commons-codec-1.10.jar
  39. BIN
      debugging_environment/NetLogo/extensions/gis/commons-httpclient-3.1.jar
  40. BIN
      debugging_environment/NetLogo/extensions/gis/commons-logging-1.2.jar
  41. BIN
      debugging_environment/NetLogo/extensions/gis/gis.jar
  42. BIN
      debugging_environment/NetLogo/extensions/gis/jai_codec-1.1.3.jar
  43. BIN
      debugging_environment/NetLogo/extensions/gis/jai_core-1.1.3.jar
  44. BIN
      debugging_environment/NetLogo/extensions/gis/jts-1.13.jar
  45. BIN
      debugging_environment/NetLogo/extensions/gis/ngunits-1.0.0.jar
  46. BIN
      debugging_environment/NetLogo/extensions/gogo/gogo-daemon.jar
  47. BIN
      debugging_environment/NetLogo/extensions/gogo/gogo.jar
  48. BIN
      debugging_environment/NetLogo/extensions/gogo/hid4java.jar
  49. BIN
      debugging_environment/NetLogo/extensions/gogo/jna.jar
  50. BIN
      debugging_environment/NetLogo/extensions/ls/guava-18.0.jar
  51. BIN
      debugging_environment/NetLogo/extensions/ls/jsr305-3.0.0.jar
  52. BIN
      debugging_environment/NetLogo/extensions/ls/ls.jar
  53. BIN
      debugging_environment/NetLogo/extensions/ls/macro-compat_2.12-1.1.1.jar
  54. BIN
      debugging_environment/NetLogo/extensions/ls/parboiled_2.12-2.1.3.jar
  55. BIN
      debugging_environment/NetLogo/extensions/ls/shapeless_2.12-2.3.2.jar
  56. BIN
      debugging_environment/NetLogo/extensions/matrix/jama-1.0.3.jar
  57. BIN
      debugging_environment/NetLogo/extensions/matrix/matrix.jar
  58. BIN
      debugging_environment/NetLogo/extensions/nw/collections-generic-4.01.jar
  59. BIN
      debugging_environment/NetLogo/extensions/nw/colt-1.2.0.jar
  60. BIN
      debugging_environment/NetLogo/extensions/nw/concurrent-1.3.4.jar
  61. BIN
      debugging_environment/NetLogo/extensions/nw/gephi-toolkit-0.8.2.jar
  62. BIN
      debugging_environment/NetLogo/extensions/nw/jgrapht-0.8.3.jar
  63. BIN
      debugging_environment/NetLogo/extensions/nw/jung-algorithms-2.0.1.jar
  64. BIN
      debugging_environment/NetLogo/extensions/nw/jung-api-2.0.1.jar
  65. BIN
      debugging_environment/NetLogo/extensions/nw/jung-graph-impl-2.0.1.jar
  66. BIN
      debugging_environment/NetLogo/extensions/nw/jung-io-2.0.1.jar
  67. BIN
      debugging_environment/NetLogo/extensions/nw/nw.jar
  68. BIN
      debugging_environment/NetLogo/extensions/nw/stax-api-1.0.1.jar
  69. BIN
      debugging_environment/NetLogo/extensions/nw/wstx-asl-3.2.6.jar
  70. BIN
      debugging_environment/NetLogo/extensions/palette/palette.jar
  71. BIN
      debugging_environment/NetLogo/extensions/profiler/profiler.jar
  72. 349 0
      debugging_environment/NetLogo/extensions/r/GPL.txt
  73. BIN
      debugging_environment/NetLogo/extensions/r/jna-4.2.2.jar
  74. 581 0
      debugging_environment/NetLogo/extensions/r/models/boxplot-example.nlogo
  75. 530 0
      debugging_environment/NetLogo/extensions/r/models/datafile-example.nlogo
  76. 559 0
      debugging_environment/NetLogo/extensions/r/models/diversity-example.nlogo
  77. 444 0
      debugging_environment/NetLogo/extensions/r/models/example1.nlogo
  78. 675 0
      debugging_environment/NetLogo/extensions/r/models/homerange-example.nlogo
  79. 456 0
      debugging_environment/NetLogo/extensions/r/models/interactiveShell.nlogo
  80. 717 0
      debugging_environment/NetLogo/extensions/r/models/l-function.nlogo
  81. 514 0
      debugging_environment/NetLogo/extensions/r/models/linear_regression-example.nlogo
  82. 523 0
      debugging_environment/NetLogo/extensions/r/models/package-example.nlogo
  83. 468 0
      debugging_environment/NetLogo/extensions/r/models/patchesToRMatrix.nlogo
  84. 497 0
      debugging_environment/NetLogo/extensions/r/models/plot-example1.nlogo
  85. 469 0
      debugging_environment/NetLogo/extensions/r/models/plot-example2.nlogo
  86. 465 0
      debugging_environment/NetLogo/extensions/r/models/plot-to-file-example.nlogo
  87. 6 0
      debugging_environment/NetLogo/extensions/r/models/rfunction1.r
  88. 505 0
      debugging_environment/NetLogo/extensions/r/models/ripleysK-example.nlogo
  89. 438 0
      debugging_environment/NetLogo/extensions/r/models/rscript-example.nlogo
  90. 474 0
      debugging_environment/NetLogo/extensions/r/models/spearman-example.nlogo
  91. 479 0
      debugging_environment/NetLogo/extensions/r/models/wilcoxon-example.nlogo
  92. BIN
      debugging_environment/NetLogo/extensions/r/r.jar
  93. 19 0
      debugging_environment/NetLogo/extensions/r/user.properties
  94. BIN
      debugging_environment/NetLogo/extensions/reflection/reflection.jar
  95. BIN
      debugging_environment/NetLogo/extensions/rnd/rnd.jar
  96. BIN
      debugging_environment/NetLogo/extensions/sample-scala/sample-scala.jar
  97. BIN
      debugging_environment/NetLogo/extensions/sample/sample.jar
  98. BIN
      debugging_environment/NetLogo/extensions/sound/sound.jar
  99. BIN
      debugging_environment/NetLogo/extensions/table/table.jar
  100. 0 0
      debugging_environment/NetLogo/extensions/vid/bridj-0.7.0.jar

+ 647 - 0
debugging_environment/NetLogo/.BouncingBalls.tmp.nlogo

@@ -0,0 +1,647 @@
+extensions [reflection]
+
+turtles-own
+[
+  velocity-x
+  velocity-y
+  new-velocity-x
+  new-velocity-y
+  my-state
+]
+
+to setup
+  random-seed 1337
+  clear-all
+  set-default-shape turtles "circle"
+  reset-ticks
+end
+
+to go
+  if mouse-down? [
+    let grabbed one-of turtles with [ (distancexy mouse-xcor mouse-ycor) < size / 2 ]
+    if grabbed != nobody
+    [
+      ask grabbed
+      [
+        select
+      ]
+    ]
+  ]
+  create-particle
+  delete-particles-at-random
+  check-state
+  check-collisions
+  move-particles
+  tick
+  display
+end
+
+to select
+  set my-state "selected"
+end
+
+to check-state
+  ask turtles with [my-state = "selected"]
+  [
+    set velocity-x 0
+    set velocity-y 0
+    set new-velocity-x velocity-x
+    set new-velocity-y velocity-y
+    set color orange
+  ]
+end
+
+to delete-selected
+  ask turtles with [my-state = "selected"]
+  [
+    die
+  ]
+end
+
+to create-particle
+  if ticks mod 30 = 0
+  ;if count turtles < 2
+  [
+    let the-patch one-of patches with [ not any? turtles-here ]
+    if the-patch != nobody
+    [
+      ask the-patch
+      [
+        let temp-size 0.5 + random-float 2.5
+        ;let temp-xcor (min-pxcor - 0.5 + temp-size / 2) + random-float (max-pxcor + 0.499 - temp-size / 2)
+        ;let temp-ycor (min-pycor - 0.5 + temp-size / 2) + random-float (max-pycor + 0.499 - temp-size / 2)
+        sprout 1
+        [
+          set my-state "bouncing"
+          set color red
+          ; setxy temp-xcor temp-ycor
+          set size temp-size
+          if xcor > max-pxcor + 0.499 - size / 2
+          [
+            set xcor max-pxcor + 0.499 - size / 2
+          ]
+          if xcor < min-pxcor - 0.5 + size / 2
+          [
+            set xcor min-pxcor - 0.5 + size / 2
+          ]
+          if ycor > max-pycor + 0.499 - size / 2
+          [
+            set ycor max-pycor + 0.499 - size / 2
+          ]
+          if ycor < min-pycor - 0.5 + size / 2
+          [
+            set ycor min-pycor - 0.5 + size / 2
+          ]
+          let colliding-turtle find-collision
+          ifelse colliding-turtle != nobody
+          [
+            die
+          ]
+          [
+            set velocity-x 0.05 + random-float 0.5
+            set velocity-y 0.05 + random-float 0.5
+            set new-velocity-x velocity-x
+            set new-velocity-y velocity-y
+          ]
+        ]
+      ]
+    ]
+  ]
+end
+
+to delete-particles-at-random
+  ask turtles
+  [
+    if my-state = "bouncing" and random-float 1.0 < 0.005
+    [
+      die
+    ]
+  ]
+end
+
+to move-particles
+  ask turtles
+  [
+    move
+  ]
+end
+
+to move
+  let new-x xcor + velocity-x
+  let new-y ycor + velocity-y
+  if new-x > max-pxcor + 0.499 - size / 2 or new-x < min-pxcor - 0.5 + size / 2
+  [
+    set velocity-x (- velocity-x)
+    set new-velocity-x velocity-x
+    set new-x xcor + velocity-x
+  ]
+  if new-y > max-pycor + 0.499 - size / 2 or new-y < min-pycor - 0.5 + size / 2
+  [
+    set velocity-y (- velocity-y)
+    set new-velocity-y velocity-y
+    set new-y ycor + velocity-y
+  ]
+  setxy new-x new-y
+end
+
+to check-collisions
+  ask turtles with [my-state = "bouncing"]
+  [
+    let colliding-turtle find-collision
+    if colliding-turtle != nobody
+    [
+      let other-state [my-state] of colliding-turtle
+      ifelse other-state = "selected"
+      [
+        set new-velocity-x (- velocity-x)
+        set new-velocity-y (- velocity-y)
+      ]
+      [
+        let ct-velocity-x [velocity-x] of colliding-turtle
+        let ct-velocity-y [velocity-y] of colliding-turtle
+        set new-velocity-x ct-velocity-x
+        set new-velocity-y ct-velocity-y
+      ]
+    ]
+  ]
+  ask turtles [
+    set velocity-x new-velocity-x
+    set velocity-y new-velocity-y
+  ]
+end
+
+to-report find-collision
+  report one-of other turtles with [collision? self myself]
+end
+
+to-report collision? [turtle-a turtle-b]
+  let ax [xcor] of turtle-a
+  let ay [ycor] of turtle-a
+  let asize [size] of turtle-a
+  let bx [xcor] of turtle-b
+  let by [ycor] of turtle-b
+  let bsize [size] of turtle-b
+  let distance-x ax - bx
+  let distance-y ay - by
+  let the-distance sqrt ((distance-x * distance-x) + (distance-y * distance-y))
+  ;let mylist (list ax ay asize bx by bsize distance-x distance-y the-distance)
+  ;print mylist
+  report (the-distance < (asize / 2 + bsize / 2))
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+230
+80
+576
+427
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+0
+0
+1
+0
+25
+0
+25
+1
+1
+1
+ticks
+9999.0
+
+BUTTON
+76
+198
+139
+231
+NIL
+go
+T
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+43
+111
+106
+144
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+110
+111
+188
+145
+step
+go
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+43
+150
+161
+184
+delete-selected
+delete-selected
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+(a general understanding of what the model is trying to show or explain)
+
+## HOW IT WORKS
+
+(what rules the agents use to create the overall behavior of the model)
+
+## HOW TO USE IT
+
+(how to use the model, including a description of each of the items in the Interface tab)
+
+## THINGS TO NOTICE
+
+(suggested things for the user to notice while running the model)
+
+## THINGS TO TRY
+
+(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
+
+## EXTENDING THE MODEL
+
+(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
+
+## NETLOGO FEATURES
+
+(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
+
+## RELATED MODELS
+
+(models in the NetLogo Models Library and elsewhere which are of related interest)
+
+## CREDITS AND REFERENCES
+
+(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+sheep
+false
+15
+Circle -1 true true 203 65 88
+Circle -1 true true 70 65 162
+Circle -1 true true 150 105 120
+Polygon -7500403 true false 218 120 240 165 255 165 278 120
+Circle -7500403 true false 214 72 67
+Rectangle -1 true true 164 223 179 298
+Polygon -1 true true 45 285 30 285 30 240 15 195 45 210
+Circle -1 true true 3 83 150
+Rectangle -1 true true 65 221 80 296
+Polygon -1 true true 195 285 210 285 210 240 240 210 195 210
+Polygon -7500403 true false 276 85 285 105 302 99 294 83
+Polygon -7500403 true false 219 85 210 105 193 99 201 83
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+wolf
+false
+0
+Polygon -16777216 true false 253 133 245 131 245 133
+Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105
+Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0.3
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 647 - 0
debugging_environment/NetLogo/BouncingBalls.nlogo

@@ -0,0 +1,647 @@
+extensions [reflection]
+
+turtles-own
+[
+  velocity-x
+  velocity-y
+  new-velocity-x
+  new-velocity-y
+  my-state
+]
+
+to setup
+  random-seed 1337
+  clear-all
+  set-default-shape turtles "circle"
+  reset-ticks
+end
+
+to go
+  if mouse-down? [
+    let grabbed one-of turtles with [ (distancexy mouse-xcor mouse-ycor) < size / 2 ]
+    if grabbed != nobody
+    [
+      ask grabbed
+      [
+        select
+      ]
+    ]
+  ]
+  create-particle
+  delete-particles-at-random
+  check-state
+  check-collisions
+  move-particles
+  tick
+  display
+end
+
+to select
+  set my-state "selected"
+end
+
+to check-state
+  ask turtles with [my-state = "selected"]
+  [
+    set velocity-x 0
+    set velocity-y 0
+    set new-velocity-x velocity-x
+    set new-velocity-y velocity-y
+    set color orange
+  ]
+end
+
+to delete-selected
+  ask turtles with [my-state = "selected"]
+  [
+    die
+  ]
+end
+
+to create-particle
+  if ticks mod 30 = 0
+  ;if count turtles < 2
+  [
+    let the-patch one-of patches with [ not any? turtles-here ]
+    if the-patch != nobody
+    [
+      ask the-patch
+      [
+        let temp-size 0.5 + random-float 2.5
+        ;let temp-xcor (min-pxcor - 0.5 + temp-size / 2) + random-float (max-pxcor + 0.499 - temp-size / 2)
+        ;let temp-ycor (min-pycor - 0.5 + temp-size / 2) + random-float (max-pycor + 0.499 - temp-size / 2)
+        sprout 1
+        [
+          set my-state "bouncing"
+          set color red
+          ; setxy temp-xcor temp-ycor
+          set size temp-size
+          if xcor > max-pxcor + 0.499 - size / 2
+          [
+            set xcor max-pxcor + 0.499 - size / 2
+          ]
+          if xcor < min-pxcor - 0.5 + size / 2
+          [
+            set xcor min-pxcor - 0.5 + size / 2
+          ]
+          if ycor > max-pycor + 0.499 - size / 2
+          [
+            set ycor max-pycor + 0.499 - size / 2
+          ]
+          if ycor < min-pycor - 0.5 + size / 2
+          [
+            set ycor min-pycor - 0.5 + size / 2
+          ]
+          let colliding-turtle find-collision
+          ifelse colliding-turtle != nobody
+          [
+            die
+          ]
+          [
+            set velocity-x 0.05 + random-float 0.5
+            set velocity-y 0.05 + random-float 0.5
+            set new-velocity-x velocity-x
+            set new-velocity-y velocity-y
+          ]
+        ]
+      ]
+    ]
+  ]
+end
+
+to delete-particles-at-random
+  ask turtles
+  [
+    if my-state = "bouncing" and random-float 1.0 < 0.005
+    [
+      die
+    ]
+  ]
+end
+
+to move-particles
+  ask turtles
+  [
+    move
+  ]
+end
+
+to move
+  let new-x xcor + velocity-x
+  let new-y ycor + velocity-y
+  if new-x > max-pxcor + 0.499 - size / 2 or new-x < min-pxcor - 0.5 + size / 2
+  [
+    set velocity-x (- velocity-x)
+    set new-velocity-x velocity-x
+    set new-x xcor + velocity-x
+  ]
+  if new-y > max-pycor + 0.499 - size / 2 or new-y < min-pycor - 0.5 + size / 2
+  [
+    set velocity-y (- velocity-y)
+    set new-velocity-y velocity-y
+    set new-y ycor + velocity-y
+  ]
+  setxy new-x new-y
+end
+
+to check-collisions
+  ask turtles with [my-state = "bouncing"]
+  [
+    let colliding-turtle find-collision
+    if colliding-turtle != nobody
+    [
+      let other-state [my-state] of colliding-turtle
+      ifelse other-state = "selected"
+      [
+        set new-velocity-x (- velocity-x)
+        set new-velocity-y (- velocity-y)
+      ]
+      [
+        let ct-velocity-x [velocity-x] of colliding-turtle
+        let ct-velocity-y [velocity-y] of colliding-turtle
+        set new-velocity-x ct-velocity-x
+        set new-velocity-y ct-velocity-y
+      ]
+    ]
+  ]
+  ask turtles [
+    set velocity-x new-velocity-x
+    set velocity-y new-velocity-y
+  ]
+end
+
+to-report find-collision
+  report one-of other turtles with [collision? self myself]
+end
+
+to-report collision? [turtle-a turtle-b]
+  let ax [xcor] of turtle-a
+  let ay [ycor] of turtle-a
+  let asize [size] of turtle-a
+  let bx [xcor] of turtle-b
+  let by [ycor] of turtle-b
+  let bsize [size] of turtle-b
+  let distance-x ax - bx
+  let distance-y ay - by
+  let the-distance sqrt ((distance-x * distance-x) + (distance-y * distance-y))
+  ;let mylist (list ax ay asize bx by bsize distance-x distance-y the-distance)
+  ;print mylist
+  report (the-distance < (asize / 2 + bsize / 2))
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+230
+80
+576
+427
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+0
+0
+1
+0
+25
+0
+25
+1
+1
+1
+ticks
+9999.0
+
+BUTTON
+76
+198
+139
+231
+NIL
+go
+T
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+43
+111
+106
+144
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+110
+111
+188
+145
+step
+go
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+43
+150
+161
+184
+delete-selected
+delete-selected
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+(a general understanding of what the model is trying to show or explain)
+
+## HOW IT WORKS
+
+(what rules the agents use to create the overall behavior of the model)
+
+## HOW TO USE IT
+
+(how to use the model, including a description of each of the items in the Interface tab)
+
+## THINGS TO NOTICE
+
+(suggested things for the user to notice while running the model)
+
+## THINGS TO TRY
+
+(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
+
+## EXTENDING THE MODEL
+
+(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
+
+## NETLOGO FEATURES
+
+(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
+
+## RELATED MODELS
+
+(models in the NetLogo Models Library and elsewhere which are of related interest)
+
+## CREDITS AND REFERENCES
+
+(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+sheep
+false
+15
+Circle -1 true true 203 65 88
+Circle -1 true true 70 65 162
+Circle -1 true true 150 105 120
+Polygon -7500403 true false 218 120 240 165 255 165 278 120
+Circle -7500403 true false 214 72 67
+Rectangle -1 true true 164 223 179 298
+Polygon -1 true true 45 285 30 285 30 240 15 195 45 210
+Circle -1 true true 3 83 150
+Rectangle -1 true true 65 221 80 296
+Polygon -1 true true 195 285 210 285 210 240 240 210 195 210
+Polygon -7500403 true false 276 85 285 105 302 99 294 83
+Polygon -7500403 true false 219 85 210 105 193 99 201 83
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+wolf
+false
+0
+Polygon -16777216 true false 253 133 245 131 245 133
+Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105
+Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0.3
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 1 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/.gitignore

@@ -0,0 +1 @@
+target/

+ 55 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/README.md

@@ -0,0 +1,55 @@
+# NetLogo Extension Plugin
+
+This plugin provides common build boilerplate for NetLogo 5.3.1 and later extensions. For versions before 5.3.1, please refer to [version 2.2_5.3](https://github.com/NetLogo/NetLogo-Extension-Plugin/tree/v2.2_5.3-M1)
+
+Currently, the plugin targets **SBT 1.x** (use v3.1 for SBT 0.13).
+
+## Building
+
+Simply run the `package` SBT command to build a new version of the plugin `.jar`.  Then, set your SBT project's `plugins.sbt` to reference/fetch the `.jar`.
+
+## Usage
+
+For an example usage of this plugin, please see the [NetLogo extension activator template](https://github.com/NetLogo/netlogo-extension-activator)'s [`plugins.sbt`](https://github.com/NetLogo/netlogo-extension-activator/blob/master/project/plugins.sbt) and [`build.sbt`](https://github.com/NetLogo/netlogo-extension-activator/blob/master/build.sbt).
+
+### Project Files
+
+`project/plugins.sbt`
+
+```scala
+resolvers += Resolver.url(
+  "NetLogo-JVM",
+    url("http://dl.bintray.com/content/netlogo/NetLogo-JVM"))(
+        Resolver.ivyStylePatterns)
+
+addSbtPlugin("org.nlogo" % "netlogo-extension-plugin" % "3.2")
+```
+
+`build.sbt`
+
+```scala
+enablePlugins(org.nlogo.build.NetLogoExtension)
+
+netLogoVersion      := "6.0.2"
+
+netLogoClassManager := "HelloScalaExtension"
+
+netLogoExtName      := "helloscala"
+
+netLogoZipSources   := false
+```
+
+### Building to Base Directory
+
+By default, the NetLogo Extension Plugin builds a zip file containing all artifacts.
+If you would like it to extract the sbt base directory instead, you can use:
+
+```scala
+netLogoTarget := org.nlogo.build.NetLogoExtension.directoryTarget(baseDirectory.value)
+```
+
+## Terms of Use
+
+[![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png)](http://creativecommons.org/publicdomain/zero/1.0/)
+
+The NetLogo Extension plugin is in the public domain.  To the extent possible under law, Uri Wilensky has waived all copyright and related or neighboring rights.

+ 17 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/build.sbt

@@ -0,0 +1,17 @@
+sbtPlugin := true
+
+scalaVersion := "2.12.2"
+
+organization := "org.nlogo"
+
+name         := "netlogo-extension-plugin"
+
+version      := "3.2"
+
+isSnapshot   := false
+
+licenses  += ("Public Domain", url("http://creativecommons.org/licenses/publicdomain/"))
+
+bintrayRepository   := "NetLogo-JVM"
+
+bintrayOrganization := Some("netlogo")

+ 1 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/project/build.properties

@@ -0,0 +1 @@
+sbt.version=1.0.1

+ 1 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/project/plugins.sbt

@@ -0,0 +1 @@
+addSbtPlugin("org.foundweekends" %% "sbt-bintray" % "0.5.1")

+ 1 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/project/scripted.sbt

@@ -0,0 +1 @@
+libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value

+ 5 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/scripted.sbt

@@ -0,0 +1,5 @@
+scriptedLaunchOpts := {
+  scriptedLaunchOpts.value ++ Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
+}
+
+scriptedBufferLog := false

+ 169 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/main/scala/org/nlogo/build/NetLogoExtension.scala

@@ -0,0 +1,169 @@
+package org.nlogo.build
+
+import sbt._, Keys._, plugins.JvmPlugin,
+  io.CopyOptions,
+  internal.inc.classpath.ClasspathUtilities
+
+import scala.sys.process.Process
+
+object NetLogoExtension extends AutoPlugin {
+
+  trait Target {
+    def producedFiles(fileMap: Seq[(File, String)]): Seq[File]
+    def create(fileMap: Seq[(File, String)]): Unit
+  }
+
+  class ZipTarget(extName: String, baseDir: File, includeSources: Boolean) extends Target {
+    override def producedFiles(fileMap: Seq[(File, String)]): Seq[File] =
+      Seq(baseDir / s"$extName.zip")
+
+    override def create(sourceMap: Seq[(File, String)]): Unit = {
+      val zipMap = sourceMap.map { case (file, path) => (file, s"$extName/$path") }
+      IO.zip(zipMap, baseDir / s"$extName.zip")
+    }
+
+    private def sourcesToZip: Seq[(File, String)] =
+      if (includeSources) {
+        val allFiles = Process(s"git ls-files", baseDir).lineStream_!.filterNot(_ == ".gitignore")
+        allFiles.map(new File(_)) zip allFiles
+      } else
+        Seq()
+  }
+
+  class DirectoryTarget(baseDir: File) extends Target {
+    override def producedFiles(fileMap: Seq[(File, String)]): Seq[File] =
+      fileMap.map(_._2).map(baseDir / _).filterNot(fileMap.contains) :+ baseDir / ".bundledFiles"
+
+    override def create(sourceMap: Seq[(File, String)]): Unit = {
+      val files = sourceMap.map {
+        case (file, name) => (file, baseDir / name)
+      }
+      IO.write(baseDir / ".bundledFiles",
+        sourceMap
+          .map { t => t._1.getAbsolutePath + "->" + t._2 }
+          .mkString("\n"))
+      IO.copy(files, CopyOptions().withOverwrite(true))
+    }
+  }
+
+  // this is needed because we override settings like `packageBin`, see below,
+  // which are populated by JvmPlugin. -- RG 6/22/15
+  override def requires: Plugins = JvmPlugin
+
+  object autoImport {
+    val netLogoVersion       = settingKey[String]("version of NetLogo to depend on")
+    val netLogoExtName       = settingKey[String]("extension-name")
+    val netLogoClassManager  = settingKey[String]("extension-class-manager")
+    val netLogoZipSources    = settingKey[Boolean]("extension-zip-sources")
+    val netLogoTarget        = settingKey[Target]("extension-target")
+    val netLogoPackageExtras = taskKey[Seq[(File, String)]]("extension-package-extras")
+  }
+
+  lazy val netLogoAPIVersion = taskKey[String]("APIVersion of NetLogo associated with compilation target")
+
+  import autoImport._
+
+  val netLogoPackagedFiles = taskKey[Seq[(File, String)]]("extension-packaged-files")
+
+  override lazy val projectSettings = Seq(
+
+    netLogoExtName := name.value,
+
+    netLogoTarget :=
+      new ZipTarget(netLogoExtName.value, baseDirectory.value, netLogoZipSources.value),
+
+    netLogoZipSources := true,
+
+    netLogoPackageExtras := {
+      (externalDependencyClasspath in Runtime).value.files
+        .filter(path =>
+          path.getName.endsWith(".jar") &&
+          !path.getName.startsWith("scala-library") &&
+          !path.getName.startsWith("NetLogo") &&
+          !path.getName.startsWith("netlogo"))
+        .map(path => (path, path.getName))
+    },
+
+    artifactName := ((_, _, _) => s"${netLogoExtName.value}.jar"),
+
+    netLogoPackagedFiles := {
+      netLogoPackageExtras.value :+ ((artifactPath in packageBin in Compile).value -> s"${netLogoExtName.value}.jar")
+    },
+
+    netLogoAPIVersion := {
+      val loader = ClasspathUtilities.makeLoader(
+        Attributed.data((dependencyClasspath in Compile).value),
+        scalaInstance.value)
+      loader
+        .loadClass("org.nlogo.api.APIVersion")
+        .getMethod("version")
+        .invoke(null).asInstanceOf[String]
+    },
+
+    packageOptions +=
+      Package.ManifestAttributes(
+        ("Extension-Name",                netLogoExtName.value),
+        ("Class-Manager",                 netLogoClassManager.value),
+        ("NetLogo-Extension-API-Version", netLogoAPIVersion.value)
+      ),
+
+    packageBin in Compile := (Def.taskDyn {
+        val jar = (packageBin in Compile).value
+
+        if (isSnapshot.value || Process("git diff --quiet --exit-code HEAD", baseDirectory.value).! == 0) {
+          Def.task {
+            netLogoTarget.value.create(netLogoPackagedFiles.value)
+            jar
+          }
+        } else {
+          Def.task {
+            streams.value.log.warn("working tree not clean when packaging; target not created")
+            IO.delete(netLogoTarget.value.producedFiles(netLogoPackagedFiles.value))
+            jar
+          }
+        }
+    }).value,
+
+    clean := {
+      val _ = clean.value
+      IO.delete(netLogoTarget.value.producedFiles(netLogoPackagedFiles.value))
+    }
+
+  ) ++ netLogoJarSettings
+
+  def netLogoJarSettings: Seq[Setting[_]] = {
+
+    val netLogoJarFile =
+      Option(System.getProperty("netlogo.jar.file"))
+        .map { f =>
+          val jar = file(f)
+          val testJar = file(f.replaceAllLiterally(".jar", "-tests.jar"))
+          Seq(unmanagedJars in Compile ++= Seq(jar, testJar))
+        }
+
+    val netLogoJarURL =
+      Option(System.getProperty("netlogo.jar.url"))
+        .map { url =>
+          val urlVersion = url.split("/").last
+            .stripPrefix("NetLogo")
+            .stripPrefix("-")
+            .stripSuffix(".jar")
+          val version = if (urlVersion == "") "DEV" else urlVersion
+          val testUrl = url.replaceAllLiterally(".jar", "-tests.jar")
+          Seq(libraryDependencies ++= Seq(
+            "org.nlogo" % "NetLogo" % version changing() from url,
+            "org.nlogo" % "NetLogo-tests" % version changing() from testUrl))
+        }
+
+    (netLogoJarFile orElse netLogoJarURL).getOrElse {
+      Seq(
+        resolvers += Resolver.bintrayRepo("content/netlogo", "NetLogo-JVM"),
+        libraryDependencies ++= Seq(
+          "org.nlogo" % "netlogo" % netLogoVersion.value intransitive,
+          "org.nlogo" % "netlogo" % netLogoVersion.value % "test" intransitive() classifier "tests"))
+    }
+  }
+
+  def directoryTarget(targetDirectory: File): Target =
+    new DirectoryTarget(targetDirectory)
+}

+ 20 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/.gitignore

@@ -0,0 +1,20 @@
+/*.jar
+/*.zip
+*.class
+*.log
+
+# sbt specific
+.cache
+.history
+.lib/
+dist/*
+target/
+lib_managed/
+src_managed/
+project/boot/
+project/plugins/project/
+project/.sbt*
+
+# Scala-IDE specific
+.scala_dependencies
+.worksheet

+ 22 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/build.sbt

@@ -0,0 +1,22 @@
+enablePlugins(org.nlogo.build.NetLogoExtension)
+
+scalaVersion := "2.11.7"
+
+scalaSource in Compile := { baseDirectory.value  / "src" }
+
+javaSource in Compile  := { baseDirectory.value / "src" }
+
+scalacOptions ++= Seq("-deprecation", "-unchecked", "-Xlint", "-Xfatal-warnings",
+                        "-encoding", "us-ascii")
+
+javacOptions ++= Seq("-g", "-deprecation", "-Xlint:all", "-encoding", "us-ascii")
+
+name := "Hello-Extension"
+
+netLogoVersion      := "6.0-M1"
+
+netLogoClassManager := "HelloScalaExtension"
+
+netLogoExtName      := "helloscala"
+
+netLogoZipSources   := false

+ 1 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/project/build.properties

@@ -0,0 +1 @@
+sbt.version=1.0.1

+ 7 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/project/plugins.sbt

@@ -0,0 +1,7 @@
+{
+  val pluginVersion = System.getProperty("plugin.version")
+  if(pluginVersion == null)
+    throw new RuntimeException("""|The system property 'plugin.version' is not defined.
+      |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
+    else addSbtPlugin("org.nlogo" % "netlogo-extension-plugin" % pluginVersion)
+}

+ 22 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/src/main/Hello.scala

@@ -0,0 +1,22 @@
+import org.nlogo.core.Syntax
+import org.nlogo.core.Syntax._
+import org.nlogo.api.{ Argument, Context, DefaultClassManager, ExtensionException, LogoException, PrimitiveManager, Reporter }
+import org.nlogo.api.ScalaConversions._
+
+class HelloScalaExtension extends DefaultClassManager {
+  def load(manager: PrimitiveManager) {
+    manager.addPrimitive("hello", new HelloString)
+  }
+}
+
+class HelloString extends Reporter {
+  override def getSyntax = reporterSyntax(right = List(StringType), ret = StringType)
+  def report(args: Array[Argument], context: Context): AnyRef = {
+    val name = try args(0).getString
+    catch {
+      case e: LogoException =>
+        throw new ExtensionException(e.getMessage)
+    }
+    "hello, " + name
+  }
+}

+ 4 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/basic/test

@@ -0,0 +1,4 @@
+> package
+$ exists helloscala.zip
+> clean
+$ absent helloscala.zip

+ 20 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/.gitignore

@@ -0,0 +1,20 @@
+/*.jar
+/*.zip
+*.class
+*.log
+
+# sbt specific
+.cache
+.history
+.lib/
+dist/*
+target/
+lib_managed/
+src_managed/
+project/boot/
+project/plugins/project/
+project/.sbt*
+
+# Scala-IDE specific
+.scala_dependencies
+.worksheet

+ 28 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/build.sbt

@@ -0,0 +1,28 @@
+import org.nlogo.build.NetLogoExtension
+
+enablePlugins(NetLogoExtension)
+
+scalaVersion := "2.11.7"
+
+scalaSource in Compile := { baseDirectory.value  / "src" }
+
+javaSource in Compile  := { baseDirectory.value / "src" }
+
+scalacOptions ++= Seq("-deprecation", "-unchecked", "-Xlint", "-Xfatal-warnings",
+                        "-encoding", "us-ascii")
+
+javacOptions ++= Seq("-g", "-deprecation", "-Xlint:all", "-encoding", "us-ascii")
+
+name := "Hello-Extension"
+
+libraryDependencies ++= Seq("commons-lang" % "commons-lang" % "2.6")
+
+netLogoVersion      := "6.0-M1"
+
+netLogoClassManager := "HelloScalaExtension"
+
+netLogoExtName      := "helloscala"
+
+netLogoZipSources   := false
+
+netLogoTarget       := NetLogoExtension.directoryTarget(baseDirectory.value)

+ 1 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/project/build.properties

@@ -0,0 +1 @@
+sbt.version=1.0.1

+ 7 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/project/plugins.sbt

@@ -0,0 +1,7 @@
+{
+  val pluginVersion = System.getProperty("plugin.version")
+  if(pluginVersion == null)
+    throw new RuntimeException("""|The system property 'plugin.version' is not defined.
+      |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
+    else addSbtPlugin("org.nlogo" % "netlogo-extension-plugin" % pluginVersion)
+}

+ 22 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/src/main/Hello.scala

@@ -0,0 +1,22 @@
+import org.nlogo.core.Syntax
+import org.nlogo.core.Syntax._
+import org.nlogo.api.{ Argument, Context, DefaultClassManager, ExtensionException, LogoException, PrimitiveManager, Reporter }
+import org.nlogo.api.ScalaConversions._
+
+class HelloScalaExtension extends DefaultClassManager {
+  def load(manager: PrimitiveManager) {
+    manager.addPrimitive("hello", new HelloString)
+  }
+}
+
+class HelloString extends Reporter {
+  override def getSyntax = reporterSyntax(right = List(StringType), ret = StringType)
+  def report(args: Array[Argument], context: Context): AnyRef = {
+    val name = try args(0).getString
+    catch {
+      case e: LogoException =>
+        throw new ExtensionException(e.getMessage)
+    }
+    "hello, " + name
+  }
+}

+ 8 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/bundled/test

@@ -0,0 +1,8 @@
+> package
+$ exists helloscala.jar
+$ exists commons-lang-2.6.jar
+$ exists .bundledFiles
+> clean
+$ absent helloscala.jar
+$ absent commons-lang-2.6.jar
+$ absent .bundledFiles

+ 11 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/build.sbt

@@ -0,0 +1,11 @@
+enablePlugins(org.nlogo.build.NetLogoExtension)
+
+scalaVersion        := "2.9.2"
+
+netLogoVersion      := "5.3.1"
+
+netLogoClassManager := "HelloScalaExtension"
+
+netLogoExtName      := "helloscala"
+
+netLogoZipSources   := false

+ 1 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/project/build.properties

@@ -0,0 +1 @@
+sbt.version=1.0.1

+ 7 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/project/plugins.sbt

@@ -0,0 +1,7 @@
+{
+  val pluginVersion = System.getProperty("plugin.version")
+  if(pluginVersion == null)
+    throw new RuntimeException("""|The system property 'plugin.version' is not defined.
+      |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
+    else addSbtPlugin("org.nlogo" % "netlogo-extension-plugin" % pluginVersion)
+}

+ 21 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/src/main/Hello.scala

@@ -0,0 +1,21 @@
+import org.nlogo.api._
+import org.nlogo.api.Syntax._
+import org.nlogo.api.ScalaConversions._
+
+class HelloScalaExtension extends DefaultClassManager {
+  def load(manager: PrimitiveManager) {
+    manager.addPrimitive("hello", new HelloString)
+  }
+}
+
+class HelloString extends DefaultReporter {
+  override def getSyntax = reporterSyntax(Array(StringType), StringType)
+  def report(args: Array[Argument], context: Context): AnyRef = {
+    val name = try args(0).getString
+    catch {
+      case e: LogoException =>
+        throw new ExtensionException(e.getMessage)
+    }
+    "hello, " + name
+  }
+}

+ 4 - 0
debugging_environment/NetLogo/NetLogo-Extension-Plugin/src/sbt-test/netlogo-extension-plugin/fivethreeone/test

@@ -0,0 +1,4 @@
+> package
+$ exists helloscala.zip
+> clean
+$ absent helloscala.zip

+ 1 - 0
debugging_environment/NetLogo/Reflection-Extension

@@ -0,0 +1 @@
+Subproject commit ae3936446fd0a7ceeac5526c520081698c9046e9

+ 0 - 0
debugging_environment/NetLogo/__init__.py


+ 117 - 0
debugging_environment/NetLogo/client.py

@@ -0,0 +1,117 @@
+print("SCCD NetLogo CLI interface")
+import sys
+import time
+from sccd.runtime.statecharts_core import Event
+
+
+def set_defaults(inp, defaultlist):
+    for i, v in enumerate(defaultlist):
+        if len(inp) == i + 1:
+            inp.append(v)
+
+def get_bool(val):
+    if val.lower() in ["true", "yes", "1"]:
+        return True
+    else:
+        return False
+
+def poll_port(port):
+    while 1:
+        try:
+            print(port.fetch(-1))
+        except:
+            pass
+
+def raw_inputter():
+    print("READY for input")
+    print("Type 'help' for information")
+    while 1:
+        inp = raw_input().split(" ")
+        action = inp[0]
+        if inp[0] == "god_event":
+            if len(inp) != 4:
+                print("God Events require 3 parameters!")
+                continue
+            params = [{"turtle": inp[1], "attribute": inp[2], "value": inp[3]}]
+        elif inp[0] in ["pause", "step", "continuous", "reset"]:
+            params = []
+        elif inp[0] == "realtime":
+            set_defaults(inp, [1.0])
+            params = [{"realtime_scale": float(inp[1])}]
+        elif inp[0] == "exit" or inp[0] == "quit":
+            break
+        elif inp[0] == "add_breakpoint":
+            if len(inp) < 5:
+                print("Breakpoint removal requires 2 parameters!")
+                continue
+            # Merge together the final part again
+            inp = [inp[0], inp[1], " ".join(inp[2:-2]).replace("\\n", "\n"), get_bool(inp[-2]), get_bool(inp[-1])]
+            print("Generated parameters: " + str(inp))
+            params = inp[1:]
+        elif inp[0] == "del_breakpoint":
+            if len(inp) < 2:
+                print("Breakpoint removal requires 1 parameter!")
+                continue
+            params = [inp[1]]
+        elif inp[0] == "enable_breakpoint":
+            action = "toggle_breakpoint"
+            params = [inp[1], True]
+        elif inp[0] == "disable_breakpoint":
+            action = "toggle_breakpoint"
+            params = [inp[1], False]
+        elif inp[0] == "help":
+            print("Supported operations:")
+            print("  continuous")
+            print("   --> Simulate continuously")
+            print("  step")
+            print("   --> Simulate a single step")
+            print("  god_event turtle_id attribute_name new_value")
+            print("   --> Modify the internal state of an arbitrary turtle")
+            print("       turtle_id should be a turtle id")
+            print("       attribute_name is the name of the attribute to alter")
+            print("       new_value is the value to assign")
+            print("       new_value can only be a string due to string-only input")
+            print("  add_breakpoint id function enabled disable_on_trigger")
+            print("   --> Add a breakpoint that will pause simulation when function returns True")
+            print("       the function should contain a definition of the 'breakpoint' function")
+            print("       and must take 3 parameters: time, model and transitioned")
+            print("       enabled indicates whether or not the breakpoint should be checked")
+            print("       disable_on_trigger determines if the breakpoint should auto-disable")
+            print("       after being triggered")
+            print("  del_breakpoint id")
+            print("   --> Remove a breakpoint")
+            print("  enable_breakpoint id")
+            print("   --> Enable the provided breakpoint")
+            print("  disable_breakpoint id")
+            print("   --> Disable the provided breakpoint")
+            print("  reset")
+            print("   --> Reset the simulation")
+            print("  exit")
+            print("   --> Stop the client")
+            print("  pause")
+            print("   --> Pause the simulation")
+            print("  quit")
+            print("   --> Stop the client")
+            continue
+        else:
+            print("Command not understood: " + str(inp))
+            continue
+        controller.addInput(Event(action, "request", params))
+
+import simulator
+controller = simulator.Controller("BouncingBalls.nlogo")
+reply_port = controller.addOutputListener('reply')
+try:
+    import threading
+
+    thrd_o = threading.Thread(target=poll_port,args=[reply_port])
+    thrd_o.daemon = True
+    thrd_o.start()
+    
+    thrd_i = threading.Thread(target=raw_inputter)
+    thrd_i.daemon = True
+    thrd_i.start()
+
+    controller.start()
+finally:
+    controller.stop()

BIN
debugging_environment/NetLogo/extensions/arduino/arduino.jar


BIN
debugging_environment/NetLogo/extensions/arduino/jssc-2.6.0.jar


BIN
debugging_environment/NetLogo/extensions/array/array.jar


BIN
debugging_environment/NetLogo/extensions/bitmap/bitmap.jar


BIN
debugging_environment/NetLogo/extensions/cf/cf.jar


BIN
debugging_environment/NetLogo/extensions/csv/commons-csv-1.0.jar


BIN
debugging_environment/NetLogo/extensions/csv/csv.jar


BIN
debugging_environment/NetLogo/extensions/gis/commons-codec-1.10.jar


BIN
debugging_environment/NetLogo/extensions/gis/commons-httpclient-3.1.jar


BIN
debugging_environment/NetLogo/extensions/gis/commons-logging-1.2.jar


BIN
debugging_environment/NetLogo/extensions/gis/gis.jar


BIN
debugging_environment/NetLogo/extensions/gis/jai_codec-1.1.3.jar


BIN
debugging_environment/NetLogo/extensions/gis/jai_core-1.1.3.jar


BIN
debugging_environment/NetLogo/extensions/gis/jts-1.13.jar


BIN
debugging_environment/NetLogo/extensions/gis/ngunits-1.0.0.jar


BIN
debugging_environment/NetLogo/extensions/gogo/gogo-daemon.jar


BIN
debugging_environment/NetLogo/extensions/gogo/gogo.jar


BIN
debugging_environment/NetLogo/extensions/gogo/hid4java.jar


BIN
debugging_environment/NetLogo/extensions/gogo/jna.jar


BIN
debugging_environment/NetLogo/extensions/ls/guava-18.0.jar


BIN
debugging_environment/NetLogo/extensions/ls/jsr305-3.0.0.jar


BIN
debugging_environment/NetLogo/extensions/ls/ls.jar


BIN
debugging_environment/NetLogo/extensions/ls/macro-compat_2.12-1.1.1.jar


BIN
debugging_environment/NetLogo/extensions/ls/parboiled_2.12-2.1.3.jar


BIN
debugging_environment/NetLogo/extensions/ls/shapeless_2.12-2.3.2.jar


BIN
debugging_environment/NetLogo/extensions/matrix/jama-1.0.3.jar


BIN
debugging_environment/NetLogo/extensions/matrix/matrix.jar


BIN
debugging_environment/NetLogo/extensions/nw/collections-generic-4.01.jar


BIN
debugging_environment/NetLogo/extensions/nw/colt-1.2.0.jar


BIN
debugging_environment/NetLogo/extensions/nw/concurrent-1.3.4.jar


BIN
debugging_environment/NetLogo/extensions/nw/gephi-toolkit-0.8.2.jar


BIN
debugging_environment/NetLogo/extensions/nw/jgrapht-0.8.3.jar


BIN
debugging_environment/NetLogo/extensions/nw/jung-algorithms-2.0.1.jar


BIN
debugging_environment/NetLogo/extensions/nw/jung-api-2.0.1.jar


BIN
debugging_environment/NetLogo/extensions/nw/jung-graph-impl-2.0.1.jar


BIN
debugging_environment/NetLogo/extensions/nw/jung-io-2.0.1.jar


BIN
debugging_environment/NetLogo/extensions/nw/nw.jar


BIN
debugging_environment/NetLogo/extensions/nw/stax-api-1.0.1.jar


BIN
debugging_environment/NetLogo/extensions/nw/wstx-asl-3.2.6.jar


BIN
debugging_environment/NetLogo/extensions/palette/palette.jar


BIN
debugging_environment/NetLogo/extensions/profiler/profiler.jar


+ 349 - 0
debugging_environment/NetLogo/extensions/r/GPL.txt

@@ -0,0 +1,349 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+Linking this library statically or dynamically with other modules is making a combined work based on this library.  
+Thus, the terms and conditions of the GNU General Public License cover the whole combination.
+
+As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, 
+regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, 
+provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. 
+An independent module is a module which is not derived from or based on this library. 
+If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. 
+If you do not wish to do so, delete this exception statement from your version.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.

BIN
debugging_environment/NetLogo/extensions/r/jna-4.2.2.jar


+ 581 - 0
debugging_environment/NetLogo/extensions/r/models/boxplot-example.nlogo

@@ -0,0 +1,581 @@
+;; Boxplot example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+
+extensions [r]
+
+to activate-JavaGD-plot-device
+  clear-all
+  r:setPlotDevice
+  reset-ticks
+  ; this model doesn't use ticks, but this disables the buttons until after
+  ; this procedure has been run
+end
+
+
+to test
+  ;a new empty local list
+  let mylist []
+
+  ; fill the list with 50 random values
+  repeat 50 [
+    set mylist fput random-normal 10 20 mylist
+  ]
+
+  ; show the list in the Command Center
+  print mylist
+
+  ; send the list into a new R dataframe (with one column named v1)
+  (r:putdataframe "df1" "v1" mylist)
+
+  ; create a boxplot of the dataframe.
+  ; since the dataframe has just one column, there is just one box.
+  r:eval "boxplot(df1)"
+
+end
+
+
+
+to test2
+  ;two new empty local lists
+  let mylist1 []
+  let mylist2 []
+
+  ; fill the list with 50 random values
+  repeat 50 [
+    set mylist1 fput random-normal 10 20 mylist1
+    set mylist2 fput random-normal 15 15 mylist2
+  ]
+
+  ; send the list into a new R dataframe (with one column named v1)
+  (r:putdataframe "df1" "v1" mylist1 "v2" mylist2)
+
+  ; create a boxplot of the dataframe.
+  ; since the dataframe has just one column, there is just one box.
+  r:eval "boxplot(df1)"
+
+end
+
+
+
+
+;; copied from the plot example...
+
+to dev-off
+  r:eval "dev.off()"
+end
+
+to r-idle ;; a "forever" method
+  r:eval "Sys.sleep(0.01)"
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+463
+10
+647
+195
+-1
+-1
+5.333333333333333
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+20
+181
+83
+214
+NIL
+test
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+0
+
+BUTTON
+18
+339
+91
+372
+NIL
+dev-off
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+0
+
+BUTTON
+20
+100
+83
+133
+NIL
+r-idle
+T
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+21
+55
+435
+102
+activate this button, if you want to have the R plot window active (this will create an empty loop for R, that it will stay active). If you want to save the boxplot in a file without seeing it in the R window, you don't need this button.
+11
+0.0
+1
+
+TEXTBOX
+21
+147
+442
+176
+this button will create a temp. list, send it to R and creates a boxplot (into the standard grafics output -> the R Plot Window).
+11
+0.0
+1
+
+TEXTBOX
+18
+309
+439
+336
+this button will close the graphics device (here: the plot window). But you can also just close the window.
+11
+0.0
+1
+
+TEXTBOX
+22
+228
+440
+261
+this button will create two temp. lists, put them both into one R data.frame and creates a boxplot over both columns.
+11
+0.0
+1
+
+BUTTON
+20
+262
+83
+295
+NIL
+test2
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+0
+
+BUTTON
+23
+14
+212
+47
+NIL
+activate-JavaGD-plot-device
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+sheep
+false
+0
+Rectangle -7500403 true true 151 225 180 285
+Rectangle -7500403 true true 47 225 75 285
+Rectangle -7500403 true true 15 75 210 225
+Circle -7500403 true true 135 75 150
+Circle -16777216 true false 165 76 116
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 530 - 0
debugging_environment/NetLogo/extensions/r/models/datafile-example.nlogo

@@ -0,0 +1,530 @@
+;; DataFile Example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+
+extensions [r]
+
+turtles-own [test]
+
+to create-and-write-data
+  clear-all
+
+  crt 30
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+
+  (r:putagentdf "ag" turtles "who" "xcor" "ycor")
+
+  let evalstring (word "write.table(ag ,file='" path "')")
+  r:eval evalstring
+end
+
+
+to load-and-show-data
+  clear-all
+
+  let evalstring (word "ag <- read.table(file='" path "')")
+  r:eval evalstring
+
+  let xc r:get "ag$xcor"
+  let yc  r:get "ag$ycor"
+
+  let xypos (map [ [?1 ?2] -> list ?1 ?2 ] xc yc)
+
+  foreach xypos
+  [ [?1] ->
+    crt 1
+    [
+      set xcor (item 0 ?1)
+      set ycor (item 1 ?1)
+    ]
+  ]
+end
+
+
+to write-data-with-vector-dataframe
+  clear-all
+
+  crt 30
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+    set test (list random 10 random 20 random 30)
+  ]
+
+  (r:putagentdf "ag" turtles "who" "xcor" "ycor" "test")
+
+  ; mark column test as class "AsIs"
+  r:eval "ag$test <- I(ag$test)"
+
+  let evalstring (word "write.table(ag ,file='" path "')")
+  r:eval evalstring
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+254
+10
+691
+448
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+8
+150
+223
+183
+NIL
+create-and-write-data
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+INPUTBOX
+5
+55
+221
+115
+path
+datafile.txt
+1
+0
+String
+
+BUTTON
+8
+192
+223
+225
+NIL
+load-and-show-data
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+9
+344
+228
+377
+NIL
+write-data-with-vector-dataframe
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+11
+252
+233
+333
+Note: The R-Extension allows you to create a data.frame with a vector in each row of a column. This is not common in data.frames. Therefore, you have to mark this column as class \"AsIs\" by using the I(x) function for this column if you want to use write.table.
+11
+0.0
+1
+
+BUTTON
+5
+14
+220
+47
+select path
+set path user-new-file
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+1
+@#$#@#$#@

+ 559 - 0
debugging_environment/NetLogo/extensions/r/models/diversity-example.nlogo

@@ -0,0 +1,559 @@
+;; Diversity example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+
+extensions [r]
+
+;; one patch equals a plot of 1 ha
+;; at each plot the number of trees will be counted
+;; trees are individuals/turtles
+
+breed [beeches beech]
+breed [birches birch]
+breed [hornbeams hornbeam]
+breed [oaks oak]
+breed [maples maple]
+breed [ashs ash]
+breed [poplars poplar]
+
+patches-own
+[
+  beechcount
+  birchcount
+  hornbeamcount
+  oakcount
+  maplecount
+  ashcount
+  poplarcount
+  speccount
+  shannon
+  simpson
+  pielou
+]
+
+
+to setup
+  clear-all
+
+  ;; reset the R-workspace
+  r:clear
+
+  ;; create the forest
+  set-default-shape turtles "tree"
+  create-beeches random 100
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+  create-birches random 100
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+  create-hornbeams random 100
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+  create-oaks random 100
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+  create-maples random 100
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+  create-ashs random 100
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+  create-poplars random 100
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+
+  let insp one-of patches with [count beeches-here > 0]
+  inspect insp
+end
+
+
+to calc-diversity
+  ;; calculate the number of individuals of each species for each patch
+  ask patches
+  [
+    set beechcount count beeches-here
+    set birchcount count birches-here
+    set hornbeamcount count hornbeams-here
+    set oakcount count oaks-here
+    set maplecount count maples-here
+    set ashcount count ashs-here
+    set poplarcount count poplars-here
+  ]
+
+  ;; assign a new data.frame with patch-variables (the patches will be asigned in lines from upper left to lower right)
+  (r:putagentdf "dfpatches" patches "pxcor" "pycor" "beechcount" "birchcount" "hornbeamcount" "oakcount" "maplecount" "ashcount" "poplarcount")
+
+  ;; create a data.frame without the coordinates
+  r:eval "df <- dfpatches[,3:7]"
+
+  ;; load R-library vegan (must be installed!)
+  r:eval "library(vegan)"
+
+  ;; calculate diversity
+  r:eval "spec <- specnumber(df)"
+  r:eval "shan <- diversity(df, 'shannon')"
+  ;; Pielou's evenness (J), if spec = 0, value of pielou will be NaN:
+  r:eval "pielou <- shan/log(spec)"
+  r:eval "simp <- diversity(df, 'simpson')"
+
+
+  ;; the following section is a little bit complicated
+  ;; it's done to save the calculated diversity values in the corresponding patch-variables
+  ;; to get just the diversity values as a list, call: print r:get "shan"
+
+
+  ;; create lists with the coordinates
+  let xlist r:get "dfpatches$pxcor"
+  let ylist r:get "dfpatches$pycor"
+  let xylist (map [ [?1 ?2] -> list ?1 ?2 ] xlist ylist)
+
+  ;; save the diversity value into the corresponding patch-variables
+  let counter 1
+  foreach xylist
+  [ [?1] ->
+    ask patch (item 0 ?1) (item 1 ?1)
+    [
+      set speccount (r:get (word "spec[" counter "]"))
+      set shannon (r:get (word "shan[" counter "]"))
+      set simpson (r:get (word "simp[" counter "]"))
+      set pielou (r:get (word "pielou[" counter "]"))
+    ]
+    set counter counter + 1
+  ]
+
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+371
+10
+709
+349
+-1
+-1
+30.0
+1
+10
+1
+1
+1
+0
+0
+0
+1
+0
+10
+0
+10
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+25
+60
+88
+93
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+102
+60
+206
+93
+NIL
+calc-diversity
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+26
+19
+360
+53
+R-Package \"vegan\" has to be installed
+17
+15.0
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 444 - 0
debugging_environment/NetLogo/extensions/r/models/example1.nlogo

@@ -0,0 +1,444 @@
+;; Example 1 of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+
+extensions [r]
+
+
+to test
+  clear-all
+
+  ;; get a value from r
+  print "r:eval..."
+  print "rnorm(10):"
+  print r:get "rnorm(10)"
+
+  print " "
+
+  ;; create a list in r from agentset
+  crt 10
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+
+  (r:putagent "agentlist" turtles "who" "xcor" "ycor")
+
+  print "r-class of agentlist: "
+  print r:get "class(agentlist)"
+
+  print " "
+
+  print "variable names of agentlist:"
+  print r:get "names(agentlist)"
+
+  print " "
+
+  print "agentlist$xcor: "
+  print r:get "agentlist$xcor"
+
+  print " "
+
+  print "agentlist$ycor: "
+  print r:get "agentlist$ycor"
+
+  print " "
+
+  print "correlation coefficient between xcor and ycor: "
+  print r:get "cor(agentlist$xcor, agentlist$ycor, method='spearman')"
+
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+205
+10
+642
+448
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+18
+21
+81
+54
+NIL
+test
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 675 - 0
debugging_environment/NetLogo/extensions/r/models/homerange-example.nlogo

@@ -0,0 +1,675 @@
+;; Homerange example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+extensions [r]
+
+breed [animals animal]
+breed [homeranges homerange]
+
+animals-own
+[ Name X Y ]
+
+homeranges-own
+[ Name ]
+
+to setup
+  clear-all
+  r:clear
+
+  ;; create three different animals (rabbit, cat, fox)
+  create-animals 3
+  [
+    if (who = 0)
+    [
+      set Name "rabbit"
+      set color 14
+    ]
+    if (who = 1)
+    [
+      set Name "cat"
+      set color 44
+    ]
+    if (who = 2)
+    [
+      set Name "fox"
+      set color 94
+    ]
+    set xcor random-pxcor
+    set ycor random-pycor
+    set X (list xcor)
+    set Y (list ycor)
+    pen-down
+  ]
+
+  go
+end
+
+to go
+  repeat 100
+  [
+    ;; move the animals randomly
+    ask animals
+    [
+      let nextpatch patch-at-heading-and-distance random 360 random 3
+      if (nextpatch != nobody)
+      [ move-to nextpatch ]
+      set X lput xcor X
+      set Y lput ycor Y
+    ]
+  ]
+end
+
+
+to calc-homerange
+  r:eval "library(adehabitat)"
+
+  ;; create an empty data.frame"
+  r:eval "turtles <- data.frame()"
+
+  ;; merge the Name, X- and Y-lists of all animals to one big data.frame
+  ask animals
+  [
+    (r:putdataframe "turtle" "X" X "Y" Y)
+    r:eval (word "turtle <- data.frame(turtle, Name = '" Name "')")
+    r:eval "turtles <- rbind(turtles, turtle)"
+  ]
+
+  ;; split the data.frame into coordinates and factor variable
+  r:eval "xy <- turtles[,c('X','Y')]"
+  r:eval "id <- turtles$Name"
+  ;; calculate homerange
+  r:eval "homerange <- mcp(xy, id)"
+
+
+  ifelse (plot-homerange)
+  [ plot-into-file ]
+  [
+    mark-homeranges
+    plot-area
+  ]
+end
+
+
+to plot-into-file
+  ;; plot the homerange polygons (into pdf-file)
+  r:eval (word "pdf('" homerange-plot ".pdf')" )
+  r:eval (word "plot(homerange, xlim=c(" min-pxcor "," max-pxcor "), ylim=c(" min-pycor "," max-pycor "))")
+  r:eval "dev.off()"
+
+  ;; plot the homerange area depending on the homerange level (into pdf-file)
+  r:eval (word "pdf('" homerange-level-plot ".pdf')" )
+  r:eval "mcp.area(xy, id, unout='m2')"
+  r:eval "dev.off()"
+
+end
+
+
+
+to mark-homeranges
+  clear-drawing
+
+  ask animals
+  [
+    pen-up
+    ;; get the points of the homerange polygon for the current animal
+    r:eval (word "temp <- subset(homerange, ID=='"Name"')")
+    let tempX r:get "temp$X"
+    let tempY r:get "temp$Y"
+    let tempXY (map [ [?1 ?2] -> list ?1 ?2 ] tempX tempY)
+
+    ;; create a turtle, which draws the homerange boundary
+    hatch-homeranges 1
+    [
+      hide-turtle
+      set Name [Name] of myself
+      set color [color] of myself
+    ]
+
+    ;; draw the homerange boundary
+    foreach tempXY
+    [ [?1] ->
+      ask homeranges with [Name = [Name] of myself]
+      [
+        move-to patch (item 0 ?1) (item 1 ?1)
+        pen-down
+      ]
+    ]
+
+    ;; connect the last point of the homerange with the first one, to close the polygon
+    ask homeranges with [Name = [Name] of myself]
+    [
+      let lastpoint first tempXY
+      move-to patch (item 0 lastpoint) (item 1 lastpoint)
+    ]
+  ]
+end
+
+
+to plot-area
+  clear-all-plots
+  let precstart 20
+  let precincre 5
+  ;; calculate the size of the homerange depending on homerange level
+  r:eval (word "area <- mcp.area(xy, id,  unout='m2', percent = seq(" precstart ",100, by = " precincre "), plotit=FALSE)")
+
+  ;; plot the homerange area of every animal, using temporary plot pen
+  ask animals
+  [
+    let arealist r:get (word "area$" Name)
+    set-current-plot "home range area"
+    create-temporary-plot-pen Name
+    set-plot-pen-color color
+    let prec precstart
+    foreach arealist
+    [ [?1] ->
+      plotxy prec ?1
+      set prec prec + precincre
+    ]
+  ]
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+346
+10
+859
+524
+-1
+-1
+5.0
+1
+10
+1
+1
+1
+0
+0
+0
+1
+0
+100
+0
+100
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+10
+68
+73
+101
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+9
+113
+128
+146
+NIL
+calc-homerange
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+10
+16
+339
+58
+R-packages \"adehabitat\" and \"gpclib\" have to be installed!
+17
+15.0
+1
+
+SWITCH
+5
+176
+148
+209
+plot-homerange
+plot-homerange
+1
+1
+-1000
+
+INPUTBOX
+5
+220
+200
+280
+homerange-plot
+homerange-plot-filename
+1
+0
+String
+
+INPUTBOX
+5
+290
+200
+350
+homerange-level-plot
+homerange-level-plot-filename
+1
+0
+String
+
+PLOT
+7
+359
+343
+545
+home range area
+home-range level
+home-range size (m2)
+0.0
+1.0
+0.0
+1.0
+true
+false
+"" ""
+PENS
+"default" 1.0 0 -16777216 true "" ""
+
+BUTTON
+210
+220
+340
+280
+Choose path...
+set homerange-plot user-new-file
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+210
+290
+340
+350
+Choose path...
+set homerange-level-plot user-new-file\n
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+1
+@#$#@#$#@

+ 456 - 0
debugging_environment/NetLogo/extensions/r/models/interactiveShell.nlogo

@@ -0,0 +1,456 @@
+;; InteractiveShell Example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+extensions [r]
+
+
+to setup
+  clear-all
+  r:clear
+
+  crt 10
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+
+  ; send turtle variables to R
+  (r:putagentdf "ag.df" turtles "who" "xcor" "ycor")
+end
+
+
+to open-interactiveShell
+  ; open interactiveShell
+  r:interactiveshell
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+354
+10
+618
+275
+-1
+-1
+7.76
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+7
+56
+86
+89
+NIL
+setup\n
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+8
+252
+156
+285
+NIL
+open-interactiveShell
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+9
+120
+354
+250
+Click the button and try the following commands in the interactiveShell:\n# show the content of global environment\nls()\n# show the content of the local NetLogo environment\nls(nl.env)\n# copy the local variable ag.df to global environment\nag.df.glob <- get(\"ag.df\",nl.env)\n# show structure of new variable\nstr(ag.df.glob)\n\n
+11
+0.0
+1
+
+TEXTBOX
+9
+296
+353
+328
+Note: If you wand to assign a variable into global environment you could use in NetLogo the \"<<-\" operator, like x <<- 10.2\n
+11
+0.0
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 717 - 0
debugging_environment/NetLogo/extensions/r/models/l-function.nlogo

@@ -0,0 +1,717 @@
+;; L function (with Monte-Carlo-Simulation) example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+extensions [r]
+
+
+to random_setup
+  clear-all
+  r:clear
+
+  random-seed randomseed
+
+  ;; load R package spatstat for spatial statistics
+  r:eval "library(spatstat)"
+
+  ;; create 80 turtles at random positions
+  crt 80
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+end
+
+
+to random_setup2
+  clear-all
+  r:clear
+
+  random-seed randomseed
+
+  ;; load R package spatstat for spatial statistics
+  r:eval "library(spatstat)"
+
+  ask n-of 400 patches
+  [
+    sprout random 3
+    [
+      right random 360
+      forward random 10
+    ]
+  ]
+end
+
+
+to cluster_setup
+  clear-all
+  r:clear
+
+  random-seed randomseed
+
+  ;; load R package spatstat for spatial statistics
+  r:eval "library(spatstat)"
+
+  ask n-of 10 patches
+  [
+    ask neighbors
+    [
+      sprout 3
+      [
+        right random 360
+        forward random 2
+      ]
+    ]
+  ]
+end
+
+
+to regular_setup
+  clear-all
+  r:clear
+
+  random-seed randomseed
+
+  ;; load R package spatstat for spatial statistics
+  r:eval "library(spatstat)"
+
+  ask patches with [pxcor mod 3 + pycor mod 2 = 0]
+  [
+      sprout 1
+  ]
+
+  ask n-of 30 turtles
+  [ die ]
+end
+
+
+
+to go_with_L-caluclation
+  ;; let the turtles walk around randomly
+  if (let-them-walk)
+  [
+    ask turtles
+    [
+      right random 360
+      forward random 10
+    ]
+  ]
+
+  ;; send agent variables into an R data-frame
+  (r:putagentdf "agentset" turtles "who" "xcor" "ycor")
+
+  ;; create point pattern with vectors of x- and y-coordinates of turtles and the dimension of the window/world
+  let revalstring (word "agppp <- ppp(agentset$xcor, agentset$ycor, c(" min-pxcor "," max-pxcor "), c(" min-pycor "," max-pycor ") )")
+  r:eval revalstring
+
+  ;; calculate L function
+  r:eval "L <- Lest(agppp)"
+
+  ;; get results from R
+  let ripl_l r:get "L$iso"
+  let r r:get "L$r"
+  let theo r:get "L$theo"
+
+  ;; combine results into a multidimensional list for plotting
+  let ripl (map [ [?1 ?2 ?3] -> (list ?1 ?2 ?3) ] r ripl_l theo)
+
+  ;; plot the results
+  set-current-plot "L function"
+  clear-plot
+  foreach ripl
+  [ [?1] ->
+    set-current-plot "L function"
+    set-current-plot-pen "obs"
+    plotxy (item 0 ?1) (item 1 ?1)
+    set-current-plot-pen "theo"
+    plotxy (item 0 ?1) (item 2 ?1)
+  ]
+end
+
+
+to go_with_L-confidencebands
+  ;; let the turtles walk around randomly
+  if (let-them-walk)
+  [
+    ask turtles
+    [
+      right random 360
+      forward random 10
+    ]
+  ]
+
+  ;; send agent variables into an R data-frame
+  (r:putagentdf "agentset" turtles "who" "xcor" "ycor")
+
+  ;; create point pattern with vectors of x- and y-coordinates of turtles and the dimension of the window/world
+  let revalstring (word "agppp <- ppp(agentset$xcor, agentset$ycor, c(" min-pxcor "," max-pxcor "), c(" min-pycor "," max-pycor ") )")
+  r:eval revalstring
+
+  ;; calculate L function with confidence bands from 99 simulations
+  r:eval "Lsim <- envelope(agppp, Lest)"
+
+  ;; get results from R
+  let r r:get "Lsim$r"
+  let obs r:get "Lsim$obs"
+  let theo r:get "Lsim$theo"
+  let hi r:get "Lsim$hi"
+  let lo r:get "Lsim$lo"
+
+  ;; combine results into a multidimensional list for plotting
+  let ripl (map [ [?1 ?2 ?3 ?4 ?5] -> (list ?1 ?2 ?3 ?4 ?5) ] r obs theo hi lo)
+
+  ;; plot the results
+  clear-plot
+  foreach ripl
+  [ [?1] ->
+    set-current-plot "L function"
+    set-current-plot-pen "obs"
+    plotxy (item 0 ?1) (item 1 ?1)
+    set-current-plot-pen "theo"
+    plotxy (item 0 ?1) (item 2 ?1)
+    set-current-plot-pen "high"
+    plotxy (item 0 ?1) (item 3 ?1)
+    set-current-plot-pen "low"
+    plotxy (item 0 ?1) (item 4 ?1)
+  ]
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+829
+10
+1318
+500
+-1
+-1
+14.6
+1
+10
+1
+1
+1
+0
+0
+0
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+5
+10
+116
+43
+NIL
+random_setup
+NIL
+1
+T
+OBSERVER
+NIL
+S
+NIL
+NIL
+1
+
+BUTTON
+7
+200
+193
+233
+NIL
+go_with_L-caluclation
+NIL
+1
+T
+OBSERVER
+NIL
+G
+NIL
+NIL
+1
+
+PLOT
+200
+10
+823
+523
+L function
+r
+L(r)
+0.0
+1.0
+0.0
+1.0
+true
+false
+"" ""
+PENS
+"obs" 1.0 0 -16777216 true "" ""
+"theo" 1.0 0 -2674135 true "" ""
+"high" 1.0 0 -10899396 true "" ""
+"low" 1.0 0 -13345367 true "" ""
+
+BUTTON
+6
+302
+192
+335
+NIL
+go_with_L-confidencebands
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+5
+82
+116
+115
+NIL
+cluster_setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+5
+118
+118
+151
+NIL
+regular_setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+INPUTBOX
+5
+339
+103
+399
+randomseed
+1234567.0
+1
+0
+Number
+
+BUTTON
+5
+46
+116
+79
+NIL
+random_setup2
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+SWITCH
+6
+157
+137
+190
+let-them-walk
+let-them-walk
+1
+1
+-1000
+
+TEXTBOX
+8
+259
+194
+303
+Warning: Calculation of confidence envelopes takes a long time (99 Monte-Carlo-Simulations)
+11
+0.0
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+sheep
+false
+0
+Rectangle -7500403 true true 151 225 180 285
+Rectangle -7500403 true true 47 225 75 285
+Rectangle -7500403 true true 15 75 210 225
+Circle -7500403 true true 135 75 150
+Circle -16777216 true false 165 76 116
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 514 - 0
debugging_environment/NetLogo/extensions/r/models/linear_regression-example.nlogo

@@ -0,0 +1,514 @@
+;; Linear Regression example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+
+extensions [r]
+
+patches-own
+[ food-items ]
+
+turtles-own
+[
+  memory ;; list of items-found of the last 20 days
+]
+
+to setup
+  clear-all
+  ;; create initial food sources on patches
+  create-food-sources
+  ;; create 10 turtles with random initial memory of collected food items
+  crt 10
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+    set heading random 360
+    set memory []
+    repeat 20
+    [
+      set memory lput random 5 memory
+    ]
+  ]
+
+  ;; setup an R vector for the x variable
+  r:eval "x <- seq(1,20)"
+
+end
+
+to go
+
+  ask turtles
+  [
+    ;; send the memory to R
+    r:put "y" memory
+    ;; fit a linear model
+    r:eval "fm <- lm(y ~ x)"
+    ;; get the results back from R
+    let b r:get "fm$coefficient[1]"
+    let x r:get "fm$coefficient[2]"
+    ;; make a forecast for the next day
+    let forecast b + x * 11
+    if forecast < 0
+    [ set forecast 0 ]
+    show forecast
+
+    let items-found 0
+    ; move steps, depending on forecast, i.e. motivation and nutritional condition
+    repeat (forecast)
+    [
+      move-to patch-at-heading-and-distance random 90 1
+      if ([food-items] of patch-here > 0)
+      [
+        ;; collect food items of patch
+        ask patch-here
+        [
+          set items-found items-found + food-items
+          set food-items 0
+        ]
+      ]
+    ]
+    ;; add the current value to the memory
+    set memory lput items-found memory
+    ;; delete the oldest memory value
+    set memory remove-item 0 memory
+    ;; if turtle is 20 days without food -> die!
+    if (sum memory <= 0)
+    [ die ]
+  ]
+
+  create-food-sources
+end
+
+to create-food-sources
+  ask n-of 30 patches
+  [
+    set food-items random 15
+  ]
+  ask patches
+  [
+    ifelse (food-items > 0)
+    [ set pcolor yellow ]
+    [ set pcolor black ]
+  ]
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+205
+10
+543
+349
+-1
+-1
+30.0
+1
+10
+1
+1
+1
+0
+1
+1
+1
+0
+10
+0
+10
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+10
+26
+73
+59
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+11
+67
+74
+100
+NIL
+go
+T
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+MONITOR
+15
+118
+98
+163
+NIL
+count turtles
+17
+1
+11
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 523 - 0
debugging_environment/NetLogo/extensions/r/models/package-example.nlogo

@@ -0,0 +1,523 @@
+;; Package Example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+extensions [r]
+
+to test-pcf1
+
+  ;; creates a plot of the pair correlation function (after Stoyan)
+  ;; for the example dataset "simdat"
+  r:eval "library(spatstat)"
+
+  r:eval "data(simdat)"
+  r:eval "p <- pcf(simdat)"
+  r:eval "K <- Kest(simdat)"
+  r:eval "p2 <- pcf(K)"
+  let pcf_r (r:get "p2$pcf")
+  let r (r:get "p2$r")
+
+  let pcf (map [ [?1 ?2] -> list ?1 ?2 ] r pcf_r)
+
+  clear-plot
+  foreach pcf
+  [ [?1] ->
+    set-current-plot "pair correlation function"
+    plotxy (item 0 ?1) (item 1 ?1)
+  ]
+
+end
+
+
+to test-pcf2
+  clear-all
+  ;; creates 50 turtles and distribute them over the world randomly.
+  ;; Assigns an R-point-pattern from the locations of the turtles and calculates the pair correlation function.
+  r:eval "library(spatstat)"
+
+  crt 50
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+
+  (r:putagentdf "agentset" turtles "who" "xcor" "ycor")
+
+  let owin-x (word "c(" min-pxcor "," max-pxcor ")")
+  let owin-y (word "c(" min-pycor "," max-pycor ")")
+
+  let revalstring (word "agppp <- ppp(agentset$xcor, agentset$ycor, " owin-x "," owin-y ")")
+
+  r:eval revalstring
+
+  r:eval "p <- pcf(agppp)"
+  r:eval "K <- Kest(agppp)"
+  r:eval "p2 <- pcf(K)"
+  let pcf_r (r:get "p2$pcf")
+  let r (r:get "p2$r")
+
+  let pcf (map [ [?1 ?2] -> list ?1 ?2 ] r pcf_r)
+
+  clear-plot
+  foreach pcf
+  [ [?1] ->
+    set-current-plot "pair correlation function"
+    plotxy (item 0 ?1) (item 1 ?1)
+  ]
+
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+400
+10
+837
+448
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+1
+1
+1
+0
+32
+0
+32
+0
+0
+1
+ticks
+30.0
+
+TEXTBOX
+7
+19
+344
+61
+R-Package \"spatstat\" has to be installed!
+17
+15.0
+1
+
+BUTTON
+8
+53
+90
+86
+NIL
+test-pcf1
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+PLOT
+9
+98
+392
+346
+pair correlation function
+r
+pcf(r)
+0.0
+1.0
+0.0
+1.0
+true
+false
+"" ""
+PENS
+"default" 1.0 0 -16777216 true "" ""
+
+BUTTON
+197
+55
+280
+88
+NIL
+clear-plot
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+99
+54
+184
+87
+NIL
+test-pcf2
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 468 - 0
debugging_environment/NetLogo/extensions/r/models/patchesToRMatrix.nlogo

@@ -0,0 +1,468 @@
+;; patches to RMatrix example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+extensions [r]
+
+to setup
+  ; create patches with random color
+  ask patches
+  [
+    set pcolor random 250
+  ]
+end
+
+to sendPatchesToR
+  ; send patches color to data.frame
+   (r:putagentdf "patches" patches "pxcor" "pycor" "pcolor")
+end
+
+to createMatrix
+  ; get worlds dimension and send it to R
+  r:put "xdim" world-width
+  ; create matrix from data.frame column pcolor
+  r:eval "m1 <- matrix(patches$pcolor, xdim)"
+  ; transpose matrix
+  r:eval "m1 <- t(m1)"
+
+  ; open interactive shell
+  r:interactiveShell
+  ; print the matrix into the interactive shell output window
+  r:eval "print(m1)"
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+210
+10
+372
+111
+-1
+-1
+30.8
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-2
+2
+0
+2
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+7
+21
+70
+54
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+7
+62
+131
+95
+NIL
+sendPatchesToR
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+8
+104
+170
+137
+create and show matrix
+createMatrix
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+sheep
+false
+0
+Rectangle -7500403 true true 151 225 180 285
+Rectangle -7500403 true true 47 225 75 285
+Rectangle -7500403 true true 15 75 210 225
+Circle -7500403 true true 135 75 150
+Circle -16777216 true false 165 76 116
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 497 - 0
debugging_environment/NetLogo/extensions/r/models/plot-example1.nlogo

@@ -0,0 +1,497 @@
+;; Plot2 Example of R-extension (using JavaGD device)
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+
+extensions [r]
+
+to setup
+  clear-all
+  r:clear
+
+  crt 10
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+
+  ; try to initialize the JavaGD plot device
+  r:setPlotDevice
+end
+
+
+to test-plot
+  if (count turtles = 0)
+  [stop]
+  (r:putagent "agentlist" turtles "who" "xcor" "ycor")
+  r:eval "plot(agentlist$xcor,agentlist$ycor)"
+end
+
+
+to test-plot2
+  r:eval "library(spatstat)"
+  r:eval "pp <- runifpoint(50)"
+  r:eval "K <- Kest(pp)"
+  r:eval "data(cells)"
+  r:eval "K <- Kest(cells, correction=\"isotropic\")"
+  r:eval "plot(K)"
+  r:eval "plot(K, main=\"K function for cells\")"
+  r:eval "plot(K, sqrt(./pi) ~ r, ylab=\"L(r)\", main=\"L function for cells\")"
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+204
+60
+641
+498
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+18
+184
+97
+217
+NIL
+test-plot
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+16
+10
+533
+61
+Package \"JavaGD\" must be installed.
+18
+14.0
+1
+
+BUTTON
+18
+75
+95
+108
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+21
+313
+107
+346
+NIL
+test-plot2
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+20
+255
+170
+303
+For \"test-plot2\" you must have package \"spatstat\" installed.
+13
+14.0
+1
+
+TEXTBOX
+18
+121
+168
+177
+Note: You can resize the plot window. If you save the plot, the size depends on the current window size.
+11
+0.0
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 469 - 0
debugging_environment/NetLogo/extensions/r/models/plot-example2.nlogo

@@ -0,0 +1,469 @@
+;; Plot Example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+;;
+;; modified by Thomas Petzoldt
+
+
+extensions [r]
+
+
+to test-plot
+  clear-all
+  crt 10
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+
+  (r:putagent "agentlist" turtles "who" "xcor" "ycor")
+  ;r:eval "Windows()" ;; opens graphics
+  r:eval "plot(agentlist$xcor,agentlist$ycor)"
+  r:eval "dat <- data.frame(xcor = agentlist$xcor, ycor = agentlist$ycor)"
+  r:eval "View(dat)"
+end
+
+to dev-off
+  r:eval "dev.off()"
+end
+
+to r-idle ;; a "forever" method
+  r:eval "Sys.sleep(0.01)"
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+205
+10
+642
+448
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+21
+46
+100
+79
+NIL
+test-plot
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+21
+93
+101
+126
+NIL
+dev-off
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+23
+143
+102
+176
+NIL
+r-idle
+T
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+13
+219
+192
+384
+The plot() and View() windows\nare unlocked and nonblocking \nif R gets some CPU time.\n\nTry with and without idle!\n\n\nSee plot-example2 for the new way of plotting with the r-Extension using the JavaGD package!
+12
+14.0
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 465 - 0
debugging_environment/NetLogo/extensions/r/models/plot-to-file-example.nlogo

@@ -0,0 +1,465 @@
+;; Plot Example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+
+extensions [r]
+
+
+to test-plot
+  clear-all
+  crt 10
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+
+  (r:putagent "agentlist" turtles "who" "xcor" "ycor")
+  print "create a plot into file..."
+
+  ;; create a pdf with the plot
+  let evalstring (word "pdf('" plotfile ".pdf')" )
+  show evalstring
+  r:eval evalstring
+  r:eval "plot(agentlist$xcor,agentlist$ycor)"
+  r:eval "dev.off()"
+
+  ;; create a jpeg with the plot
+  set evalstring (word "jpeg('" plotfile ".jpeg')" )
+  show evalstring
+  r:eval evalstring
+
+  r:eval "plot(agentlist$xcor,agentlist$ycor)"
+  r:eval "dev.off()"
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+230
+10
+667
+448
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+INPUTBOX
+8
+74
+198
+134
+plotfile
+plot-filename
+1
+0
+String
+
+BUTTON
+4
+163
+83
+196
+NIL
+test-plot
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+TEXTBOX
+7
+137
+222
+165
+If editing plotfile, don't use backslashes
+11
+0.0
+1
+
+BUTTON
+9
+30
+199
+63
+Choose file
+set plotfile user-new-file
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+1
+@#$#@#$#@

+ 6 - 0
debugging_environment/NetLogo/extensions/r/models/rfunction1.r

@@ -0,0 +1,6 @@
+x <- function(x)
+{
+  n<-length(x)
+  mittelwert<-prod(x)^(1/n)
+  return (mittelwert)
+}

+ 505 - 0
debugging_environment/NetLogo/extensions/r/models/ripleysK-example.nlogo

@@ -0,0 +1,505 @@
+;; Ripley's K example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+extensions [r]
+
+to setup
+  clear-all
+
+  ;; load R package spatstat for spatial statistics
+  r:eval "library(spatstat)"
+
+  ;; create 20 turtles at random positions
+  crt 20
+  [
+    set xcor random-xcor
+    set ycor random-ycor
+  ]
+end
+
+to go
+  ;; let the turtles walk around randomly
+  ask turtles
+  [
+    right random 360
+    forward random 10
+  ]
+
+  ;; send agent variables into an R data-frame
+  (r:putagentdf "agentset" turtles "who" "xcor" "ycor")
+
+  ;; create point pattern with vectors of x- and y-coordinates of turtles and the dimension of the window/world
+  let revalstring (word "agppp <- ppp(agentset$xcor, agentset$ycor, c(" min-pxcor "," max-pxcor "), c(" min-pycor "," max-pycor ") )")
+  r:eval revalstring
+
+  ;; calculate Ripley's K function
+  r:eval "K <- Kest(agppp)"
+
+  ;; get results from R
+  let ripl_k r:get "K$iso"
+  let r r:get "K$r"
+  let theo r:get "K$theo"
+
+  ;; combine results into a multidimensional list for plotting
+  let ripl (map [ [?1 ?2 ?3] -> (list ?1 ?2 ?3) ] r ripl_k theo)
+
+  ;; plot the results
+  clear-plot
+  foreach ripl
+  [ [?1] ->
+    set-current-plot "Ripley's K function"
+    set-current-plot-pen "K(r)"
+    plotxy (item 0 ?1) (item 1 ?1)
+    set-current-plot-pen "theo"
+    plotxy (item 0 ?1) (item 2 ?1)
+  ]
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+434
+55
+759
+381
+-1
+-1
+9.61
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+8
+56
+71
+89
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+7
+95
+70
+128
+NIL
+go
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+PLOT
+75
+55
+428
+403
+Ripley's K function
+r
+K(r)
+0.0
+1.0
+0.0
+1.0
+true
+false
+"" ""
+PENS
+"K(r)" 1.0 0 -16777216 true "" ""
+"theo" 1.0 0 -2674135 true "" ""
+
+TEXTBOX
+9
+13
+376
+45
+R-Package \"spatstat\" has to be installed!
+17
+15.0
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+sheep
+false
+0
+Rectangle -7500403 true true 151 225 180 285
+Rectangle -7500403 true true 47 225 75 285
+Rectangle -7500403 true true 15 75 210 225
+Circle -7500403 true true 135 75 150
+Circle -16777216 true false 165 76 116
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 438 - 0
debugging_environment/NetLogo/extensions/r/models/rscript-example.nlogo

@@ -0,0 +1,438 @@
+;; RScript Example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+
+extensions [r]
+
+
+to test
+  clear-all
+  ;; file contains a function with the name "x" which calculates the geometric mean of a vector
+  let evalstring (word "source('" path "')")
+  r:eval evalstring
+  ;; we can use the loaded function "x" now:
+  print "geometric mean of vecor 1,...,10 is:"
+  print r:get "x(seq(1:10))"
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+254
+10
+691
+448
+-1
+-1
+13.0
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+10
+170
+73
+203
+NIL
+test
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+INPUTBOX
+9
+104
+245
+164
+path
+extensions/r/examples/rfunction1.r
+1
+0
+String
+
+BUTTON
+10
+46
+246
+100
+choose path to rfunction1.r in R extension
+set path user-file
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 474 - 0
debugging_environment/NetLogo/extensions/r/models/spearman-example.nlogo

@@ -0,0 +1,474 @@
+;; Spearman's Rho example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+extensions [r]
+
+turtles-own [weight height]
+
+to setup
+  clear-all
+  ;; create turtles with weight and height randomly from weibull and beta distribution
+  crt 40
+  [
+    set weight r:get "rweibull(1,1)"
+    set height r:get "rbeta(1,1,1)"
+  ]
+  reset-ticks
+end
+
+to go
+  tick
+  ;; change weight and height of turtles randomly from weibull distribution
+  ask turtles
+  [
+    set weight weight + r:get "rweibull(1,1)"
+    set height height + r:get "rweibull(1,2)"
+  ]
+  ;; create R list from turtles
+  (r:putagent "turtles" turtles "weight" "height")
+  ;; calculate correlation between weight and height
+  r:eval "c <- cor.test(turtles$weight, turtles$height, method = 'spearm', alternative = 'g')"
+
+  let rho r:get "c$p.value"
+  let p r:get "c$estimate"
+
+  ;; plot spearman's rho and dot, if significant
+  set-current-plot "Spearman's rho"
+  set-current-plot-pen "rho"
+  plot rho
+  if (p < 0.05)
+  [
+    set-current-plot-pen "p"
+    plotxy (ticks - 1) (rho + 0.15)
+  ]
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+468
+10
+638
+181
+-1
+-1
+4.91
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+469
+208
+532
+241
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+536
+208
+599
+241
+NIL
+go
+T
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+PLOT
+5
+10
+463
+313
+Spearman's rho
+time
+rho
+0.0
+10.0
+-1.0
+1.0
+true
+false
+"" ""
+PENS
+"rho" 1.0 0 -16777216 true "" ""
+"p" 1.0 2 -2674135 true "" ""
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

+ 479 - 0
debugging_environment/NetLogo/extensions/r/models/wilcoxon-example.nlogo

@@ -0,0 +1,479 @@
+;; Wilcoxon Rank Sum Test example of R-extension
+;;
+;;
+;; by Jan C. Thiele
+;; University of Goettingen, Germany
+;; Department Ecoinformatics, Biometrics and Forest Growth
+;; Buesgenweg 4
+;; 37077 Goettingen
+;; Germany
+;;
+;; Contact: jthiele@gwdg.de
+;;
+;; Copyright: 2011, J.C. Thiele
+
+extensions [r]
+
+patches-own [elevation food]
+turtles-own [fitness change_rate]
+breed [lowland_bugs lowland_bug]
+breed [highland_bugs highland_bug]
+
+to setup
+  clear-all
+  ask patches
+  [
+    set elevation random 600
+    set food random 100
+    set pcolor elevation / 200
+  ]
+
+  create-lowland_bugs 50
+  [
+    move-to one-of patches with [elevation < 300]
+    set change_rate 0.1
+    set fitness r:get "rweibull(1,1)" * 0.8
+  ]
+
+  create-highland_bugs 50
+  [
+    move-to one-of patches with [elevation > 300]
+    set change_rate 0.15
+    set fitness r:get "rweibull(1,1)" * 0.2
+  ]
+end
+
+to go
+  ask turtles
+  [
+    set fitness random-float 2.0 *  [food] of patch-here * change_rate
+  ]
+
+  r:putagent "lowland" lowland_bugs "fitness"
+  r:putagent "highland" highland_bugs "fitness"
+
+  r:eval "w <- wilcox.test(lowland$fitness, highland$fitness, exact=FALSE)"
+  print r:get "w$p.value"
+
+  set-current-plot "Wilcoxon Rank Sum Test"
+  plot r:get "w$p.value"
+
+end
+@#$#@#$#@
+GRAPHICS-WINDOW
+403
+10
+704
+312
+-1
+-1
+8.9
+1
+10
+1
+1
+1
+0
+1
+1
+1
+-16
+16
+-16
+16
+0
+0
+1
+ticks
+30.0
+
+BUTTON
+8
+10
+71
+43
+NIL
+setup
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+BUTTON
+77
+11
+140
+44
+NIL
+go
+NIL
+1
+T
+OBSERVER
+NIL
+NIL
+NIL
+NIL
+1
+
+PLOT
+7
+48
+395
+334
+Wilcoxon Rank Sum Test
+time
+p-value
+0.0
+1.0
+0.0
+1.0
+true
+false
+"" ""
+PENS
+"default" 1.0 0 -16777216 true "" ""
+
+@#$#@#$#@
+## WHAT IS IT?
+
+This section could give a general understanding of what the model is trying to show or explain.
+
+## HOW IT WORKS
+
+This section could explain what rules the agents use to create the overall behavior of the model.
+
+## HOW TO USE IT
+
+This section could explain how to use the model, including a description of each of the items in the interface tab.
+
+## THINGS TO NOTICE
+
+This section could give some ideas of things for the user to notice while running the model.
+
+## THINGS TO TRY
+
+This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
+
+## EXTENDING THE MODEL
+
+This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
+
+## NETLOGO FEATURES
+
+This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab.  It might also point out places where workarounds were needed because of missing features.
+
+## RELATED MODELS
+
+This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
+
+## CREDITS AND REFERENCES
+
+This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
+@#$#@#$#@
+default
+true
+0
+Polygon -7500403 true true 150 5 40 250 150 205 260 250
+
+airplane
+true
+0
+Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
+
+arrow
+true
+0
+Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
+
+box
+false
+0
+Polygon -7500403 true true 150 285 285 225 285 75 150 135
+Polygon -7500403 true true 150 135 15 75 150 15 285 75
+Polygon -7500403 true true 15 75 15 225 150 285 150 135
+Line -16777216 false 150 285 150 135
+Line -16777216 false 150 135 15 75
+Line -16777216 false 150 135 285 75
+
+bug
+true
+0
+Circle -7500403 true true 96 182 108
+Circle -7500403 true true 110 127 80
+Circle -7500403 true true 110 75 80
+Line -7500403 true 150 100 80 30
+Line -7500403 true 150 100 220 30
+
+butterfly
+true
+0
+Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
+Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
+Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
+Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
+Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
+Circle -16777216 true false 135 90 30
+Line -16777216 false 150 105 195 60
+Line -16777216 false 150 105 105 60
+
+car
+false
+0
+Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
+Circle -16777216 true false 180 180 90
+Circle -16777216 true false 30 180 90
+Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
+Circle -7500403 true true 47 195 58
+Circle -7500403 true true 195 195 58
+
+circle
+false
+0
+Circle -7500403 true true 0 0 300
+
+circle 2
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+
+cow
+false
+0
+Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
+Polygon -7500403 true true 73 210 86 251 62 249 48 208
+Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
+
+cylinder
+false
+0
+Circle -7500403 true true 0 0 300
+
+dot
+false
+0
+Circle -7500403 true true 90 90 120
+
+face happy
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
+
+face neutral
+false
+0
+Circle -7500403 true true 8 7 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Rectangle -16777216 true false 60 195 240 225
+
+face sad
+false
+0
+Circle -7500403 true true 8 8 285
+Circle -16777216 true false 60 75 60
+Circle -16777216 true false 180 75 60
+Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
+
+fish
+false
+0
+Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
+Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
+Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
+Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
+Circle -16777216 true false 215 106 30
+
+flag
+false
+0
+Rectangle -7500403 true true 60 15 75 300
+Polygon -7500403 true true 90 150 270 90 90 30
+Line -7500403 true 75 135 90 135
+Line -7500403 true 75 45 90 45
+
+flower
+false
+0
+Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
+Circle -7500403 true true 85 132 38
+Circle -7500403 true true 130 147 38
+Circle -7500403 true true 192 85 38
+Circle -7500403 true true 85 40 38
+Circle -7500403 true true 177 40 38
+Circle -7500403 true true 177 132 38
+Circle -7500403 true true 70 85 38
+Circle -7500403 true true 130 25 38
+Circle -7500403 true true 96 51 108
+Circle -16777216 true false 113 68 74
+Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
+Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
+
+house
+false
+0
+Rectangle -7500403 true true 45 120 255 285
+Rectangle -16777216 true false 120 210 180 285
+Polygon -7500403 true true 15 120 150 15 285 120
+Line -16777216 false 30 120 270 120
+
+leaf
+false
+0
+Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
+Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
+
+line
+true
+0
+Line -7500403 true 150 0 150 300
+
+line half
+true
+0
+Line -7500403 true 150 0 150 150
+
+pentagon
+false
+0
+Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
+
+person
+false
+0
+Circle -7500403 true true 110 5 80
+Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
+Rectangle -7500403 true true 127 79 172 94
+Polygon -7500403 true true 195 90 240 150 225 180 165 105
+Polygon -7500403 true true 105 90 60 150 75 180 135 105
+
+plant
+false
+0
+Rectangle -7500403 true true 135 90 165 300
+Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
+Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
+Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
+Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
+Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
+Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
+Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
+
+square
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+
+square 2
+false
+0
+Rectangle -7500403 true true 30 30 270 270
+Rectangle -16777216 true false 60 60 240 240
+
+star
+false
+0
+Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
+
+target
+false
+0
+Circle -7500403 true true 0 0 300
+Circle -16777216 true false 30 30 240
+Circle -7500403 true true 60 60 180
+Circle -16777216 true false 90 90 120
+Circle -7500403 true true 120 120 60
+
+tree
+false
+0
+Circle -7500403 true true 118 3 94
+Rectangle -6459832 true false 120 195 180 300
+Circle -7500403 true true 65 21 108
+Circle -7500403 true true 116 41 127
+Circle -7500403 true true 45 90 120
+Circle -7500403 true true 104 74 152
+
+triangle
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+
+triangle 2
+false
+0
+Polygon -7500403 true true 150 30 15 255 285 255
+Polygon -16777216 true false 151 99 225 223 75 224
+
+truck
+false
+0
+Rectangle -7500403 true true 4 45 195 187
+Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
+Rectangle -1 true false 195 60 195 105
+Polygon -16777216 true false 238 112 252 141 219 141 218 112
+Circle -16777216 true false 234 174 42
+Rectangle -7500403 true true 181 185 214 194
+Circle -16777216 true false 144 174 42
+Circle -16777216 true false 24 174 42
+Circle -7500403 false true 24 174 42
+Circle -7500403 false true 144 174 42
+Circle -7500403 false true 234 174 42
+
+turtle
+true
+0
+Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
+Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
+Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
+Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
+Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
+Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
+
+wheel
+false
+0
+Circle -7500403 true true 3 3 294
+Circle -16777216 true false 30 30 240
+Line -7500403 true 150 285 150 15
+Line -7500403 true 15 150 285 150
+Circle -7500403 true true 120 120 60
+Line -7500403 true 216 40 79 269
+Line -7500403 true 40 84 269 221
+Line -7500403 true 40 216 269 79
+Line -7500403 true 84 40 221 269
+
+x
+false
+0
+Polygon -7500403 true true 270 75 225 30 30 225 75 270
+Polygon -7500403 true true 30 75 75 30 270 225 225 270
+@#$#@#$#@
+NetLogo 6.0-BETA2
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+@#$#@#$#@
+default
+0.0
+-0.2 0 0.0 1.0
+0.0 1 1.0 0.0
+0.2 0 0.0 1.0
+link direction
+true
+0
+Line -7500403 true 150 150 90 180
+Line -7500403 true 150 150 210 180
+@#$#@#$#@
+0
+@#$#@#$#@

BIN
debugging_environment/NetLogo/extensions/r/r.jar


+ 19 - 0
debugging_environment/NetLogo/extensions/r/user.properties

@@ -0,0 +1,19 @@
+# Use this properties file to ensure the NetLogo R extension can find your R installation
+# There are default platform configuration files, but this one can override their values
+
+# The r.home property is the absolute path to the R installation directory containing
+# the `bin` folder (not the `bin` folder itself).
+
+# jri.home.paths is a list of paths separated by ':' on mac/linux and ';' on Windows
+# If the ~ appears in a path, it will be interpreted as "user.home"
+
+# For Mac/Linux customization, uncomment and edit the following lines:
+# r.home=/Path/to/R/Installation
+# jri.home.paths=/Path/to/R-Installation/library/rJava/jri/:~/Path/to/User-R-Library/3.3/rJava/jri/
+# r.lib.paths=~/Library/R/3.3/Library:/Other/R/Library/Path
+
+# For Windows, either use '\\' or '/' between directory names.
+# Uncomment and edit these to change Windows configuration
+# r.home=C:/Path/to/R/Installation
+# jri.home.paths=Z:/Path/to/R-Installation/library/rJava/jri/;~\\Path\\to\\User-R-Library\\3.3\\rJava\\jri\\
+# r.lib.paths=~/Documents/R/win-library/3.3;\\Other\\R\\Library\\Path

BIN
debugging_environment/NetLogo/extensions/reflection/reflection.jar


BIN
debugging_environment/NetLogo/extensions/rnd/rnd.jar


BIN
debugging_environment/NetLogo/extensions/sample-scala/sample-scala.jar


BIN
debugging_environment/NetLogo/extensions/sample/sample.jar


BIN
debugging_environment/NetLogo/extensions/sound/sound.jar


BIN
debugging_environment/NetLogo/extensions/table/table.jar


+ 0 - 0
debugging_environment/NetLogo/extensions/vid/bridj-0.7.0.jar


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.