Java StarLogo
2.0
english
`turtle`
turtles-own [next-turtle
             prev-turtle
             heading-1 
             dist-1
             heading-2 
             dist-2 
             repel-turtle]

to setup
setc red
settotal-turtles num
seth random 360 fd random 25
setnext-turtle who + 1
if next-turtle >= total-turtles [setnext-turtle 0]
setprev-turtle who - 1
if prev-turtle < 0 [setprev-turtle total-turtles - 1]
end

to adjust
setheading-1 towards xcor-of next-turtle ycor-of next-turtle
setdist-1  
  (convergence / 100) * 
     ((distance xcor-of next-turtle ycor-of next-turtle)
           - desired-distance)

setheading-2 towards xcor-of prev-turtle ycor-of prev-turtle
setdist-2  
  (convergence / 100) * 
     ((distance xcor-of prev-turtle ycor-of prev-turtle) 
           - desired-distance)

seth heading-1
fd dist-1
seth heading-2
fd dist-2
end

to repel
setrepel-turtle random total-turtles
seth towards xcor-of repel-turtle ycor-of repel-turtle
bk repel-strength / 100
end


`observer`
globals [total-turtles]

to setup
ca
crt num
ask-turtles [setup]
end


`information`
Gor more information on this project, see:
http://education.mit.edu/starlogo/projects/circle.html


`interface`
SLCanvas
top-left 6 245

SLButton
turtle-or-observer? turtle
top-left 67 139
width-height 89 30
name "button3"
line-to-run "repel"
forever? true
button-number 4
show-name? false
whichip 4

SLButton
turtle-or-observer? turtle
top-left 65 20
width-height 88 30
name "button2"
line-to-run "adjust"
forever? true
button-number 3
show-name? false
whichip 5

SLButton
turtle-or-observer? observer
top-left 19 21
width-height 86 30
name "button1"
line-to-run "setup"
forever? false
button-number 2
show-name? false
whichip 6

SLSlider
top-left 109 11
width-height 105 25
name "slider3"
variable "desired-distance"
min-value 1
max-value 5
current-value 2
slider-number 3
show-name? false

SLSlider
top-left 154 74
width-height 90 25
name "slider2"
variable "convergence"
min-value 1
max-value 40
current-value 20
slider-number 2
show-name? false

SLSlider
top-left 24 139
width-height 90 25
name "slider0"
variable "num"
min-value 1
max-value 40
current-value 25
slider-number 0
show-name? false

SLSlider
top-left 109 129
width-height 107 25
name "slider1"
variable "repel-strength"
min-value 0
max-value 50
current-value 26
slider-number 1
show-name? false


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

`template`
null

`settings`
patch-size 4
num-shapes 256
screen-half-width 53
screen-half-height 49
interface-window-xcor 122
interface-window-ycor 90
interface-window-size 682 411
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 12
control-center-ycor 95
control-center-width 320
control-center-height 488
turtle-command-center-height 140
observer-command-center-height 142

`string table`
H4sIAAAAAAAAAGNgYGAAABzfRCEEAAAAAAAABA==

`symbol table`
H4sIAAAAAAAAAGNgYGAAABzfRCEEAAAAAAAABA==

`double table`
H4sIAAAAAAAAAFXLfVALcBzH8XksR4TkoVDEViNTEV35fs/0tDyVRSOLbc0sPdiD
ilCpuJBcrsJVnqWrHOoaV8lO2XWX8zDlaW3LNqt56Bqukrjj1x8+/3z/eL++FApF
Dr2Uv8NV5MaWJDlab1wCzSYTdUIMA+W3ByoLByvh/SHrvqm3GUj5fyhst7v1uO8H
WIyNySENb/HAZMXE1Jeb0Zb0PbHNxwMHZoPh2/nhQ/4qpOg59XUFajC235fV+WSi
PXEijtLPXXsQNOzzrAkOVHQ6e/jq1gQ6mING+RSrAtGBuPhpQ5rwBhHosvfYeKsj
kMZ9WDY9sx90QlvXH8MncBZxSeNmzcmzVsGri/liOrxGVphVHvS9FJ1Jl5hVD+5m
iEGtuDkzPD0XIy46Z94z0uFFo+8Rp8hydCFO2lwR15WhB+3P8uwdi1nIjQi9Fl5K
h+erjYYSTyouIE4W6+8d7dYLhpO7u+OCR+PuieyO5jFK0L+TUnJKg9FtxJmYp555
8EFv8eRIi6cjj5UiVIRq4UNOV2313FZcPOI0orgEfyZ8HdY6n86RIL++iRM5igqG
F738iNIapI04faHeQeUIBl7iUCJXh7x+ZqLkiwI9SJeHNF7y3NoE723fHd1F+4V8
5lKle/4SXDLS+8cfbHE9Dabnd0zRV2OQX3l57wlqB3r+69BWtPC725b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