hedgewars/uAI.pas
changeset 5394 924584407e01
parent 5388 73ef8e437231
child 5396 4a0a8f32b7e3
equal deleted inserted replaced
5392:1840da0c1f1d 5394:924584407e01
   260            and ((steps mod 4) = 0) then TestAmmos(Actions, Me, true);
   260            and ((steps mod 4) = 0) then TestAmmos(Actions, Me, true);
   261        if GoInfo.FallPix >= FallPixForBranching then
   261        if GoInfo.FallPix >= FallPixForBranching then
   262           Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right
   262           Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right
   263        end;
   263        end;
   264 
   264 
       
   265     ThreadSwitch();
       
   266 
   265     if BestRate > BaseRate then exit
   267     if BestRate > BaseRate then exit
   266     end
   268     end
   267 end;
   269 end;
   268 
   270 
   269 function Think(Me: Pointer): ptrint;
   271 function Think(Me: Pointer): ptrint;
   277 if (PGear(Me)^.State and gstAttacked) = 0 then
   279 if (PGear(Me)^.State and gstAttacked) = 0 then
   278    if Targets.Count > 0 then
   280    if Targets.Count > 0 then
   279       begin
   281       begin
   280       WalkMe:= BackMe;
   282       WalkMe:= BackMe;
   281       Walk(@WalkMe);
   283       Walk(@WalkMe);
   282       if (StartTicks > GameTicks - 1500) and not StopThinking then SDL_Delay(2000);
   284       if (StartTicks > GameTicks - 1500) and not StopThinking then SDL_Delay(1000);
   283       if BestActions.Score < -1023 then
   285       if BestActions.Score < -1023 then
   284          begin
   286          begin
   285          addfilelog('AI: best score ' + inttostr(bestactions.score));
   287          addfilelog('AI: best score ' + inttostr(bestactions.score));
   286          BestActions.Count:= 0;
   288          BestActions.Count:= 0;
   287          AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   289          AddAction(BestActions, aia_Skip, 0, 250, 0, 0);