hedgewars/uAI.pas
changeset 8965 b4f10ff6ea90
parent 8959 ad680848a5c9
child 9003 896c6b21c87f
equal deleted inserted replaced
8964:962ede906da1 8965:b4f10ff6ea90
   484 SDL_LockMutex(ThreadLock);
   484 SDL_LockMutex(ThreadLock);
   485 ThinkThread:= SDL_CreateThread(@Think{$IFDEF SDL13}, 'think'{$ENDIF}, Me);
   485 ThinkThread:= SDL_CreateThread(@Think{$IFDEF SDL13}, 'think'{$ENDIF}, Me);
   486 SDL_UnlockMutex(ThreadLock);
   486 SDL_UnlockMutex(ThreadLock);
   487 end;
   487 end;
   488 
   488 
   489 //var scoreShown: boolean = false;
   489 {$IFDEF DEBUGAI}
       
   490 var scoreShown: boolean = false;
       
   491 {$ENDIF}
   490 
   492 
   491 procedure ProcessBot;
   493 procedure ProcessBot;
   492 const cStopThinkTime = 40;
   494 const cStopThinkTime = 40;
   493 begin
   495 begin
   494 with CurrentHedgehog^ do
   496 with CurrentHedgehog^ do
   506                     end;
   508                     end;
   507 
   509 
   508                 if Gear^.Message <> 0 then
   510                 if Gear^.Message <> 0 then
   509                     exit;
   511                     exit;
   510 
   512 
   511                 //scoreShown:= false;
   513 {$IFDEF DEBUGAI}
       
   514                 scoreShown:= false;
       
   515 {$ENDIF}
   512                 StartThink(Gear);
   516                 StartThink(Gear);
   513                 StartTicks:= GameTicks
   517                 StartTicks:= GameTicks
   514 
   518 
   515             end else
   519             end else
   516                 begin
   520                 begin
   517                 {if not scoreShown then
   521 {$IFDEF DEBUGAI}
       
   522                 if not scoreShown then
   518                     begin
   523                     begin
   519                     if BestActions.Score > 0 then ParseCommand('/say Expected score = ' + inttostr(BestActions.Score div 1024), true);
   524                     if BestActions.Score > 0 then ParseCommand('/say Expected score = ' + inttostr(BestActions.Score div 1024), true);
   520                     scoreShown:= true
   525                     scoreShown:= true
   521                     end;}
   526                     end;
       
   527 {$ENDIF}
   522                 ProcessAction(BestActions, Gear)
   528                 ProcessAction(BestActions, Gear)
   523                 end
   529                 end
   524         else if ((GameTicks - StartTicks) > cMaxAIThinkTime)
   530         else if ((GameTicks - StartTicks) > cMaxAIThinkTime)
   525             or (TurnTimeLeft <= cStopThinkTime) then
   531             or (TurnTimeLeft <= cStopThinkTime) then
   526                 StopThinking:= true
   532                 StopThinking:= true