Last year Google had an M&M problem. So, as it does with most dilemmas, the Internet giant put its data wizards into action.

Employees were eating too much of the free candy and that, the firm surmised, might hinder efforts to keep them healthy and happy.

So in what could be called Project M&M, a special-ops force of behavioral-science boffins conducted surveys of snacking patterns, collected data on the proximity of M&M bins to any given employee, consulted academic papers on food psychology — and launched an experiment.