Added function for inverting an evaluation function (or rather its
result - writing this in a functional language would be so much nicer).