anchor.diff:  end;
   
   
  -{ TKMPointCntList }
  +{ TKMPointAppearenceList }
   procedure TKMPointAppearenceList.Add(const aLoc: TKMPoint);
   var
     Ind: Integer;
  
positive.code: 
    TKMPointListArray = array of TKMPointList;
  
    TKMPointTagList = class(TKMPointList)
    public
      Tag, Tag2: array of Cardinal; //0..Count-1
  
negative.code: end;
  
  
  { TKMPointDirCenteredList }
  constructor TKMPointDirCenteredList.Create(aCenter: TKMPoint);
  begin
    inherited Create;
    fCenter := aCenter;
  end;
  
  
  procedure TKMPointDirCenteredList.Add(const aLoc: TKMPointDir);
  begin
    inherited;
  
    if fCount >= Length(fWeight) then
      SetLength(fWeight, fCount + 32);
  
    fWeight[fCount - 1] := 1000 / KMLengthSqr(fCenter, aLoc.Loc); //smaller weight for distant locs
  end;
  
  
  function TKMPointDirCenteredList.GetWeightedRandom(out Point: TKMPointDir): Boolean;
  var
    I: Integer;
    WeightsSum, Rnd: Extended;
  begin
    Result := False;
  
    if Count = 0 then
      Exit;
  
    WeightsSum := 0;
    for I := 0 to fCount - 1 do
      WeightsSum := WeightsSum + fWeight[I];
  
    Rnd := KaMRandomS1(WeightsSum, 'TKMPointDirCenteredList.GetWeightedRandom');
  
    for I := 0 to fCount - 1 do
    begin
      if Rnd < fWeight[I] then
      begin
        Point := fItems[I];
        Exit(True);
      end;
      Rnd := Rnd - fWeight[I];
    end;
    Assert(False, 'Error getting weighted random');
  end;
  
  
  { TKMPointDirTagList }
  procedure TKMPointDirTagList.Add(const aLoc: TKMPointDir; aTag: Cardinal);
  begin
    inherited Add(aLoc);
  