Show HN: Swarm – Program a colony of 200 ants using a custom assembly language
We built an ant colony simulation as an internal hiring challenge at Moment and decided to open it up publicly.
You write a program in a custom assembly-like (we call it ant-ssembly) instruction set that controls 200 ants. Each ant can sense nearby cells (food, pheromones, home, other ants) but has no global view. The only coordination mechanism is pheromone trails, which ants can emit and sense them, but that's it. Your program runs identically on every ant.
The goal is to collect the highest percentage of food across a set of maps. Different map layouts (clustered food, scattered, obstacles) reward very different strategies. The leaderboard is live.
Grand prize is a trip to Maui for two paid for by Moment. Challenge closes March 12.
Curious what strategies people discover. We've seen some surprisingly clever emergent behavior internally.
(
77 comments
| 13 points
| on HN
)
"Moment Engineering by Moment Technology wants to access your {GitHub account name} account Personal user data Email addresses (read-only), profile information (read-only) This application will be able to read your private email addresses and read your private profile information."
Does it really reveal that much talent to make it worth the money?
Just curious
Plus, Hawaii is awesome.
Assuming an engineer costs $200k/year, 200 effective working days per year, that's 1k/day. Developing the contest (from the idea to building the rules to building the site to playtesting) likely cost more than 20 eng-days, making it the biggest cost.
Hiring is expensive. If it takes 30 minutes to screen one candidate for suitability for the "real" interview and 5h to do a "real" interview (including evaluation etc.), 5 screenings for one interview-worthy candidate and 5 interviews for one hire (I suspect the real factors might be closer to 10), that's 12.5h of screening and 25h of interviewing per hire.
they usually ask for a non trivial percentage of the first year salary
But in all seriousness, ants are smarter than they look. They operate as a collective. Just in the same way that assembly needs to operate collectively to get the best output.
They're more closely linked than they appear from the outside ;)
I'd argue the opposite, ants are dumber than they look. You look at a random ant stack in the forest and it looks like they're smart, but that's only when they're "controlled" by the collective, individual ants themselves are pretty dumb in the end, but it's hard to see as typically we always see them around/in their stacks in nature.
Many moons ago I had a big pot of rhubarb in my back yard¹ and was initially irritated by the appearance of ants and aphids, until I took a moment to watch them and realise that the ants were bringing in the aphids and tending to them. The buggers were farming. The ants can't digest the leaves of the rhubarb, but the aphids can and excrete a sugary by-product that the ants “milk” from them. It is a fascinating bit of nature to read into. They even defend the aphids from predators and so forth, so it isn't a bad life for them either.
--------
[1] Not a euphemism for a lovely garden in that case, it was literally about a square yard of concrete behind the mid-terrace I was renting.
I’m sorry your what now?
I had no clue, but thanks for the book lead! It didn't come up directly, but SimCity 2000 and especially SimCity 4 had a huge impact on me growing up / I still spin up SimCity 4 from time to time, so I imagine there's a massive indirect influence haha.
Ants have fascinated me from a young age, I’d construct a viewing platform so I could watch the hive at work.
My favorite were the carpenter ants, so smart. It feels like they have a theory of mind. I didn’t hurt them, but if you disturbe their nest under a board, the efficiency and expediency they would exhibit while collecting their young was fascinating.
*edit, I meant to ask if you had any other book recommendations?
Still, it was fun just messing around with the ants, watching the trails, and chasing spiders by calling forth all ants.
I only see "MOMENT" and "All systems nominal"
What possesses people to go for these barely perceptible color schemes?
.. a few minutes later ..
Ok, the crazy low contrast was on the initial landing page. Things have somewhat improved after prodding somewhat blindly at it.
I'll let the question stand though, bc why do that for what's going to be people's first impression?
i spent way too much time on things like the language itself, map generation, and figuring how to only recompute the sim on material code changes vs whitespace and comments (it assembles to "bytecode" with debouncing! and the sim component takes the bytecode as a prop).
we'll see if good ROI, we definitely intend to run more of these types of challenges in the future, so much of this work won't go to waste
Most plants right now settle into a simple goto loop that places the requisite cells to survive and then spam seeds until they die. I have seen some interesting variety in body plans emerge where plants sort into discrete species regionally. I'm hoping to eventually get decision making to emerge organically. If things go well this system is theoretically capable of sexual selection (and maybe fisherian runaway) but that's a pipe dream right now.
https://github.com/Will-Morr/PlantBrainGrid
I cannot scroll to the Governing Law section
I can't see the rules of this challenge, but it sounds really darn close.
In the reference material under ARITHMETIC, it shows `AND r1 0xFF` as valid. However, actually using that code always produces zero regardless of what is in r1. My experiment concluded that only decimal inputs are supported, and hexadecimal are not, but the reference doesn't say that, and the editor doesn't flag the hexadecimal inputs as an error. Perhaps the reference material should be updated to simply show "255" instead of "0xFF".
Here is code to reproduce:
I know opening up the source or keeping the hosting up might be really hard to do for legal, security, cost or a million other complicated reasons. so if its not possible, thank you anyway :)
So simple and beautiful. So addicting. Love it! Thank you!
I have no idea if anyone checks these threads after a week but not that it's over, I am super curious what strategies other folks used. I used a python script to pre-process my programs to minimize jumps and downloaded the sim to run an iterative optimizer with parallelization. I just put a little writeup and the code on github https://github.com/Will-Morr/MomentSwarm.
I wrote mine by hand just testing it using the in-browser simulator. I initially used subroutines to try to keep things structured but then resorted to inlining most things (and flattening as much state as I could to bare registers) to try to speed things up, though i never quite got my ants to always move within the 64 op step.
My best score on the official test set was 654 (43rd place). I put my code and a little write up here: https://github.com/cristoper/brain.ant
https://github.com/hukdukmukduk/brain.ant
Interesting that you didn't use dead reckoning at all to return to the nest. I didn't think I could get away with that. And somehow using a second channel to extend the trails never occurred to me.
https://github.com/Taxes/ants
I'm just now (last few months) dabbling with agentic coding, but being an oldschool tech guy I had to dive straight into assembly. It was just too hard for me to level up my agentic skills given the deadline.
This challenged coincided with my first dabblings into agentic coding. I wrote all my attempts in hand coded assembly, without doing any basic research. but your site is very entertaining and is reminding me of why the connection of ants/swarms cellular automata to gradient discovery to AI always blows my mind