anchor.diff:    BestBid := MaxSingle;
     for I := Max(TargetLoc.Y - RAD, 1) to Min(TargetLoc.Y + RAD, fTerrain.MapY - 1) do
     for K := Max(TargetLoc.X - RAD, 1) to Min(TargetLoc.X + RAD, fTerrain.MapX - 1) do
  -    if P.CanAddHousePlanAI(K, I, aHouse, True) then
  -    begin
  -      Bid := KMLengthDiag(KMPoint(K,I), TargetLoc) - fAIFields.Influences.Ownership[fOwner,I,K] + KaMRandom * 5;
  -      if (Bid < BestBid) then
  -      begin
  -        aLoc := KMPoint(K,I);
  -        BestBid := Bid;
  -        Result := True;
  -      end;
  -    end;
  +  if P.CanAddHousePlanAI(K, I, aHouse, True) then
  +  begin
  +    Bid := KMLengthDiag(KMPoint(K,I), TargetLoc)
  +           - fAIFields.Influences.Ownership[fOwner,I,K] / 10
  +           + KaMRandom * 5;
  +    if (Bid < BestBid) then
  +    begin
  +      aLoc := KMPoint(K,I);
  +      BestBid := Bid;
  +      Result := True;
  +    end;
  +  end;
   end;
   
   
  
positive.code:     function GetSourceLocation(aHouseType: array of THouseType; out Loc: TKMPoint): Boolean;
  
      function NextToOre(aHouse: THouseType; aOreType: TResourceType; out aLoc: TKMPoint): Boolean;
      function NextToHouse(aTarget: array of THouseType; aHouse: THouseType; out aLoc: TKMPoint): Boolean;
      function NextToStone(out aLoc: TKMPoint): Boolean;
      function NextToTrees(aTarget: array of THouseType; aHouse: THouseType; out aLoc: TKMPoint): Boolean;
      function NextToGrass(aTarget, aHouse: THouseType; out aLoc: TKMPoint): Boolean;
  
negative.code: end;
  
  
  function TKMCityPlanner.NextToHouse(aHouse: THouseType; aTarget, aAvoid: array of THouseType; out aLoc: TKMPoint): Boolean;
  const RAD = 15;
  var
    I, K: Integer;
  