Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
There's a simpler strategy that works based only on the last thing you ate: Well-order $X$. At each step, if there is any chocolate offered smaller than the last one you ate, eat the greatest such chocolate offered. Otherwise, eat the greatest chocolate offered. Doing this, you end up eating a bunch of decreasing sequences of chocolates - each decreasing sequence containing every chocolate that was available when the sequence started (and each decreasing sequence being finite because of the well-order).
@MikeShulman I've not heard that term before, but it looks to be the same from a cursory search of the term (...I haven't found a precise definition of "regularity", though it seems to be the same desire). I'll have to do some reading to figure out whether that answers my question - it looks very promising!
@darijgrinberg That's mainly what I am looking for; I was hoping there might be something comparable to, for instance, extracting the multiple roots of a polynomial (or, more generally, computing a polynomial GCD) - that is, not a nice analytical formula, but a method of computation that at least respects the symmetries of the problem and isn't too arduous.