The following pseudo-code describes the Hill-Climbing Algorithm.
HILL-CLIMBING(problem)
curr ← initial-state
while(stopping criteria)
next ← successor of curr with highest value
// Found a local or global maximum
if next.value <= curr.value
return curr
end
curr ← next
end
return curr
end