Coding Adventure: Ant and Slime Simulations
Channel:Sebastian Lague · Length:17:53 · Published:2021-03-25 · Views:2196539
Summary
Sebastian Lague explores an ant-inspired algorithm and simulates ant and slime mold behavior, using compute shaders. Source code for both simulations is available.
Why HN recommends it
HN recommends it as a beautiful example of what simple rules and compute shaders can produce, and many commenters were inspired by it.
reminded how beautiful coding can be — HN, 2024
Computer graphics & rendering · Creative coding & generative art
Subtitles (excerpt)
Hi everyone, and welcome to another episode of Coding Adventures. Today we're going to be experimenting with some little ant and slime simulations -- but first, I'd like you to imagine that you're a merchant who travels from town to town selling cabbages, perhaps. So you'd like to find a path that takes you through all of the towns on this map, arriving back home in the shortest possible distance. Here is some slightly confusing code which recursively generates all the possible solutions to this problem, and each of these solutions is evaluated in this function over here, simply by calculating the length of the path, and then saving it if it's the best one we've found so far. So for these 12 towns, let's try running the program, and it only takes a second or so to crunch the numbers and here we have your optimal cabbage route. But now let's say that a new town crops up over here, which you obviously want to visit as well. So, let's run the program again. This time, it's taking a lot longer figure out the answer. The trouble is, the number of unique solutions is equal to the number of points minus one, factorial, divided by 2. So with 3 towns, there's just one solution, but by the time we get to a modest 20 towns,
On Hacker News
At the time I was lost joy of coding too but I was able to found it again. One key point was to ignore learning new tech if it was not absolutely necessary and focus just creating new things. I think it all started from Sebastian Lague's video which reminded how beautiful coding can be. [ [VIDEO] ] — Risord, 2024-08
Sebastian Lague made an excellent video "Ant and Slime Simulations" which explores how path-finding algorithms can use trails and gradient-based signaling to solve spatial problems: [VIDEO] — Udo, 2023-05
Speaking of ant and slime simulation, this recent video Coding Adventures video was pretty mind blowing: [VIDEO] (Especially part 2 starting around 10m in). — ehsankia, 2021-04
I love ants and replicating their behavior in code! You might like these projects: "Coding Adventure: Ant and Slime Simulations" by Sebastian Lague: Video: [VIDEO] Code [LINK] "C++ Ants Simulation 1, First approach" by Pezzza's Work: Video: [LINK] Code: [LINK] — Nezteb, 2023-05
Thanks for sharing this! I have not watched the full video yet but definitely will. Recently got interested in compute shaders thanks to this video: [VIDEO] and can recommend it to those that want to see a bit of what is possible with compute shaders. — Berg0X00, 2021-06
Related videos
- The Absurdity of Detecting Gravitational Waves · Veritasium · 9:07
- YouTube's copyright system isn't broken. The world's is. · Tom Scott · 42:29
- GDC 2018: John McDonald (Valve) - Using Deep Learning to Combat Cheating in CSGO · max4warn · 1:05:32
- Karl Sims - Evolved Virtual Creatures, Evolution Simulation, 1994 · MediaArtTube · 4:09
- David Beazley - Lambda Calculus from the Ground Up - PyCon 2019 · PyCon 2019 · 3:26:34
- THE MARS UNDERGROUND [HD] Full Movie · Blue Mars · 1:13:52
- The Why, What, and How of Pinning in Rust · Jon Gjengset · 3:03:53
- Black Hat USA 2013 - OPSEC failures of spies · Black Hat · 25:11
- Arithmetic, Population and Energy - FULL LENGTH · kip399 · 1:14:16
- The Most Misunderstood Concept in Physics · Veritasium · 27:14
- Canceling | ContraPoints · ContraPoints · 1:40:27
- 8 Bit & '8 Bitish' Graphics-Outside the Box · GDC Festival of Gaming · 1:25:34
- The Beauty of Bézier Curves · Freya Holmér · 24:25
- The Continuity of Splines · Freya Holmér · 1:13:50
- elevated by Rgba & TBC | 4k intro (FullHD 1080p demoscene demo) · Demoscene High-Quality Videos (Annikras) · 3:36
- Painting a Character with Maths · Inigo Quilez · 24:46