anchor.diff:    const
       RAD = 15;
     var
  -    X,Y: Integer;
  -    Price, BestPrice: Single;
  -    Loc,BestLoc: TKMPoint;
  -  begin
  -    BestPrice := 1e10;
  +    X, Y: Integer;
  +    price, bestPrice: Single;
  +    loc, bestLoc: TKMPoint;
  +  begin
  +    bestPrice := 1e10;
       for X := Max(1,aInitP.X-RAD) to Min(gTerrain.MapX-1,aInitP.X+RAD) do
       for Y := Max(1,aInitP.Y-RAD) to Min(gTerrain.MapY-1,aInitP.Y+RAD) do
         if gHands[fOwner].CanAddFieldPlan(KMPoint(X,Y+1), ftRoad) AND gHands[fOwner].CanAddHousePlanAI(X,Y,htStore,False) then
         begin
           //gTerrain.ScriptTrySetTileObject(X, Y, 0); // Debug (visualization)
  -        Loc := KMPoint(X,Y);
  -        Price :=
  -          + 6 * Byte(bStone) * KMDistanceSqr(Loc, Stone)
  +        loc := KMPoint(X,Y);
  +        price :=
  +          + 6 * Byte(bStone) * KMDistanceSqr(loc, Stone)
             + 50 * (Byte(gTerrain.TileIsCoal(X, Y) > 1) + Byte(gTerrain.TileIsCoal(X, Y-1) > 1) + Byte(gTerrain.TileIsCoal(X, Y-2) > 1))
  -          + 2 * Byte(bGold) * KMDistanceSqr(Loc, Gold)
  -          + 1 * Byte(bIron) * KMDistanceSqr(Loc, Iron)
  +          + 2 * Byte(bGold) * KMDistanceSqr(loc, Gold)
  +          + 1 * Byte(bIron) * KMDistanceSqr(loc, Iron)
             - 20 * ( Byte(gHands[fOwner].CanAddFieldPlan(KMPoint(X,Y+2), ftRoad)) + Byte(gHands[fOwner].CanAddFieldPlan(KMPoint(X+1,Y+1), ftRoad)) + Byte(gHands[fOwner].CanAddFieldPlan(KMPoint(X-1,Y+1), ftRoad)) );
   
  -        if (Price < BestPrice) then
  +        if (price < bestPrice) then
           begin
  -          BestPrice := Price;
  -          BestLoc := Loc;
  +          bestPrice := price;
  +          bestLoc := loc;
           end;
         end;
       // Place storehouse
  -    if (BestPrice < 1E10) then
  -      gHands[fOwner].AddFirstStorehouse(BestLoc);
  +    if (bestPrice < 1E10) then
  +      gHands[fOwner].AddFirstStorehouse(bestLoc);
     end;
   
   const
     MAX_DIST_FROM_STONES = 10;
   var
     bGold, bIron, bStone: Boolean;
  -  Gold, Iron, Stone, InitPoint: TKMPoint;
  +  gold, iron, stone, initPoint: TKMPoint;
   begin
     // Find the closest resource
  -  bGold := GetClosestResource(Gold, gAIFields.Eye.GoldLocs);
  -  bIron := GetClosestResource(Iron, gAIFields.Eye.IronLocs);
  -  bStone := GetClosestResource(Stone, gAIFields.Eye.StoneMiningTiles);
  +  bGold := GetClosestResource(gold, gAIFields.Eye.GoldLocs);
  +  bIron := GetClosestResource(iron, gAIFields.Eye.IronLocs);
  +  bStone := GetClosestResource(stone, gAIFields.Eye.StoneMiningTiles);
     // Apply logic
     if bStone then
     begin
       if bGold then
  -      InitPoint := KMPoint( Round((Stone.X*4+Gold.X*2+aLoc.X)/7), Round((Stone.Y*4+Gold.Y*2+aLoc.Y)/7) )
  +      initPoint := KMPoint( Round((stone.X*4+gold.X*2+aLoc.X)/7), Round((stone.Y*4+gold.Y*2+aLoc.Y)/7) )
       else if bIron then
  -      InitPoint := KMPoint( Round((Stone.X*4+Iron.X+aLoc.X)/6), Round((Stone.Y*4+Iron.Y+aLoc.Y)/6) )
  +      initPoint := KMPoint( Round((stone.X*4+iron.X+aLoc.X)/6), Round((stone.Y*4+iron.Y+aLoc.Y)/6) )
       else
  -      InitPoint := Stone;
  +      initPoint := stone;
     end
     else
     begin
       if bGold then
  -      InitPoint := Gold
  +      initPoint := gold
       else if bIron then
  -      InitPoint := Iron
  +      initPoint := iron
       else
         Exit;
     end;
     // Find place for store
  -  FindPlaceForStore(bStone, bGold, bIron, InitPoint, Stone, Gold, Iron);
  +  FindPlaceForStore(bStone, bGold, bIron, initPoint, stone, gold, iron);
   end;
   
   
  
positive.code: //Defeated player remains in place, but does no actions
  procedure TKMHandAI.Defeat(aShowDefeatMessage: Boolean = True);
  begin
    if fWonOrLost = wolNone then
    begin
      fWonOrLost := wolLost;
  
      //Let the game know
      gGame.PlayerDefeat(fOwner, aShowDefeatMessage);
  
      //Script may have additional event processors
      gScriptEvents.ProcPlayerDefeated(fOwner);
    end;
  end;
  
  
  
negative.code: // aUnit is our unit that was attacked
  procedure TKMHandAI.UnitAttackNotification(aUnit: TKMUnit; aAttacker: TKMUnit; aNotifyScript: Boolean = True);
  const
    NOTIFY_KIND: array [Boolean] of TAttackNotification = (anCitizens, anTroops);
  var
    I: Integer;
    group: TKMUnitGroup;
  begin
    case gHands[fOwner].HandType of
      hndHuman:
        //No fight alerts in replays, and only show alerts for ourselves
        if not gGame.Params.IsReplayOrSpectate
          and (fOwner = gMySpectator.HandID) then
          gGame.GamePlayInterface.Alerts.AddFight(aUnit.PositionF, fOwner, NOTIFY_KIND[aUnit is TKMUnitWarrior],
                                                  gGameApp.GlobalTickCount + ALERT_DURATION[atFight]);
      hndComputer:
        begin
  