Square Spiral

Square Spiral preview image

1 collaborator

Default-person Eli Horton (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.1.0 • Viewed 271 times • Downloaded 30 times • Run 0 times
Download the 'Square Spiral' modelDownload this modelEmbed this model

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


WHAT IS IT?

This is a model of a basic agent movement goal of spiraling inward with the addition of one simple interaction when agents get close to one another. The sliders and pull-downs can be adjusted to change the outcome of the model.

HOW IT WORKS

The turtles make sprials inwards until they reach zero, where they do a "victory dance" and rotate. Interactions are also used so when turtles come within other turtles, their stepsize goes back to 10.

HOW TO USE IT

Set the number of turtles and what shape you want them to make. The slider is for the number of turtles, and the number pull-down menu is what measure you want each angle to be in the polygon. The setup button puts everything how you set it up, and they go will run the model.

THINGS TO NOTICE

Keep an eye out for how long the turtles continue moving, and if any are caught in an infinite loop. This loop is when they are in snyc with their steps and they can never do the "victory dance" because they are continuing each others steps.

THINGS TO TRY

Pushing the number of turtles all the way to the right and making 100 turtles will have all of them moving forever, never stopping. With the code, anywhere from 8-15 turtles will give you mixed results. The angles are very interesting, and having the angle at the smallest setting will make large shapes and using the recommended turtls of 10, will end sometimes and go on forever others.

EXTENDING THE MODEL

Adding a monitor with the Interaction number would add more to the model, showing how many times the turtles touch each other.

NETLOGO FEATURES

Interactions were the hardest part, having to get around the patches and counting on those patches.

RELATED MODELS

The Wolf-Sheep predation is similar because of the interactions in the model. When the wolves get close to the sheep, they eat them and they disappear, and sheep and wolves will interact by mating and giving birth to offspring. In this model, when the turtles interact they make each other keep moving.

CREDITS AND REFERENCES

Markus Pannock gave me basic help when making the physical spiral, so shoutout to him. Mr. Hubbell always a trill dude, deserves respect and praise, shoutout to him.

Comments and Questions

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

Click to Run Model

turtles-own [stepsize] 

to setup
  clear-all
  setup-turtles
  ask turtles [ set shape "turtle" ];; turtles will be turtles 
  reset-ticks
end 

to go
  square_spiral ;; creating a variable for square spiral
  tick
end 

to setup-turtles
  create-turtles AmountTurtles [ setxy random-xcor random-ycor ;; puts the turtles in random positions before the start of the model
    set stepsize 10 ]
end 

to square_spiral ;; the variable square spiral
  ask turtles [ ;; start of the command to tell my turtles to move
    pd ;; fairly self explanitory, 
    right angle ;; instead of a number value, "angle" is the variable that can be found on the drop down menu on the interface tab
    fd stepsize
    if stepsize != 0 [ ;; this this what helps the agent do the victory dance, letting them know not to go any lower if the stepsize equals zero
      set stepsize stepsize - .5 ;; decrases step size to make accurate shapes and less space between the lines
      ] 
    
    if (count turtles-here > 1) [
      
      ask turtles-here [ set stepsize 10]
      
    ]
        
    if (count turtles-on neighbors > 0)[
     
     ask turtles-on neighbors [set stepsize 10]
     ask turtles-here [ set stepsize 10]
     
    ]

   
  
  ]

   tick
end 


  


There is only one version of this model, created almost 11 years ago by Eli Horton.

Attached files

File Type Description Last updated
Square Spiral.png preview Preview for 'Square Spiral' almost 11 years ago, by Eli Horton Download

This model does not have any ancestors.

This model does not have any descendants.