Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- #include <ctime>
- using namespace std;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- int main()
- {
- // game loop
- while (1) {
- string thrust;
- int x;
- int y;
- int nextCheckpointX; // x position of the next check point
- int nextCheckpointY; // y position of the next check point
- int nextCheckpointDist; // distance to the next checkpoint
- int nextCheckpointAngle; // angle between your pod orientation and the direction of the next checkpoint
- cin >> x >> y >> nextCheckpointX >> nextCheckpointY >> nextCheckpointDist >> nextCheckpointAngle; cin.ignore();
- int opponentX;
- int opponentY;
- cin >> opponentX >> opponentY; cin.ignore();
- int targetX;
- int targetY;
- srand( time( NULL ) );
- int liczba = ( rand() % 120 ) + 50;
- // Write an action using cout. DON'T FORGET THE "<< endl"
- // To debug: cerr << "Debug messages..." << endl;
- int diffDist = sqrt( pow((x - opponentX), 2) + pow((y - opponentY), 2) );
- int oppDistToPoint = sqrt( pow((nextCheckpointX - opponentX), 2) + pow((nextCheckpointY - opponentY), 2) );
- if ( (nextCheckpointAngle > 100) || (nextCheckpointAngle < -100) ){
- thrust = "0";
- targetX = (nextCheckpointX + liczba);
- targetY = (nextCheckpointY + liczba);
- cout << targetX << " " << targetY << " " << thrust << endl;
- } else if( nextCheckpointDist < 1000 ){
- targetX = (nextCheckpointX + liczba);
- targetY = (nextCheckpointY + liczba);
- cout << targetX << " " << targetY << " " << 40 << endl;
- } else if ( (nextCheckpointDist < oppDistToPoint) && (nextCheckpointAngle < 20) || (nextCheckpointAngle > -20) ){
- thrust = "BOOST";
- targetX = (nextCheckpointX + liczba);
- targetY = (nextCheckpointY + liczba);
- cout << targetX << " " << targetY << " " << thrust << endl;
- } else if ( (abs(x-opponentX) < 300) && (abs(y-opponentY) < 300) ){
- thrust = "SHIELD";
- targetX = (nextCheckpointX + liczba);
- targetY = (nextCheckpointY + liczba);
- cout << targetX << " " << targetY << " " << thrust << endl;
- } else {
- targetX = (nextCheckpointX + liczba);
- targetY = (nextCheckpointY + liczba);
- cout << targetX << " " << targetY << " " << 100 << endl;
- }
- cerr << "oppDistToPoint: " << oppDistToPoint << endl;
- cerr << "nextCheckpointDist: " << nextCheckpointDist << endl;
- cerr << "nextCheckpointX: " << nextCheckpointX << endl;
- cerr << "nextCheckpointY: " << nextCheckpointY << endl;
- cerr << "targetX: " << targetX << endl;
- cerr << "targetY: " << targetY << endl;
- cerr << "thrust: " << thrust << endl;
- cerr << "diffDist: " << diffDist << endl;
- /*
- if ( (nextCheckpointDist < oppDistToPoint) && (nextCheckpointAngle < 50) || (nextCheckpointAngle > -50) ){
- thrust = "BOOST";
- cout << nextCheckpointX << " " << nextCheckpointY << " " << thrust << endl;
- }
- */
- // You have to output the target position
- // followed by the power (0 <= thrust <= 100)
- // i.e.: "x y thrust"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement