Dancing with friends and enemies

Dancing with friends and enemies preview image

1 collaborator

Jesus_marcano Jesus Marcano (Author)

Tags

boids 

Tagged by Jesus Marcano 9 months ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.1 • Viewed 297 times • Downloaded 10 times • Run 0 times
Download the 'Dancing with friends and enemies' 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?

A flock of boids dancing with friends and enemies. Complexity emerges from the interactions between dancers.

HOW IT WORKS

Each boid chooses an friend and enemy and then moves towards its friend and away from its enemy while taking some steps towards the center floor. With some probability they change their partners and enemies while dancing.

HOW TO USE IT

You can set the steps taken by the boids towards friends, away from enemies and towards the center floor. The Setup button spreads the boids around the floor (the world) and the Go button starts the "dance".

THINGS TO NOTICE

Notice that the boids don't get stuck for a long time at the walls.

THINGS TO TRY

Move the sliders to find intresting choreography.

EXTENDING THE MODEL

You can extend the model changing the probability of exchanging friends and enemies and the number of boids. You will notice that these two factors are somewhat related if you insist in getting intresting choreographies.

NETLOGO FEATURES

No special features of NetLogo were used in this model but the capability of recording video will be usefull for making a movie with a million boids.

RELATED MODELS

You can find a similar implementation using the language Julia: https://youtu.be/8gS6wejsGsY

CREDITS AND REFERENCES

The original idea for this work was an implementation in Mathematica: https://community.wolfram.com/groups/-/m/t/122095

Comments and Questions

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

Click to Run Model

;; Dancing with friends and enemies

turtles-own [ friend enemy ]

to setup
  clear-all
  ask patches [ set pcolor white ]
  create-turtles 1000 [
    set shape "dot"
    set size 3
    set color black
    setxy random-xcor random-ycor

    ;; choose a friend and an enemy
    set friend one-of other turtles
    set enemy one-of other turtles
  ]
  reset-ticks
end 

to go
  ask turtles [
    facexy 0 0
    fd towards-center-floor

    face friend
    fd towards-friend

    face enemy
    fd -1 * away-from-enemy

    ;; change friends and enemies with some probability
    if random 1000 < 1 [
      set friend one-of other turtles
      set enemy one-of other turtles
    ]
  ]
  tick
end 

There are 3 versions of this model.

Uploaded by When Description Download
Jesus Marcano 9 months ago 1000 boids Download this version
Jesus Marcano 9 months ago 2000 boids dancing with friends and enemies. Download this version
Jesus Marcano 9 months ago Initial upload Download this version

Attached files

File Type Description Last updated
Dancing with friends and enemies.png preview Preview for 'Dancing with friends and enemies' 9 months ago, by Jesus Marcano Download

This model does not have any ancestors.

This model does not have any descendants.