A random thought popped into my head (when I was sharing a chocolate bar of course!). I was wondering if there is a generic algorithm to solve this problem.
The problem
A good way to answer this question would be to use a breadth-first search algorithm. The algorithm would try every possible break of the whole chocolate bar. Then for each of those possible states of the problem, try all possible breaks, and this would continue while keeping track of the evenness of the pieces.
I'd like to add that the rules would enforce which breaks of the chocolate bar are legal and those possible states which are not legal are thrown out from the algorithm.