Building as a search algorithm

Finding the best place to build a castle.