-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathPlayer.js
More file actions
83 lines (67 loc) · 1.73 KB
/
Player.js
File metadata and controls
83 lines (67 loc) · 1.73 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
var areaRadius = 100;
function Point(){
this.x = 0;
this.y = 0;
}
function Drone(){
this.position = new Point();
}
function Zone(){
this.center = new Point();
this.ownerId = -1;
}
function Team(){
this.drones = new Array();
}
function Game(){
this.zones = new Array();
this.teams = new Array();
this.myTeamId;
}
Game.prototype.init = function() {
var inputs = readline().split(' ');
var p = parseInt(inputs[0]),
i = parseInt(inputs[1]),
d = parseInt(inputs[2]),
z = parseInt(inputs[3]);
this.myTeamId = i;
for(var areaId = 0; areaId < z; areaId++) {
var zone = new Zone();
var coords = readline().split(' ');
zone.center.x = parseInt(coords[0]);
zone.center.y = parseInt(coords[1]);
this.zones.push(zone);
}
for(var teamId = 0; teamId < p; teamId++) {
var t = new Team();
for(var droneId = 0; droneId < d; droneId++) {
var drone = new Drone();
t.drones.push(drone);
}
this.teams.push(t);
}
}
Game.prototype.run = function() {
while (true) {
this.zones.forEach(function(zone){
zone.ownerId = parseInt(readline());
});
this.teams.forEach(function(team){
team.drones.forEach(function(drone){
var coords = readline().split(' ');
drone.position.x = parseInt(coords[0]);
drone.position.y = parseInt(coords[1]);
});
});
this.play();
}
}
Game.prototype.play = function() {
var myDrones = this.teams[this.myTeamId].drones;
myDrones.forEach(function(drone){
print('3999 1799');
});
}
var g = new Game();
g.init();
g.run();