Implemented a hill climbing algorithm.