hedgewars/uAI.pas
changeset 544 9e068d2398ca
parent 543 465e2ec8f05f
child 545 f527450337c1
equal deleted inserted replaced
543:465e2ec8f05f 544:9e068d2398ca
   206     Pop(ticks, Actions, Me^);
   206     Pop(ticks, Actions, Me^);
   207 
   207 
   208     AddAction(Actions, Me^.Message, aim_push, 250, 0, 0);
   208     AddAction(Actions, Me^.Message, aim_push, 250, 0, 0);
   209     if (Me^.Message and gm_Left) <> 0 then AddAction(Actions, aia_WaitXL, hwRound(Me^.X), 0, 0, 0)
   209     if (Me^.Message and gm_Left) <> 0 then AddAction(Actions, aia_WaitXL, hwRound(Me^.X), 0, 0, 0)
   210                                       else AddAction(Actions, aia_WaitXR, hwRound(Me^.X), 0, 0, 0);
   210                                       else AddAction(Actions, aia_WaitXR, hwRound(Me^.X), 0, 0, 0);
   211     AddAction(Actions, Me^.Message, aim_release, 0, 0, 0);
       
   212     steps:= 0;
   211     steps:= 0;
   213 
   212 
   214     while (not StopThinking) and (not PosInThinkStack(Me)) do
   213     while (not StopThinking) and (not PosInThinkStack(Me)) do
   215        begin
   214        begin
   216        CanGo:= HHGo(Me, @AltMe, GoInfo);
   215        CanGo:= HHGo(Me, @AltMe, GoInfo);
   229              with Stack.States[Pred(Stack.Count)] do
   228              with Stack.States[Pred(Stack.Count)] do
   230                   AddAction(MadeActions, aia_LJump, 0, 305, 0, 0);
   229                   AddAction(MadeActions, aia_LJump, 0, 305, 0, 0);
   231 
   230 
   232        if not CanGo then break;
   231        if not CanGo then break;
   233        inc(steps);
   232        inc(steps);
   234        Actions.actions[Actions.Count - 2].Param:= hwRound(Me^.X);
   233        Actions.actions[Pred(Actions.Count)].Param:= hwRound(Me^.X);
   235        Rate:= RatePlace(Me);
   234        Rate:= RatePlace(Me);
   236        if Rate > BestRate then
   235        if Rate > BestRate then
   237           begin
   236           begin
   238           BestActions:= Actions;
   237           BestActions:= Actions;
   239           BestRate:= Rate;
   238           BestRate:= Rate;