Chaos Game for polygon random float factor "r"
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
Thhis is using NetLogo to play the Chaos Game. In the Game, using two very simple rules, beautiful fractal pictures are generated. The rules are: In a regula polygon of n number of side, it has n number of apices. Into that space, a random spot is chosen as the starting point. Throw a die, and depending on the result of the throw, the next point chosen will be along the line that leads from that point to the indicated apex. How far along that line is the point going to be placed? In the original Chaos Game with the triangle, the point is midway along that ine, or r = 0.5. But that could be changed.
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
The classical Chaos Game was done on a triangle with r = 0,5 and it results in the Sierpenski triangle. Try the other polygons, and vary the “factor”
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
Written by Dr Ronald P. Ng Singapore e-mail: ronaldpaul.ng@gmail.com
Comments and Questions
globals [turtleX turtleY newXcor ; the new xcor which the turtle will go to newYcor ; the new ycor which the turtle will go to turtleDistance ; thd distance the turtle has to travel worldLength factor ] to setup ca ;; with the worldLength, excessLength and octogonSide length set up, these data will be used ;; in defining the points of the octogon set worldLength max-pxcor ;; that being the size of the world crt 2 [ set color white set size 10] ask turtle 0 [setxy random-xcor random-ycor hide-turtle] ask turtle 1 [setxy 0 0 face patch 0 160 hide-turtle ] reset-ticks end to go find-new-position ;use tutle 1 set turtlex [xcor] of turtle 0 set turtley [ycor] of turtle 0 ask patch turtlex turtley [set pcolor green] move-new-position if ticks > max-ticks [stop] tick end to move-new-position set factor (random-float random-r + 0.5) ;; each time, the point determined on the line between the present position and the corner of the polygon will be decided by a ;; slightly different factor ask turtle 0 [set turtleDistance distancexy newXcor newYcor face patch newXcor newYcor fd turtleDistance * factor ] ask patch newXcor newYcor [set pcolor green] end to find-new-position let random-turn random number-of-sides * (360 / number-of-sides) ask turtle 1 [rt (random-turn) fd 380] set newXcor [xcor] of turtle 1 set newYcor [ycor] of turtle 1 ask turtle 1 [setxy 0 0 face patch 0 380] end
There is only one version of this model, created over 2 years ago by Ronald Paul Ng.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Chaos Game for polygon random float factor "r".png | preview | Preview for 'Chaos Game for polygon random float factor "r"' | over 2 years ago, by Ronald Paul Ng | Download |
This model does not have any ancestors.
This model does not have any descendants.