Chaos Game Regular polygon of any size

Chaos Game Regular polygon of any size preview image

1 collaborator

Rng_avatar Ronald Paul Ng (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.3.0 • Viewed 68 times • Downloaded 3 times • Run 0 times
Download the 'Chaos Game Regular polygon of any size' 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

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
        ]

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

  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 about 1 year ago by Ronald Paul Ng.

Attached files

File Type Description Last updated
Chaos Game Regular polygon of any size.png preview Preview for 'Chaos Game Regular polygon of any size' about 1 year ago, by Ronald Paul Ng Download

This model does not have any ancestors.

This model does not have any descendants.