Java StarLogo
2.0
english
`turtle`
turtles-own [yvel ypos k time]

to setup
setc red
setx who - 1 - screen-half-width
setyvel 0
setypos 0
setk 1
settime 0
if xcor = screen-half-width [setc blue]
if xcor = (-1 * screen-half-width) [setc green]
end

to go
drive-force
if color = red
  [setyvel
     yvel
     + (k * (((ypos-of (who - 1)) - ypos)
             + ((ypos-of (who + 1)) - ypos)))
   setyvel ((1000 - friction) / 1000) * yvel
   setypos ypos + yvel
   sety ypos
   ifelse (abs ypos) <= screen-half-height
      [st]
      [ht]]
end

to drive-force
if color = green
  [settime time + 1
   setypos amplitude * (sin freq * time)
   sety ypos]
end


`observer`
to setup
ca 
crt screen-width
ask-turtles [setup]
end


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


`interface`
SLCanvas
top-left 6 205

SLSlider
top-left 29 103
width-height 90 25
name "slider0"
variable "friction"
min-value 0
max-value 100
current-value 45
slider-number 0
show-name? false

SLSlider
top-left 113 104
width-height 90 25
name "slider2"
variable "amplitude"
min-value 0
max-value 50
current-value 40
slider-number 2
show-name? false

SLSlider
top-left 72 104
width-height 90 25
name "slider1"
variable "freq"
min-value 1
max-value 10
current-value 4
slider-number 1
show-name? false

SLButton
turtle-or-observer? observer
top-left 25 14
width-height 72 31
name "button1"
line-to-run "setup"
forever? false
button-number 2
show-name? false
whichip 4

SLButton
turtle-or-observer? turtle
top-left 67 16
width-height 69 30
name "button2"
line-to-run "go"
forever? true
button-number 3
show-name? false
whichip 5


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

`template`
null

`settings`
patch-size 4
num-shapes 256
screen-half-width 50
screen-half-height 50
interface-window-xcor 209
interface-window-ycor 78
interface-window-size 636 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 16
control-center-ycor 97
control-center-width 336
control-center-height 490
turtle-command-center-height 158
observer-command-center-height 157

`string table`
H4sIAAAAAAAAAG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