--- a/hedgewars/uAI.pas Tue Aug 09 20:56:34 2011 +0200
+++ b/hedgewars/uAI.pas Tue Aug 09 21:31:49 2011 +0200
@@ -66,7 +66,6 @@
Score, i: LongInt;
a, aa: TAmmoType;
begin
-WriteToConsole('testing ammo');
BotLevel:= Me^.Hedgehog^.BotLevel;
for i:= 0 to Pred(Targets.Count) do
@@ -75,10 +74,8 @@
with CurrentHedgehog^ do
a:= CurAmmoType;
aa:= a;
-WriteToConsole('start walking');
SDL_delay(0);
// ThreadSwitch();
-WriteToConsole('start walking');
repeat
if (CanUseAmmo[a]) and
@@ -207,25 +204,19 @@
tmp:= random(2) + 1;
Push(0, Actions, Me^, tmp);
Push(0, Actions, Me^, tmp xor 3);
-WriteToConsole('start walking');
if (Me^.State and gstAttacked) = 0 then maxticks:= Max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel))
else maxticks:= TurnTimeLeft;
-WriteToConsole('start walking');
if (Me^.State and gstAttacked) = 0 then TestAmmos(Actions, Me, false);
-WriteToConsole('start walking');
BestRate:= RatePlace(Me);
BaseRate:= Max(BestRate, 0);
-WriteToConsole('start walking');
if (Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
AddAction(Actions, aia_Weapon, Longword(amNothing), 100 + random(200), 0, 0);
-WriteToConsole('start walking');
while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do
begin
-WriteToConsole('start walking');
Pop(ticks, Actions, Me^);
AddAction(Actions, Me^.Message, aim_push, 250, 0, 0);
@@ -240,7 +231,6 @@
{$HINTS ON}
inc(ticks, GoInfo.Ticks);
if ticks > maxticks then break;
-WriteToConsole('start walking');
if (BotLevel < 5) and (GoInfo.JumpType = jmpHJump) then // hjump support
if Push(ticks, Actions, AltMe, Me^.Message) then
@@ -262,7 +252,6 @@
inc(steps);
Actions.actions[Pred(Actions.Count)].Param:= hwRound(Me^.X);
Rate:= RatePlace(Me);
-WriteToConsole('start walking');
if Rate > BestRate then
begin
BestActions:= Actions;
@@ -270,10 +259,8 @@
Me^.State:= Me^.State or gstAttacked // we have better place, go there and do not use ammo
end
else if Rate < BestRate then break;
-WriteToConsole('start walking');
if ((Me^.State and gstAttacked) = 0)
and ((steps mod 4) = 0) then TestAmmos(Actions, Me, true);
-WriteToConsole('start walking');
if GoInfo.FallPix >= FallPixForBranching then
Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right
end;
@@ -286,38 +273,27 @@
var BackMe, WalkMe: TGear;
StartTicks: Longword;
begin
-WriteToConsole('starting to think');
InterlockedIncrement(hasThread);
-WriteToConsole('bla');
StartTicks:= GameTicks;
-WriteToConsole('bla');
BackMe:= PGear(Me)^;
-WriteToConsole('bla');
if (PGear(Me)^.State and gstAttacked) = 0 then
if Targets.Count > 0 then
begin
-WriteToConsole('blaaa');
WalkMe:= BackMe;
-WriteToConsole('blaa');
Walk(@WalkMe);
-WriteToConsole('blaa');
if (StartTicks > GameTicks - 1500) and not StopThinking then SDL_Delay(1000);
- WriteToConsole('bla');
if BestActions.Score < -1023 then
begin
- WriteToConsole('bla');
BestActions.Count:= 0;
AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
- WriteToConsole('bla');
end;
end else
else begin
while (not StopThinking) and (BestActions.Count = 0) do
begin
-WriteToConsole('bla loop');
FillBonuses(true);
WalkMe:= BackMe;
Walk(@WalkMe);
@@ -326,10 +302,8 @@
end;
PGear(Me)^.State:= PGear(Me)^.State and not gstHHThinking;
Think:= 0;
-WriteToConsole('bla');
InterlockedDecrement(hasThread);
-WriteToConsole('bla end');
end;