Write the hill climbing algorithm