hedgewars/uAIAmmoTests.pas
changeset 7274 a07777b818f1
parent 7212 ab60dbe8fd0c
child 7348 2a69f2ed9273
equal deleted inserted replaced
7272:71df899c4163 7274:a07777b818f1
   159             x:= x + dX;
   159             x:= x + dX;
   160             y:= y + dY;
   160             y:= y + dY;
   161             dX:= dX + windSpeed;
   161             dX:= dX + windSpeed;
   162             dY:= dY + cGravityf;
   162             dY:= dY + cGravityf;
   163             dec(t)
   163             dec(t)
   164         until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0);
   164         until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or 
       
   165                ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (t <= 0);
   165         
   166         
   166         EX:= trunc(x);
   167         EX:= trunc(x);
   167         EY:= trunc(y);
   168         EY:= trunc(y);
   168         if Me^.Hedgehog^.BotLevel = 1 then
   169         if Me^.Hedgehog^.BotLevel = 1 then
   169             value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   170             value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   217             x:= x + dX;
   218             x:= x + dX;
   218             y:= y + dY;
   219             y:= y + dY;
   219             dX:= dX + windSpeed;
   220             dX:= dX + windSpeed;
   220             dY:= dY + cGravityf;
   221             dY:= dY + cGravityf;
   221             dec(t)
   222             dec(t)
   222         until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0);
   223         until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or 
       
   224                ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (t <= 0);
   223         EX:= trunc(x);
   225         EX:= trunc(x);
   224         EY:= trunc(y);
   226         EY:= trunc(y);
   225 
   227 
   226         value:= RateShove(Me, trunc(x), trunc(y), 5, 1, trunc((abs(dX)+abs(dY))*20), -dX, -dY, afTrackFall);
   228         value:= RateShove(Me, trunc(x), trunc(y), 5, 1, trunc((abs(dX)+abs(dY))*20), -dX, -dY, afTrackFall);
   227         if value = 0 then
   229         if value = 0 then
   267         repeat
   269         repeat
   268             x:= x + Vx;
   270             x:= x + Vx;
   269             y:= y + dY;
   271             y:= y + dY;
   270             dY:= dY + cGravityf;
   272             dY:= dY + cGravityf;
   271             dec(t)
   273             dec(t)
   272         until TestCollExcludingMe(Me, trunc(x), trunc(y), 7) or (t = 0);
   274         until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 6)) or 
       
   275                ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 6))) or (t = 0);
   273         EX:= trunc(x);
   276         EX:= trunc(x);
   274         EY:= trunc(y);
   277         EY:= trunc(y);
   275         if t < 50 then
   278         if t < 50 then
   276             Score:= RateExplosion(Me, EX, EY, 97)  // average of 17 attempts, most good, but some failing spectacularly
   279             Score:= RateExplosion(Me, EX, EY, 97)  // average of 17 attempts, most good, but some failing spectacularly
   277         else
   280         else
   319         repeat
   322         repeat
   320             x:= x + Vx;
   323             x:= x + Vx;
   321             y:= y + dY;
   324             y:= y + dY;
   322             dY:= dY + cGravityf;
   325             dY:= dY + cGravityf;
   323             dec(t)
   326             dec(t)
   324         until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t = 0);
   327         until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or 
       
   328                ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (t = 0);
   325     EX:= trunc(x);
   329     EX:= trunc(x);
   326     EY:= trunc(y);
   330     EY:= trunc(y);
   327     if t < 50 then 
   331     if t < 50 then 
   328         if Me^.Hedgehog^.BotLevel = 1 then
   332         if Me^.Hedgehog^.BotLevel = 1 then
   329             Score:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   333             Score:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   378     repeat
   382     repeat
   379         x:= x + Vx;
   383         x:= x + Vx;
   380         y:= y + dY;
   384         y:= y + dY;
   381         dY:= dY + cGravityf;
   385         dY:= dY + cGravityf;
   382         dec(t)
   386         dec(t)
   383     until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t = 0);
   387     until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or 
       
   388            ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (t = 0);
   384     EX:= trunc(x);
   389     EX:= trunc(x);
   385     EY:= trunc(y);
   390     EY:= trunc(y);
   386     if t < 50 then 
   391     if t < 50 then 
   387         Score:= RateExplosion(Me, EX, EY, 41)
   392         Score:= RateExplosion(Me, EX, EY, 41)
   388     else 
   393     else 
   430         repeat
   435         repeat
   431             x:= x + Vx;
   436             x:= x + Vx;
   432             y:= y + dY;
   437             y:= y + dY;
   433             dY:= dY + cGravityf;
   438             dY:= dY + cGravityf;
   434             dec(t)
   439             dec(t)
   435         until TestCollExcludingMe(Me, trunc(x), trunc(y), 7) or (t = 0);
   440        until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 6)) or 
       
   441                ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 6))) or (t = 0);
   436         
   442         
   437         EX:= trunc(x);
   443         EX:= trunc(x);
   438         EY:= trunc(y);
   444         EY:= trunc(y);
   439         if t < 50 then 
   445         if t < 50 then 
   440             Score:= RateExplosion(Me, EX, EY, 200) + RateExplosion(Me, EX, EY + 120, 200)
   446             Score:= RateExplosion(Me, EX, EY, 200) + RateExplosion(Me, EX, EY + 120, 200)
   509         x:= x + Vx;
   515         x:= x + Vx;
   510         y:= y + dY;
   516         y:= y + dY;
   511         dY:= dY + cGravityf;
   517         dY:= dY + cGravityf;
   512         EX:= trunc(x);
   518         EX:= trunc(x);
   513         EY:= trunc(y);
   519         EY:= trunc(y);
   514     until TestCollExcludingMe(Me, EX, EY, 5) or (EY > cWaterLine);
   520     until (((Me = CurrentHedgehog^.Gear) and TestColl(EX, EY, 4)) or 
       
   521            ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, EX, EY, 4))) or (EY > cWaterLine);
   515 
   522 
   516     if (EY < cWaterLine) and (dY >= 0) then
   523     if (EY < cWaterLine) and (dY >= 0) then
   517         begin
   524         begin
   518         Score:= RateExplosion(Me, EX, EY, 91);
   525         Score:= RateExplosion(Me, EX, EY, 91);
   519         if (Score = 0) then
   526         if (Score = 0) then
   562 repeat
   569 repeat
   563     x:= x + vX;
   570     x:= x + vX;
   564     y:= y + vY;
   571     y:= y + vY;
   565     rx:= trunc(x);
   572     rx:= trunc(x);
   566     ry:= trunc(y);
   573     ry:= trunc(y);
   567     if TestCollExcludingMe(Me, rx, ry, 2) then
   574     if ((Me = CurrentHedgehog^.Gear) and TestColl(rx, ry, 2)) or 
       
   575         ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, rx, ry, 2)) then
   568     begin
   576     begin
   569         x:= x + vX * 8;
   577         x:= x + vX * 8;
   570         y:= y + vY * 8;
   578         y:= y + vY * 8;
   571         valueResult:= RateShotgun(Me, vX, vY, rx, ry);
   579         valueResult:= RateShotgun(Me, vX, vY, rx, ry);
   572      
   580