anchor.diff:  // 2. Fraction = fraction of required and available houses
   procedure TKMCityPredictor.UpdateWareDerivation(aWT: TKMWareType; aInitialization: Boolean = False);
   var
  -  HouseReqCnt: Integer;
  +  houseReqCnt: Integer;
     HT: TKMHouseType;
   begin
     HT := PRODUCTION_WARE2HOUSE[aWT];
  
positive.code:   INV_REQUIRED_TILES_PER_WOOD = 1/450.0;
    TILE_RESERVE = 1000;
  var
    MaxIronWeapProd, MaxWoodWeapProd, FreePlace: Single;
    WT: TKMWareType;
  begin
    // Update peace factor
    fUpdatedPeaceFactor := Min(1,fUpdatedPeaceFactor + aIncPeaceFactor);
    // Consider available space around loc
    // Iron weapons - use only fixed peace factor because mines will run out anyway
    FreePlace := Max( 0,
                      (Min(fBuildCnt,2000) - TILE_RESERVE) * INV_REQUIRED_TILES_PER_IRON
                    );
    MaxIronWeapProd := Min( Min( MAX_IRON_PRODUCTION, fIronMineCnt ),
                            Round(FreePlace * fPeaceFactor) + MIN_IRON_PRODUCTION
                          );
    // Wooden weapons
    FreePlace := Max( 0,
                      (Min(fFieldCnt,3000) - TILE_RESERVE) * INV_REQUIRED_TILES_PER_WOOD
                    );
    MaxWoodWeapProd := Min( MAX_WOOD_PRODUCTION,
                            Max( MIN_WOOD_PRODUCTION, Round(FreePlace * fUpdatedPeaceFactor) )
                          );
    // Consider Iron production
    MaxWoodWeapProd := Max( MIN_WOOD_PRODUCTION - Byte(MaxIronWeapProd > 0),
                            Round(MaxWoodWeapProd - MaxIronWeapProd * (1.0 - fUpdatedPeaceFactor) * 0.5)
                          );
  
    // Iron weapons
    MaxIronWeapProd := MaxIronWeapProd * PRODUCTION_RATE[wtIronOre] * 0.5; // Division into half because of iron weapon and armor
    for WT in IRON_WARFARE do
      fWareBalance[WT].FinalConsumption := MaxIronWeapProd;
  
    // Wooden weapons
    MaxWoodWeapProd := MaxWoodWeapProd * PRODUCTION_RATE[wtAxe]; // Production of weapons / armors is ~identical
    for WT in WOOD_WARFARE do
      fWareBalance[WT].FinalConsumption := MaxWoodWeapProd;
    // Exceptions
    fWareBalance[wtLeatherArmor].FinalConsumption := MaxWoodWeapProd;
    fWareBalance[wtWoodenShield].FinalConsumption := MaxWoodWeapProd / 5; // This only affect wood requirements, shields will be ordered by count of axes
  
    // Soldiers / min (only expected not final value)
    fMaxSoldiersInMin := MaxWoodWeapProd + MaxIronWeapProd;
    // Maybe there is no need to keep variable fMaxSoldiersInMin but I am afraid what scripters may do with fSetup
    if (fSetup.NewAI AND fSetup.UnlimitedEquip) then
    begin
      fSetup.EquipRateIron := Round(600 / Max(0.01, MaxIronWeapProd));
      fSetup.EquipRateLeather := Round(600 / Max(0.01, MaxWoodWeapProd));
    end;
  
    // Predict final city stats (by potential size of city)
  
negative.code:     Exhaustion := 99;
      if (ActualConsumption - Production > 0) then
        Exhaustion := Min( Exhaustion, gHands[fOwner].Stats.GetWareBalance(aWT) / (ActualConsumption - Production) );
      houseReqCnt := Ceil(( Max(ActualConsumption, FinalConsumption) - Production) / Max(0.0001, PRODUCTION_RATE[aWT]*1.0));
      Fraction := houseReqCnt / Max(1.0,((fCityStats.Houses[HT] + houseReqCnt)*1.0));
    end;
    RequiredHouses[HT] := houseReqCnt;
  end;
  
  
  