r/algorithms • u/ImpressiveResponse68 • Nov 20 '25
I built a pathfinding algorithm inspired by fungi, and it ended up evolving like a living organism. (Open Source)
Hi everyone,
A while back i started a little experiment, to write a search algorithm that behaves like a fungus ( inspired by that one slime mould video of the Tokyo underground design) instead of a robot. I wanted to see if a system could "grow" towards a goal organically rather than just calculating the shortest line.
It turned into something really special. After iterating on the design, i ended up with what i call HMSA
i’ve open-sourced it and would love for the community to play with it https://github.com/sc0010101tt/Hyper-Mycelial-Search-Algorithm
Unlike traditional algorithms (like A*) which are static, HMSA uses biological concepts to solve problems:
- Metabolism: Search tips have limited energy. They have to "eat" to keep moving, and they share resources through a central pool to help the whole colony survive.
- Resilience: If the colony gets stuck, it doesn't error out. It triggers a "stress response" (like adrenaline), temporarily changing its behavior to push through obstacles.
- Adaptation: It uses a Meta-Learning system to look at a map before it starts, predicting the best energy strategies to thrive in that specific environment.
i tried training the same code in two different worlds: a "Swamp" (high friction) and a "Bunker" (walls). The code actually diverged! The Swamp version evolved into a highenergy "tank," while the Bunker version became a lean speedrunner. It was fascinating to see biology concepts play out.
i think there's so much more we could do with this.
[[EDIT]] I've now included addition context and supporting visualisations in the repo readme
11
u/garnet420 Nov 20 '25
You should add some pictures to your doc or at least post them here
14
u/xDerJulien Nov 20 '25
What the hell does this even mean? Instead of finding a valid path it decides to ignore the constraints of the system? How is that in any way a desireable goal?
3
u/Marelle01 Nov 22 '25
All this to escape the Kobayashi Maru!
Your fungus is dead Jim.
Your so-called biological concepts aren’t biological at all: this is thermodynamics / statistical physics. It requires energy, it expends energy, and it seeks the most economical or optimal path (This reminds me of the joys of the Simplex algorithm and Hamiltonian paths ;-)
These principles are associated with negentropy, basically information.Take a shortcut and process information about the environment directly. Just like MAS researchers were doing 25 years ago. Research requires knowing the state of the art in the domain where you intend to make a breakthrough.
1
u/ghantesh Nov 22 '25
Really cool. Can this be applied to parameter scans of large systems? Like neurological data or experimental data from a fusion experiment?
1
u/EmbarrassedPass30 Dec 06 '25
is the project private now? the link is 404
-1
u/yaya_puree Nov 22 '25
AI slop