Advertisement
Guest User

bot

a guest
Jul 15th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <cmath>
  6. #include <ctime>
  7.  
  8. using namespace std;
  9.  
  10. /**
  11. * Auto-generated code below aims at helping you parse
  12. * the standard input according to the problem statement.
  13. **/
  14. int main()
  15. {
  16. // game loop
  17. while (1) {
  18. string thrust;
  19. int x;
  20. int y;
  21. int nextCheckpointX; // x position of the next check point
  22. int nextCheckpointY; // y position of the next check point
  23. int nextCheckpointDist; // distance to the next checkpoint
  24. int nextCheckpointAngle; // angle between your pod orientation and the direction of the next checkpoint
  25. cin >> x >> y >> nextCheckpointX >> nextCheckpointY >> nextCheckpointDist >> nextCheckpointAngle; cin.ignore();
  26. int opponentX;
  27. int opponentY;
  28. cin >> opponentX >> opponentY; cin.ignore();
  29.  
  30. int targetX;
  31. int targetY;
  32.  
  33. srand( time( NULL ) );
  34. int liczba = ( rand() % 120 ) + 50;
  35.  
  36. // Write an action using cout. DON'T FORGET THE "<< endl"
  37. // To debug: cerr << "Debug messages..." << endl;
  38.  
  39. int diffDist = sqrt( pow((x - opponentX), 2) + pow((y - opponentY), 2) );
  40.  
  41. int oppDistToPoint = sqrt( pow((nextCheckpointX - opponentX), 2) + pow((nextCheckpointY - opponentY), 2) );
  42.  
  43. if ( (nextCheckpointAngle > 100) || (nextCheckpointAngle < -100) ){
  44. thrust = "0";
  45. targetX = (nextCheckpointX + liczba);
  46. targetY = (nextCheckpointY + liczba);
  47. cout << targetX << " " << targetY << " " << thrust << endl;
  48. } else if( nextCheckpointDist < 1000 ){
  49. targetX = (nextCheckpointX + liczba);
  50. targetY = (nextCheckpointY + liczba);
  51. cout << targetX << " " << targetY << " " << 40 << endl;
  52. } else if ( (nextCheckpointDist < oppDistToPoint) && (nextCheckpointAngle < 20) || (nextCheckpointAngle > -20) ){
  53. thrust = "BOOST";
  54. targetX = (nextCheckpointX + liczba);
  55. targetY = (nextCheckpointY + liczba);
  56. cout << targetX << " " << targetY << " " << thrust << endl;
  57. } else if ( (abs(x-opponentX) < 300) && (abs(y-opponentY) < 300) ){
  58. thrust = "SHIELD";
  59. targetX = (nextCheckpointX + liczba);
  60. targetY = (nextCheckpointY + liczba);
  61. cout << targetX << " " << targetY << " " << thrust << endl;
  62. } else {
  63. targetX = (nextCheckpointX + liczba);
  64. targetY = (nextCheckpointY + liczba);
  65. cout << targetX << " " << targetY << " " << 100 << endl;
  66. }
  67.  
  68. cerr << "oppDistToPoint: " << oppDistToPoint << endl;
  69. cerr << "nextCheckpointDist: " << nextCheckpointDist << endl;
  70. cerr << "nextCheckpointX: " << nextCheckpointX << endl;
  71. cerr << "nextCheckpointY: " << nextCheckpointY << endl;
  72. cerr << "targetX: " << targetX << endl;
  73. cerr << "targetY: " << targetY << endl;
  74. cerr << "thrust: " << thrust << endl;
  75. cerr << "diffDist: " << diffDist << endl;
  76.  
  77. /*
  78. if ( (nextCheckpointDist < oppDistToPoint) && (nextCheckpointAngle < 50) || (nextCheckpointAngle > -50) ){
  79. thrust = "BOOST";
  80. cout << nextCheckpointX << " " << nextCheckpointY << " " << thrust << endl;
  81. }
  82. */
  83.  
  84.  
  85. // You have to output the target position
  86. // followed by the power (0 <= thrust <= 100)
  87. // i.e.: "x y thrust"
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement