Random Walk Periodic Boundary Condition 2D Lattice
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 [ root-mean-square sum-distance sum-prob west-prob-scale east-prob-scale north-prob-scale south-prob-scale prob ] ;;;;;;;;;;;;;;;;;;;;;; ;; setup procedures ;; ;;;;;;;;;;;;;;;;;;;;;; ;; set up the patches and creates turtles to setup clear-all set-patch-size (200 / boundary) resize-world (- boundary) boundary (- boundary) boundary ask patches [ set pcolor gray + 3 ] init-constant setup-turtles reset-ticks end to setup-turtles crt number-of-particles [ set color black pen-down ] end to init-constant set sum-prob (west-prob + east-prob + north-prob + south-prob) set west-prob-scale (west-prob / sum-prob) set east-prob-scale (east-prob / sum-prob) set north-prob-scale (north-prob / sum-prob) set south-prob-scale (south-prob / sum-prob) end ;;;;;;;;;;;;;;;;;;;;;;;; ;; runtime procedures ;; ;;;;;;;;;;;;;;;;;;;;;;;; to go ;; have the turtles randomly pick north, south, west, east and ;; move in that direction ask turtles [ set color blue set prob (random-float 1) if (prob < west-prob-scale) [ ;; go west set heading 270 forward 1 ] if (prob > west-prob-scale) and (prob < west-prob-scale + east-prob-scale) [ ;; go east set heading 90 forward 1 ] if (prob > west-prob-scale + east-prob-scale) and (prob < west-prob-scale + east-prob-scale + north-prob-scale) [ ;; go north set heading 0 forward 1 ] if (prob > west-prob-scale + east-prob-scale + north-prob-scale) [ ;; go south set heading 180 forward 1 ] set color black ] ;; calculate root mean square of distance of all particles set sum-distance 0 foreach sort turtles [ ask ? [ set sum-distance (sum-distance + (xcor * xcor + ycor * ycor)) ] ] set root-mean-square (sqrt (sum-distance / (count turtles))) tick end
There are 4 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Random Walk Periodic Boundary Condition 2D Lattice.png | preview | Preview for 'Random Walk Periodic Boundary Condition 2D Lattice' | almost 12 years ago, by Do Trong Thanh | Download |
This model does not have any ancestors.
This model does not have any descendants.