Chaos Game for polygon random float factor "r"

Chaos Game for polygon random float factor "r" preview image

1 collaborator

Rng_avatar Ronald Paul Ng (Author)

Tags

chaos game with random "r" 

Tagged by Ronald Paul Ng almost 2 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.3.0 • Viewed 94 times • Downloaded 8 times • Run 0 times
Download the 'Chaos Game for polygon random float factor "r"' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

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 almost 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"' almost 2 years ago, by Ronald Paul Ng Download

This model does not have any ancestors.

This model does not have any descendants.