This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

910995
910995 presents ...

2019/4/27

Swarming Robots Showcase - Boid Flocking

Identical to the other Swarming Robots Showcase projects.

This project has had the BoidWorld last instantiated so the algorithm can be seen on the Greenfoot website without downloading the project.

The pseudo-code for each boid is as follows:


Boid pseudocode:
move forward
update list of neighbours
set rotation to angle average of separation(), alignment(), cohesion()

function Cohesion pseudocode:
calculate direction to centre position of neighbours
return direction to centre

function Alignment pseudocode:
calculate angle average heading of neighbours
return average heading

function Separation pseudocode:
look for neighbours in a smaller radius
calculate direction to centre position of neighbours
move direction to away from centre of neighbours
Return direction away from centre


Cohesion is shown with a red arrow
Alignment is shown with a blue arrow
Seperation is shown with a green arrow

1874 views / 8 in the last 7 days

1 vote | 0 in the last 7 days

Tags: simulation with-source

open in greenfoot
Your browser is ignoring the <APPLET> tag.
A new version of this scenario was uploaded on 2019-04-27 14:00:18 UTC
A new version of this scenario was uploaded on 2019-04-27 14:02:10 UTC
A new version of this scenario was uploaded on 2019-04-27 20:28:30 UTC Changed mod functions so projct will run on the Greenfoot website applett
A new version of this scenario was uploaded on 2019-04-27 20:44:54 UTC Changed modulo function
Could you make the animtion less faster so you can see what the birds are doing...
A new version of this scenario was uploaded on 2019-05-01 20:52:14 UTC
910995910995

2019/5/1

Thanks for your feedback, I have now decreased the speed of which the simulation runs.
Cool, now you can see what's happening ;-)

Want to leave a comment? You must first log in.

Who likes this?

Proprogrammer04