-
Notifications
You must be signed in to change notification settings - Fork 1
/
crazy_tank.pas
71 lines (52 loc) · 1.15 KB
/
crazy_tank.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
68
69
70
71
unit crazy_tank;
interface
uses
Graphics,
globals,
strategy_utils,
tanks,
tanks_geom,
world,
bonus,
geom,
weapon,
Math,
SysUtils;
const MAX_TIMER=44;
type
TCrazyTank=class(TTank)
public
procedure get_actions;override;
procedure Init; override;
function getTankColor:TColor;override;
end;
implementation
{ TMyTank }
procedure TCrazyTank.Init;
begin
end;
procedure TCrazyTank.get_actions;
var enemy_tank:TTank;
begin
if getWorld.tanks.Count=1 then use_breaks;
enemy_tank:=findTank(Self,[NEAREST_TANK]);
if Assigned(enemy_tank) then
if enemy_tank<>Self then
begin
turnTo(enemy_tank);
if distance(Self,enemy_tank)<3*tank_radius then
begin
if distance(Self,enemy_tank)<tank_radius then
use_breaks
else
// setAcceleration(MIN_ACCELERATION);
end;
if distance(Self,enemy_tank)>2*tank_radius then setAcceleration(MAX_ACCELERATION);
if abs(getDAlfa)<Pi/18 then fire;
end;
end;
function TCrazyTank.getTankColor: TColor;
begin
Result:=$abcd; //dark yellow
end;
end.