merge
authorunc0rr
Fri, 27 Jul 2012 20:45:02 +0400
changeset 7456 823bd65ef095
parent 7445 891209020113 (current diff)
parent 7453 92bdcd69bf2a (diff)
child 7459 8511a3f899d3
merge
--- a/hedgewars/uAI.pas	Fri Jul 27 10:47:23 2012 -0400
+++ b/hedgewars/uAI.pas	Fri Jul 27 20:45:02 2012 +0400
@@ -178,9 +178,12 @@
                         begin
                         AddAction(BestActions, aia_attack, aim_push, 350 + random(200), 0, 0);
                         AddAction(BestActions, aia_attack, aim_release, 1, 0, 0);
-                                                
-                        AddAction(BestActions, aia_Down, aim_push, 100 + random(150), 0, 0);
-                        AddAction(BestActions, aia_Down, aim_release, 32, 0, 0);
+                         
+                        if abs(ap.Angle) > 32 then
+                           begin
+                           AddAction(BestActions, aia_Down, aim_push, 100 + random(150), 0, 0);
+                           AddAction(BestActions, aia_Down, aim_release, 32, 0, 0);
+                           end;
                         
                         AddAction(BestActions, aia_waitAngle, ap.Angle, 250, 0, 0);
                         AddAction(BestActions, aia_attack, aim_push, 1, 0, 0);
@@ -274,7 +277,8 @@
                 break;
 
             if (BotLevel < 5) and (GoInfo.JumpType = jmpHJump) then // hjump support
-                if Push(ticks, Actions, AltMe, Me^.Message) then
+                // check if we could go backwards and maybe ljump over a gap after this hjump
+                if Push(ticks, Actions, AltMe, Me^.Message xor 3) then
                     begin
                     with Stack.States[Pred(Stack.Count)] do
                         begin
@@ -291,9 +295,8 @@
                         else
                             AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0);
                         end;
-                    
-                    // check if we could go backwards and maybe ljump over a gap after this hjump
-                    Push(ticks, Stack.States[Pred(Stack.Count)].MadeActions, AltMe, Me^.Message xor 3)
+                    // but first check walking forward
+                    Push(ticks, Stack.States[Pred(Stack.Count)].MadeActions, AltMe, Me^.Message)
                     end;
             if (BotLevel < 3) and (GoInfo.JumpType = jmpLJump) then // ljump support
                 begin
--- a/hedgewars/uAIAmmoTests.pas	Fri Jul 27 10:47:23 2012 -0400
+++ b/hedgewars/uAIAmmoTests.pas	Fri Jul 27 20:45:02 2012 +0400
@@ -361,12 +361,12 @@
     t: LongInt;
 begin
 valueResult:= BadTurn;
-TestTime:= 0;
+TestTime:= 500;
 ap.ExplR:= 0;
 meX:= hwFloat2Float(Me^.X);
 meY:= hwFloat2Float(Me^.Y);
 repeat
-    inc(TestTime, 1000);
+    inc(TestTime, 900);
     // Try to overshoot slightly, seems to pay slightly better dividends in terms of hitting cluster
     if meX<Targ.X then
         Vx:= ((Targ.X+10) - meX) / (TestTime + tDelta)
@@ -398,14 +398,14 @@
         begin
         ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level));
         ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
-        ap.Time:= TestTime;
+        ap.Time:= TestTime div 1000 * 1000;
         ap.ExplR:= 90;
         ap.ExplX:= EX;
         ap.ExplY:= EY;
         valueResult:= Score
         end;
      end
-until (TestTime = 4000);
+until (TestTime = 4100);
 TestClusterBomb:= valueResult
 end;
 
@@ -418,12 +418,12 @@
     t: LongInt;
 begin
 valueResult:= BadTurn;
-TestTime:= 0;
+TestTime:= 500;
 ap.ExplR:= 0;
 meX:= hwFloat2Float(Me^.X);
 meY:= hwFloat2Float(Me^.Y);
 repeat
-    inc(TestTime, 1000);
+    inc(TestTime, 900);
     Vx:= (Targ.X - meX) / (TestTime + tDelta);
     Vy:= cGravityf * ((TestTime + tDelta) div 2) - ((Targ.Y-50) - meY) / (TestTime + tDelta);
     r:= sqr(Vx)+sqr(Vy);
@@ -452,14 +452,14 @@
             begin
             ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level));
             ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
-            ap.Time:= TestTime;
+            ap.Time:= TestTime div 1000 * 1000;
             ap.ExplR:= 300;
             ap.ExplX:= EX;
             ap.ExplY:= EY;
             valueResult:= Score
             end;
         end
-until (TestTime = 4000);
+until (TestTime = 4100);
 TestWatermelon:= valueResult
 end;
 
@@ -822,7 +822,7 @@
             , 30, 30, 25
             , -1, -0.8, trackFall or afSetSkip);
     v1:= v1 +
-        RateShove(Me, x, y
+        RateShove(Me, x - 2, y
             , 30, 30, 25
             , -1, -0.8, trackFall);
     // now try opposite direction
@@ -830,7 +830,7 @@
             , 30, 30, 25
             , 1, -0.8, trackFall or afSetSkip);
     v2:= v2 +
-        RateShove(Me, x, y
+        RateShove(Me, x + 2, y
             , 30, 30, 25
             , 1, -0.8, trackFall);