-
Notifications
You must be signed in to change notification settings - Fork 1
/
my_tank2.pas
67 lines (50 loc) · 1.01 KB
/
my_tank2.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
unit my_tank2;
interface
uses
Graphics,
strategy_utils,
tanks,
world,
globals,
bonus,
weapon,
Math,
SysUtils;
const MAX_TIMER=44;
type
TBorisCleverTank=class(TTank)
public
timer:integer;
procedure get_actions;override;
procedure Init; override;
function getTankColor:TColor;override;
end;
implementation
{ TMyTank }
procedure TBorisCleverTank.Init;
begin
timer:=0;
end;
procedure TBorisCleverTank.get_actions;
var enemy_tank:TTank;
begin
if getWorld.tanks.Count=1 then use_breaks;
enemy_tank:=findTank(Self,[WEAKEST_TANK]);
if Assigned(enemy_tank) then
if enemy_tank<>Self then
begin
turnTo(enemy_tank);
if abs(getDAlfa)<Pi/18 then fire;
end;
{ inc(timer);
if timer>MAX_TIMER then
begin
rotate(getAlfa() +2*pi*(random(132)/132));
timer:=0;
end;}
end;
function TBorisCleverTank.getTankColor: TColor;
begin
Result:=clGreen
end;
end.