-
Notifications
You must be signed in to change notification settings - Fork 0
/
codersStrikeBack2.txt
48 lines (40 loc) · 1.74 KB
/
codersStrikeBack2.txt
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
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
class Player
{
static void Main(string[] args)
{
string[] inputs;
// game loop
while (true)
{
inputs = Console.ReadLine().Split(' ');
int x = int.Parse(inputs[0]);
int y = int.Parse(inputs[1]);
int nextCheckpointX = int.Parse(inputs[2]); // x position of the next check point
int nextCheckpointY = int.Parse(inputs[3]); // y position of the next check point
int nextCheckpointDist = int.Parse(inputs[4]); // distance to the next checkpoint
int nextCheckpointAngle = int.Parse(inputs[5]); // angle between your pod orientation and the direction of the next checkpoint
inputs = Console.ReadLine().Split(' ');
int opponentX = int.Parse(inputs[0]);
int opponentY = int.Parse(inputs[1]);
// Write an action using Console.WriteLine()
// To debug: Console.Error.WriteLine("Debug messages...");
// You have to output the target position
// followed by the power (0 <= thrust <= 100)
// i.e.: "x y thrust"
double thrust = Math.Sqrt(Math.Pow(Math.Abs(nextCheckpointX-x),2) + Math.Pow(Math.Abs(nextCheckpointY-y),2));
if(nextCheckpointAngle > 90 || nextCheckpointAngle < -90) thrust = 0 ;
else if(thrust > 100) thrust = 100;
Console.WriteLine(nextCheckpointX + " " + nextCheckpointY +" "+ Convert.ToInt32(thrust));
}
}
}