6 ms·
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.
- sudo_cowsay 7mo agoNice way of hiring but is it really worth it to give the public a trip to Maui (kinda expensive these days) Does it really reveal that much talent to make it worth the money? Just curious
- armandhammer10 7mo agoIt's less about the money. It's about giving people a chance to do something fun / show off their skills and get rewarded for it. Plus, Hawaii is awesome.
- dr_kiszonka 7mo agoI think it is a fun contest! As for recruitment, it suggests to me you are looking for people with no kids, and possibly young people.
- nylonstrung 7mo agoAppreciate this, very cool of you to do that
- tgsovlerkhgsel 7mo agoThe prizes (Maui trip, second/third prizes, swag kits, shipping for the swag kits) probably cost around $20k in total. 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.
- boutell 7mo agoSure, hiring is expensive, but firing is really expensive! I salute your efforts to get it right on the first try.
- AndrewKemendo 7mo agoWay less than you would pay for a recruiter they usually ask for a non trivial percentage of the first year salary
- TruffleLabs 7mo agoWhy? => "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."
- 4b11b4 7mo agoWait what this is the best reason to write a bunch of assembly AND learn about ants?
- armandhammer10 7mo agoAnd (potentially) go to Hawaii! 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 ;)
- lukan 7mo agoAs a collective, yes. If you look at individuals, they often go in circles and act really dumb. But for the colony it still works out, bigger brains would cost too much energy I suppose and simple algorithms work. (I often watched real ants while and my head translated their behavior to simple algorithms)
- kitd 7mo agoSomeone else who has read Godel, Escher, Bach by Hofstadter?
- oddmade 7mo agoExcellent book cheers
- embedding-shape 7mo ago> But in all seriousness, ants are smarter than they look. 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.
- dspillett 7mo ago> ants are smarter than they look. 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_am_a_squirrel 7mo agowhat is this? assembly for ants?
- armandhammer10 7mo agoant-ssembly to be precise
- testfrequency 7mo agoSo hot right now
- forkerenok 7mo agoIt's assembly for people who can code good.. and can do other things good too.
- yesthisiswes 7mo agoIt needs to be at least three times this size!
- RandomTeaParty 7mo agojust be glad that ants are ambiturners
- nurettin 7mo agoThis is a balancing act between collectors and explorers. There is probably some optimized number. Likely targeted at beginners.
- nozzlegear 7mo agoI think I read a Daniel Suarez book about this once.
- kleiba 7mo agoI wish I could read dark-mode but my eyes somehow cannot handle it (not just on that website, in general).
- purplehat_ 7mo agothere is a `theme set` command
- Uptrenda 7mo ago[flagged]
- mock-possum 7mo ago> my goy master I’m sorry your what now?
- devcraft_ai 7mo ago[flagged]
- jackfranklyn 7mo ago[dead]
- TheAceOfHearts 7mo agoThat's really cute, it reminds me that Will Wright (creator of The Sims) has referenced this book "The Ants", by Bert Holldobler in multiple occasions as a key inspiration for his games (and in particular SimAnt) and systems thinking. Did you come across that during your research phase or had you not heard about it? I haven't read it yet, but maybe someday I'll get around to it.
- huflungdung 7mo ago[dead]
- lightamulet 7mo agoHey, I'm the one who built this particular challenge! 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.
- antfarm 7mo agoThis is exceptionally beautiful. What did you use to build it? Vanilla JS?
- lightamulet 7mo agoThis is actually all built in nextjs/react, though the initial sketches of the sim had no visualization and were just running in my terminal using bunjs
- deleted 7mo ago[deleted]
- antfarm 7mo agohttps://en.wikipedia.org/wiki/SimAnt https://en.wikipedia.org/wiki/SimAnt
- sitkack 7mo ago
- RandomTeaParty 7mo agoDid website break? I only see "MOMENT" and "All systems nominal"
- armandhammer10 7mo agotry pressing any key or clicking around :)
- greenbit 7mo agoIncredible low contrast font color in use there. Looks like about 0x002000 on pure black (per Mk-1 eyeball). 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?
- FpUser 7mo agoAm I being dumb? I was expecting to see ability to look at and run some canned sim
- phreeza 7mo agoReminds me of my personal HN glory days, now 16 years ago!! https://news.ycombinator.com/item?id=1395726 https://news.ycombinator.com/item?id=1395726
- JetSetIlly 7mo agoCool. This is how I imagine the ants were programmed by the spiders in Children of Time.
- general_reveal 7mo agoOrwell would suggest you use the word normal.
- Thanakorn_551 7mo agoThis is really quite cool.
- onair4you 7mo agohttps://alliance.seas.upenn.edu/~plclub/contest/results.php https://alliance.seas.upenn.edu/~plclub/contest/results.php
- ivanjermakov 7mo agoAll dark themes are too low contrast. Give me pure white (including comments) on pure black please.
- lightamulet 7mo agoon the home page (dev.moment.com) you can type `theme -h` and then `theme set [name]` to change the color scheme, which carries forward to the sim!
- ivanjermakov 7mo agoYes. I checked every theme and all dark themes are too low contrast. Pacman is good but comments are barely readable (gray on dark gray).
- orsorna 7mo agoThe amount of effort put into this tool...just for hiring to your exact shop? I cannot imagine that's a good return on investment?
- Kinrany 7mo agoPeople like doing cool stuff
- lightamulet 7mo agoi think this took me (1 person) like 40 hours max? all built in the last week, though i spent more time than i should have on it haha. quite ai-assisted, that's how most of the layout like the editor, player controls, even eval server got set up. 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
- sixo 7mo agoThere's also a trip to Hawaii in it for you.
- deleted 7mo ago[deleted]
- mdk017 7mo ago[dead]
- macleginn 7mo agoWhat's with "artesenal"? Is this a joke that I don't understand or a surprising way to write "artisanal"?
- lightamulet 7mo agothe answer is my editor doesn't have spellcheck and i apparently don't know english as well as i thought, fixing :')
- anta40 7mo agoSo.... a sort of modern Corewar?
- lambchop_395 7mo ago[dead]
- deleted 7mo ago[deleted]
- ynac 7mo agoMy "hello world" for a new stack is always a version of Worm. Somewhere between Life and your Swarm, Worm wanders around looking for food and water, trying to avoid birds and other issues. Each round the worm survives it grows by a segment. If it doesn't get food or water, it is reduced a segment. And so on. Your Swarm is a few levels up from my iterations, totally inspirational! Thanks!
- WillMorr 7mo agoI've been working on a surprisingly similar project for the last week: plants grow cells on a grid by executing a raw chunk of memory according to a simple instruction set. I'm aiming more for an evolution simulator, where each plant gets a 1kb brain that is randomized a little when a new plant is spawned. 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 https://github.com/Will-Morr/PlantBrainGrid
- ngvrnd 7mo agoIs it possible to reset the source once you've started modifying it?
- jlarks32 7mo agoThe disclosure route is cut off at the bottom: https://dev.moment.com/disclosures https://dev.moment.com/disclosures I cannot scroll to the Governing Law section
- Vibeguy900 7mo agoMake sure you lets those agents relax and recharge at https://vibesprings.net https://vibesprings.net
- dastapov 7mo agoThis sounds a lot like a task of 2004 ICFPC Programming contest: ants, pheromone trails, only local vision, etc: https://web.archive.org/web/20060709155354/http://www.cis.upenn.edu/~plclub/contest/ants.html https://web.archive.org/web/20060709155354/http://www.cis.up... I can't see the rules of this challenge, but it sounds really darn close.
- riteshyadav02 7mo ago[dead]
- geoffpurvis 7mo agoI think I found a bug: 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: ; ================================================== ; Bug Report: ; AND operation returns 0 when give a hex argument ; ; Expected behavior: ; (1 AND 0xF) should either equal 1 or the ; line should be flagged as an error. ; ; Actual behavior: ; (1 AND 0xF) equals 0 and does not flag error. ; ================================================== .alias input r0 .alias output_using_hex r1 .alias output_using_dec r2 main: ; Pick any number only using bits 0xF SET input 1 ; Test using hex SET output_using_hex input AND output_using_hex 0xF ; no error raised ; Test using decimal SET output_using_dec input AND output_using_dec 15 ; (15 == 0xF) PICKUP ; end the tick, so registers are stable ; Registers at this tick boundary: ; input: 1 ; output_using_hex: 0 (incorrect) ; output_using_dec: 1 (correct) JMP main
- lightamulet 7mo agothanks for the bug report! oversight on my part, pushing hex support rn :)
- grantsucceeded 7mo agoThank you, Thank you, Thank you. I'm absolutely having a great time immersing myself in this, but I'm super sad about the day it will be taken down and i cant play anymore. Maybe that day is when the contest is over? Will there be some way i can keep enjoying this beautiful little world after the contest? 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!
- CGamesPlay 7mo agoThat was fun! Will there be a blog post / showcase or anything? I came in 9th, and will definitely be writing a blog post. I did not write a single line of antssembly during the contest!
- enlyth 7mo agoVery fun. I'm the 7th place, contact me if you want to share solutions out of curiosity
- CGamesPlay 7mo agoI published my submission and all supporting information here, in case anyone is curious! https://github.com/CGamesPlay/moment-swarm https://github.com/CGamesPlay/moment-swarm
- ivanstepanovftw 7mo agoThank you! Will you release winners code?
- WillMorr 7mo agoThanks for organizing this! I had a great time playing with the system for a week even though I did not get anywhere close to the prize pool. 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 https://github.com/Will-Morr/MomentSwarm.
- cristoperb 7mo agoI just came back to check if anyone else was discussing their entry, so thanks for posting your write up! 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/cristoper/brain.ant
- hukdukmukduk 7mo agoHere is my entry, I managed to get up to 815 on the validation set during the event, and 825 after: https://github.com/hukdukmukduk/brain.ant https://github.com/hukdukmukduk/brain.ant
- cristoperb 7mo agoThanks for sharing, and congratulations! 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.
- andthenzen 7mo agoThanks to everyone in this chain for sharing! I've learned so much from your programs and was inspired to make my repo public and do a write up as well. I was 52nd place with a score of 599. https://github.com/Taxes/ants https://github.com/Taxes/ants
- sliken 7mo agoAny chance of turning this into a server/client with an API so people could use the language of their choice?