Java StarLogo
2.0
english
`turtle`
turtles-own [inside?]

to go
  check-patches
  fd 1
  ifelse (pc = 15) or (pc = 115)
     [setinside? true]
     [setinside? false]
end

to check-patches
  if pc-ahead = lime [
      ifelse (random 2) = 0
         [rt 90 check-patches]
         [lt 90 check-patches]
  ]
end


`observer`
to startup
  plotid 4
end

to init
  clearplot
  ask-turtles [die]
  crt number
  ask-turtles 
   [sety -8
    setc  117
    seth random 360
    setinside? true]
  setup-graph
end

to init2 
 ;in addition to turtles created based on the number slider
 ;each patch in the bottom of the bottle hatches a turtle
  ask-patches [if pc = 115 [sprout [setc 117 setinside? true]]]
  ask-turtles [seth random 360]
  setup-graph
end

to setup-graph
pp1 ppreset setppc purple  ppd ;number inside the bottle
pp2 ppreset setppc black ppd ;number outside the bottle
setplot-xrange 0 100
setplot-yrange 0 200 
setplot-title "Diffused Turtles"
end

to graph
pp1 plot (count-turtles-with [inside? = true]) 
pp2 plot (count-turtles-with [inside? = false]) 
end


`information`
WHAT IS IT? ------------ 
This project models the diffusion of perfume out of a bottle. Each turtle acts as a molecule of perfume. 

HOW TO USE IT? --------------- 
Click the SETUP button to create a turtle molecule on every patch  in the lower half of the bottle, plus the number indicated by the NUMBER slider. Click the START button to watch the turtle molecules diffuse.  Both the amount of turtles inside the bottle and the amount of  turtles outside the bottle are graphed in the plot window. THINGS TO NOTICE -----------------  

EXPLORATIONS ------------- 
Currently the number of turtles inside and outside the bottle stablizes fairly quickly. Can you change this by altering the number of turtles created? By changing the shape of the bottle using the paint tools?


`interface`
SLCanvas
top-left 16 250

SLButton
turtle-or-observer? observer
top-left 74 177
width-height 55 30
name "graphbutton"
line-to-run "graph"
forever? true
button-number 8
show-name? false
whichip 7

SLButton
turtle-or-observer? turtle
top-left 74 132
width-height 40 30
name "gobutton"
line-to-run "go"
forever? true
button-number 3
show-name? false
whichip 8

SLButton
turtle-or-observer? observer
top-left 24 83
width-height 40 30
name "start"
line-to-run "startgobutton startgraphbutton"
forever? false
button-number 9
show-name? true
whichip 9

SLSlider
top-left 80 25
width-height 87 25
name "slider1"
variable "number"
min-value 0
max-value 200
current-value 75
slider-number 0
show-name? false

SLButton
turtle-or-observer? observer
top-left 24 26
width-height 40 30
name "setup"
line-to-run "init init2"
forever? false
button-number 2
show-name? true
whichip 10

SLLineWidget
top-left 147 51
width-height 103 72
id 4
order 4
type 1
title "Diffused Turtles"
delay-string "1.0"
xlabel ""
ylabel ""
grid false
connected true
autoscaletrue
location 0 0
wizard-on false


`turtle shapes`
[encoded data, 5200 characters]
DhUAABUO2Q==

`template`
null

`settings`
patch-size 7
num-shapes 256
screen-half-width 25
screen-half-height 25
interface-window-xcor 211
interface-window-ycor 87
interface-window-size 624 418
output-window-xcor 0
output-window-ycor 0
output-window-width 300
output-window-height 219
info-window-xcor 0
info-window-ycor 0
info-window-width 500
info-window-height 419
control-center-xcor 19
control-center-ycor 103
control-center-width 366
control-center-height 462
turtle-command-center-height 135
observer-command-center-height 133

`string table`
H4sIAAAAAAAAAGNgYGBkEHDJTEsrLU5NUQgpLSrJSS0GAGZm/xMWAAAAAAAAFg==

`symbol table`
H4sIAAAAAAAAAGNgYGBiYCkpKk1lYE1LzClOBQBgXN0IEQAAAAAAABE=

`double table`
H4sIAAAAAAAAAGNgYGA+oMAABg4xByB0gAOYBgD0QNX+HAAAAAAAABw=

`list table`
H4sIAAAAAAAAAE2NOw6AMAxDX9Ly6cT9mBnYEXfkWMQ0ICJFtuzEBhpgBjVwDMQl
wGnYXjrXDIGH9FeTH9CCm/cMt89jS7xq/1e2bsh/Ty6Y0lvU8eaXvE+f7PFfz6rt
J49WYucbORZeu9QAAAAAAADU

`bytecodes`
H4sIAAAAAAAAAH2UUU/CMBDHr9u6gRM2kcH0BRJcfOLFR5+MnwTEBYgJIzAe/I76
nbyWa6+baJPtrr1e77f/NYN48fZZl6vqvTwuXuBLjW8AiCE61stDfdrjJAQ7BNli
BpCAVG6w3W1rtA+8qwgAPOXgK0fj4zMLbbZQW3OzJ6V1fGWSfAxkZt0HkWJultM8
IIt7B4LPjoAK0dB0AqSie8L5I4d02QzEUDBSOqb1Htmug5UyFiHZ0rl/tolHKOaz
pMW1+P+iehAfS9R7vj4s9xtcnV5Q/QYfR68CDymGDNeI+624o1sxIN/0BImKW/I7
6I8IygdpcCaXcTxKJyQxuLI4WlMlxwy1LMDBaucFTp78nadRAvDWFTSuWUSf0ObK
rrG3wEx4Hs/PXCKdEEPIXEYm09tGXLJkJp74xCaht9qUq4/5flmjc2xiCtcizrDf
lEiXGTVvu70649Z1Qpvd6SYxooOW3XMsca6mxgyh/3qq62r3PJ2atnb5jIg+3wyd
G9pgzLnVhUT5ZyIX1b8Up+9Kp8AKo32d03FzyvNPqEt1BNeJwChghqr3A/Ea//bT
BAAAAAAE0w==

`observer world`
H4sIAAAAAAAAAGMQSMhPKk4tKkstUiguSSxJTXBggAMrBq6CnPyS8syU9NQSIJ+F
gS0nNS+9JAPI5mBgB8kVpOaBlXKDNSPJQgAjCAMA+OWZc2QAAAAAAABk

`patch world`
[encoded data, 7735 characters]
ZftJkZ1FAQAAAUWd

`turtle world`
H4sIAAAAAAAAAKXa+XcTVRQH8Fe7CohVq6IWHbEiVq1YFlGLHcEqLlig0JZi6bTJ
ZGtI0mTSguu474r7LnFX3HDfzXX/1T8hfwJ/gs923i2+e45+PZZzycyc+fS+zrs3
syRqsReUi0HWd0rBeOB7ruKfA6op6+eSQUov96jGiaLvx/Vih1pQyOaDmXQ86Qd6
fbVq/mu94Of0SpdqjOWz+aJebFcN+2KzS4vUwtlfzr9tnWrRu8fzM7mCXutWjaXU
eMHXi52qYe+caVD1M6n87DiaSqloz1WqOeWPx9O5pF5p01GnmtO5Ujru984PWy3V
8YsO0lHV8YOO73R8q+MbHV/r+ErHFzo+1/GZjk90HNLxkY4PdLyt4w0dr+h4Ucfz
Oh7XsV/HYzoe1fGIjod1PKTjQR336zio4z4zEHLmXt326HX0iKNrfur0P/1//dza
PcKmXdTeLWzpD9TeKWwCHvMdwuY91N4m7JCL2lu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