A Developer's Lunch Menu Decision Algorithm
I tried to solve the daily lunch dilemma with code. It went sideways.
What are we eating today
Every day at 11:40 AM, the same question pops up in our team Slack. "What should we eat for lunch?" And nobody answers. About 5 minutes of silence, then someone types "anything's fine," followed by another 5 minutes of silence. This happens every single day.
We all know that "anything" is the hardest order to fulfill. (And yet, every day, "anything" it is.)
So I actually wrote an algorithm
One lunch break, half joking and half serious, I built a random lunch menu recommender. Started simple. Threw 23 nearby restaurants into an array and hit Math.random().
const restaurants = ['Kimbap Place', 'Chinese', 'Tonkatsu', ...];
const pick = restaurants[Math.floor(Math.random() * restaurants.length)];Used it for a week and ran into problems. Monday: Chinese place. Tuesday: Chinese place again. Wednesday: Chinese place. That's just how randomness works. People assume "random" means "evenly distributed," but true randomness has bias.
Added some weights
So I added logic to lower the weight for recently visited places. Anywhere visited in the last 3 days gets 0 probability, within a week gets 50% reduction. Seemed pretty reasonable.
But then another problem. Our 6 team members all have different preferences. One can't eat spicy food, one only likes Japanese cuisine, and one is price-sensitive. (Anything over 10,000 KRW -- about $7.50 -- triggers a "that's expensive" response.)
So I started feeding each member's preferences in as weights. That's when things got weird. The lunch picker was slowly turning into a full recommendation system.
This is where it all got tangled
I made a Google Form to collect preference data. Rate each of the 23 restaurants from 1 to 5. Four out of six people responded. The other two said "anything." (That "anything" is exactly the problem here.)
Collected the data and tried something resembling collaborative filtering. Took me 3 hours to realize that collaborative filtering on 6 data points is meaningless. Sample size way too small.
Ended up going back to simple average scores with a recent-visit penalty. Three hours wasted.
Is anyone actually using it
Surprisingly, it's been in use for two months now. Built it as a Slack bot -- type /lunch and you get a recommendation. The team's favorite feature is the "veto." Don't like the result? Type /lunch veto and it re-rolls.
Looking at the stats, people exercise the veto an average of 2.3 times. By the third suggestion, it's usually "fine, let's just go there." The algorithm doesn't pick the meal. It gives people something to reject.
No real lesson here
Honestly, I didn't learn much technically from this project. Maybe just that building a recommendation system for 6 people is the definition of overengineering. (Really I just wanted an excuse to build something.)
Weirdly though, the bot actually helped team morale. The awkward lunch silence disappeared, and now people look at the bot's pick and go "we literally went there yesterday lol" and that becomes the conversation.
Anyway, tomorrow at 11:40 I'll type /lunch again. And I'll probably use the veto too.