ball bouncing

No preview image

1 collaborator

Corey Corey Brady (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0RC10 • Viewed 251 times • Downloaded 11 times • Run 0 times
Download the 'ball bouncing' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

to setup
  
  ca
  ask patches with [ abs pxcor = max-pxcor  or abs pycor = max-pycor ] [ set pcolor yellow ]
  create-turtles 1
  [
   set shape "circle"
   set size 2
   set color lime 
  ]
end 

to go
  every .01
  [
  ask turtles 
  [
   fd speed
   if [pcolor] of patch-ahead speed = yellow
   [
    bounce 
   ]
  ]
  ]
end 

to bounce
  
  ifelse abs ( [pxcor] of patch-ahead speed) = max-pxcor 
  [
   set heading (- heading)
  ]
  [
    set heading 180 - heading 
  ]
end 

There is only one version of this model, created over 6 years ago by Corey Brady.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.