Random Walk Periodic Boundary Condition
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
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)
Comments and Questions
;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; variable declarations ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; globals [ sum-distance root-mean-square ] ;;;;;;;;;;;;;;;;;;;;;; ;; setup procedures ;; ;;;;;;;;;;;;;;;;;;;;;; ;; set up the patches and creates turtles to setup clear-all set-patch-size (200 / boundary) resize-world (- boundary) boundary 0 (boundary * 2) ask patches [ set pcolor gray + 3 ] setup-turtles reset-ticks end ;; determines the number of turtles and their color to setup-turtles ;; the origin is at the bottom of the view so there is no need ;; to relocate the turtles upon creation crt number-of-particles [ set color black ;; set pen-size 3 set heading 0 pd ] end ;;;;;;;;;;;;;;;;;;;;;;;; ;; runtime procedures ;; ;;;;;;;;;;;;;;;;;;;;;;;; to go if any? turtles with [ patch-at 0 1 = nobody ] [ ask turtles [ set ycor 0 ] clear-drawing ] ;; have the turtles randomly pick either right or left and ;; move in that direction ask turtles [ ifelse ((random-float 1) < left-probability ) [ ;; go left set heading 90 forward 1 set heading 0 forward 1 ] [ ;; go right set heading 270 forward 1 set heading 0 forward 1 ] ;; set the color of the turtles to give a rough idea of how many turtles ;; are at each location -- the lighter the color, the greater the number ;; of turtles set color scale-color blue (count turtles-here) (number-of-particles / 5) 0 ] ;; calculate root mean square of distance of all particles set sum-distance 0 foreach sort turtles [ ask ? [ set sum-distance (sum-distance + xcor * xcor) ] ] set root-mean-square (sqrt (sum-distance / (count turtles))) tick end
There are 2 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Random Walk Periodic Boundary Condition.png | preview | Preview | almost 12 years ago, by Do Trong Thanh | Download |
This model does not have any ancestors.
This model does not have any descendants.