Add some basic decision functions, mostly optimallyOrder

This is a pretty naive implementation of optimallyOrder that really
can't be used for large sets of actions. It also doesn't put any value
on leftover cookies after the sequence from selling actions. Also, any
illegal permutation will cause a runtime error. Other than this it is
correct and can be used for testing more efficient implentations.