84 if Actions.Score + Score > BestActions.Score then |
84 if Actions.Score + Score > BestActions.Score then |
85 if (BestActions.Score < 0) or (Actions.Score + Score > BestActions.Score + Byte(BotLevel) * 2048) then |
85 if (BestActions.Score < 0) or (Actions.Score + Score > BestActions.Score + Byte(BotLevel) * 2048) then |
86 begin |
86 begin |
87 BestActions:= Actions; |
87 BestActions:= Actions; |
88 inc(BestActions.Score, Score); |
88 inc(BestActions.Score, Score); |
|
89 addfilelog('AI: curr score ' + inttostr(bestactions.score)); |
89 |
90 |
90 if (ap.Angle > 0) then AddAction(BestActions, aia_LookRight, 0, 200, 0, 0) |
91 if (ap.Angle > 0) then AddAction(BestActions, aia_LookRight, 0, 200, 0, 0) |
91 else if (ap.Angle < 0) then AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0); |
92 else if (ap.Angle < 0) then AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0); |
92 |
93 |
93 AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0); |
94 AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0); |
280 WalkMe:= BackMe; |
281 WalkMe:= BackMe; |
281 Walk(@WalkMe); |
282 Walk(@WalkMe); |
282 if (StartTicks > GameTicks - 1500) and not StopThinking then SDL_Delay(2000); |
283 if (StartTicks > GameTicks - 1500) and not StopThinking then SDL_Delay(2000); |
283 if BestActions.Score < -1023 then |
284 if BestActions.Score < -1023 then |
284 begin |
285 begin |
|
286 addfilelog('AI: best score ' + inttostr(bestactions.score)); |
285 BestActions.Count:= 0; |
287 BestActions.Count:= 0; |
286 AddAction(BestActions, aia_Skip, 0, 250, 0, 0); |
288 AddAction(BestActions, aia_Skip, 0, 250, 0, 0); |
287 end; |
289 end; |
288 end else |
290 end else |
289 else begin |
291 else begin |