import java.util.ArrayList;
import java.util.List;

public class M416HeadshotAimbot {

  public static void main(String[] args) {

    double playerX = 100.0;
    double playerY = 200.0;
    double playerRotation = 0.0; 
    double targetX = 150.0;
    double targetY = 250.0;
    double shootingAccuracy = 0.8; 
    double gunRange = 200.0; 
    

    double targetAngle = calculateTargetAngle(playerX, playerY, targetX, targetY);
    
    
    double playerAngle = playerRotation;
    

    double rotationAngle = calculateRotationAngle(playerAngle, targetAngle);
    rotatePlayer(rotationAngle);
    

    double distanceToTarget = calculateDistance(playerX, playerY, targetX, targetY);
    
    if (distanceToTarget <= gunRange) {

      if (Math.random() <= shootingAccuracy) {
        shootTarget();
        System.out.println("Headshot!");
      } else {
        shootTarget();
        System.out.println("Failed headshot, but hit the target!");
      }
    } else {
      System.out.println("Target out of range!");
    }
  }
  
  private static double calculateTargetAngle(double playerX, double playerY, double targetX, double targetY) {

    double deltaX = targetX - playerX;
    double deltaY = targetY - playerY;
    double targetAngle = Math.atan2(deltaY, deltaX);
    return targetAngle;
  }
  
  private static double calculateRotationAngle(double playerAngle, double targetAngle) {
    double rotationAngle = targetAngle - playerAngle;
    return rotationAngle;
  }
  
  private static void rotatePlayer(double rotationAngle) {
  
    System.out.println("Rotate player by angle: " + rotationAngle);
  }
  
  private static double calculateDistance(double x1, double y1, double x2, double y2) {

    double distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
    return distance;
  }
  
  private static void shootTarget() {

    System.out.println("Shoot target!");
  }
  
}
