Dancing with friends and enemies

1 collaborator

Jesus Marcano (Author)

Tags

boids

Tagged by Jesus Marcano almost 3 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.1 • Viewed 528 times • Downloaded 31 times • Run 0 times

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

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
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.