solved exercise 4.2 - enforced hill climbing