Advertisement
ShirakamiKuroko

Bronze - Coders_Strike_Back bad code

Jun 5th, 2021
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Auto-generated code below aims at helping you parse
  3.  * the standard input according to the problem statement.
  4.  **/
  5.  
  6.  
  7. // game loop
  8. while (true) {
  9.     var inputs = readline().split(' ');
  10.     const x = parseInt(inputs[0]);
  11.     const y = parseInt(inputs[1]);
  12.     const nextCheckpointX = parseInt(inputs[2]); // x position of the next check point
  13.     const nextCheckpointY = parseInt(inputs[3]); // y position of the next check point
  14.     const nextCheckpointDist = parseInt(inputs[4]); // distance to the next checkpoint
  15.     const nextCheckpointAngle = parseInt(inputs[5]); // angle between your pod orientation and the direction of the next checkpoint
  16.     var inputs = readline().split(' ');
  17.     const opponentX = parseInt(inputs[0]);
  18.     const opponentY = parseInt(inputs[1]);
  19.  
  20.     // Write an action using console.log()
  21.     // To debug: console.error('Debug messages...');
  22.     var a = Math.sin(nextCheckpointAngle * Math.PI / 180) * nextCheckpointDist;
  23.     var b = Math.cos(nextCheckpointAngle * Math.PI / 180) * nextCheckpointDist;
  24.  
  25.     // You have to output the target position
  26.     // followed by the power (0 <= thrust <= 100)
  27.     // i.e.: "x y thrust"
  28.    
  29.     if (nextCheckpointAngle > 90 || nextCheckpointAngle < -90) {
  30.             console.log(nextCheckpointX + ' ' + nextCheckpointY + ' 1');
  31.         } else if (nextCheckpointDist > 9000) {
  32.             while (a + b  > nextCheckpointDist) {
  33.                 console.log(nextCheckpointX + ' ' + nextCheckpointY + ' 0');
  34.             }
  35.             console.log(nextCheckpointX + ' ' + nextCheckpointY + ' BOOST');
  36.         } else {
  37.             console.log(nextCheckpointX + ' ' + nextCheckpointY + ' 100');
  38.     }
  39.  
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement