Hacker News new | past | comments | ask | show | jobs | submit login

Slightly relevant story time:

On one of the better teams I’ve worked with the water-cooler activity was trying to come up with an algorithm to describe the behaviour of the Coca Cola machine in the kitchen.

It was one of those clear plexiglass front machines where after punching in the coordinates of the item you wanted, a mechanical arm would move to the coordinates, take a drink, and place it in the delivery bay at the bottom.

While it would always get the drink you wanted, it would rarely go to the exact coordinates you specified. Ie, if there were three columns filled with coke, and you punched in the coordinates for the one on the far right, the arm may take a can from the center, or left column.

We would often wager a can of coke (“if I can’t find anything wrong in your PR, I’ll buy you a coke”), so we were perhaps drinking more soft drink than was medically advisable, but in our defence:

a) the machine was really cheap (AUD$1 or $1.5)

b) it was an excellent 10min break game

Eventually we thought they had it figured out we would gather and make our predictions, but occasionally there would be an upset that would throw a wrench into the model.

We got to a point where we just couldn’t reconcile the machine behaviour with any kind of coherent set of rules, then one morning we saw the delivery guy stocking it.

After chatting with him we learned our algorithm was more or less correct, but the internal state of the machine was prone to getting out of sync with the actual stock levels, so it would make the “wrong” choice near the end of the refill cycle. Then he gave the engineer talking to him a free energy drink (source of stock problems right there haha)

While we were no Knuths, I love that these kinds of games are so universal among engineers/devs. In fact, if I can get someone to tell me a similar story of theirs in an interview (for a technical role) I’m much more likely to consider them for the position. Curiosity is a powerful trait for a developer.

…and the (simple) algorithm for the machine is: Take from the column with the most stock, if there are multiple columns with the same stock level, take from the column furthest to the left.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: