# Dancing with Friends and Enemies: Swarm Intelligence in Boids

Original title: Dancing with friends and enemies: boids' swarm intelligence

> Hacker News story 49257362 · language: en · submitted 2026-08-11
> Web version: https://zeli.app/story/49257362
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 45 · by [surprisetalk](<https://news.ycombinator.com/user?id=surprisetalk>) · 💬 6
[original](<https://community.wolfram.com/groups/-/m/t/122095>) · [HN discussion](<https://news.ycombinator.com/item?id=49257362>)

## Summary

A playful experiment turns 1,000 particles into dancers, each with a randomly chosen friend and enemy, moving closer to the center, toward friends, and away from enemies. The simple rules produce mesmerizing swirling patterns, illustrating how macro-scale swarm behavior emerges from local interactions. The post includes code, animations, and variations like 3D and ring configurations.

## Key quote

> The description of the system as a dance was an attempt to explain the swirling pattern on the screen without using mathematical language.

## HN discussion (6 comments)

### [markstock](<https://news.ycombinator.com/item?id=49326762>)

> The tweaks that SW included are pretty common to similar simulations:
>
> 1) the attraction-repulsion pair is typical of "boids" simulations, and also features in the Lennard-Jones forces acting in atoms (albeit with different powers on the decay rate);
>
> 2) making the force drop to zero for particle-particle distances approaching zero is effectively treating each particle as a "cloud" and not a singular point, it's called "regularization" in vortex particle methods and "Plummer softening" in gravitational methods; it's primary benefit is with SIMD and parallelization by removing the need for a (i != j) conditional; and
>
> 3) slow contraction (multiplying each particles' position by (1-epsilon)) is a technique used by generative digital artists to ensure that visual activity does not stray too far from a directed point.
>
> The unique component of this simulation is the (computationally-efficient) dependence of a very small number (N=2 here) of neighbor particles. The typical O(N^2) that limits real-time simulations to 10k-50k particles becomes O(N).

### [palad1n](<https://news.ycombinator.com/item?id=49327492>)

> Brings me back to when there were boids applets.

### [yehoshuapw](<https://news.ycombinator.com/item?id=49327283>)

> I find it fascinating how (in the new version) the further away clumps stay separate, until something small from the larger swarm reaches them, then they all merge back to it

---

## Cite

- Page: https://zeli.app/story/49257362
- Date: 2026-08-11
- Source: community.wolfram.com (https://community.wolfram.com/groups/-/m/t/122095)
- Hacker News: https://news.ycombinator.com/item?id=49257362

## Other languages

- zh: https://zeli.app/zh/story/49257362 · markdown: https://zeli.app/zh/story/49257362.md
- ja: https://zeli.app/ja/story/49257362 · markdown: https://zeli.app/ja/story/49257362.md
- ko: https://zeli.app/ko/story/49257362 · markdown: https://zeli.app/ko/story/49257362.md
- de: https://zeli.app/de/story/49257362 · markdown: https://zeli.app/de/story/49257362.md
- es: https://zeli.app/es/story/49257362 · markdown: https://zeli.app/es/story/49257362.md
