/**
 * Given an enemy's current position in the Cartesian coordinate system and an angle,
 * rotate the enemy's position counterclockwise by the given angle in the polar coordinate system.
 *
 * @param enemyPosition A pair containing the enemy's current position (x, y) in the Cartesian coordinate system.
 * @param angle The angle in degrees by which to rotate the enemy's position.
 * @return A pair containing the enemy's rotated position (r, theta) in the polar coordinate system.
 */
fun rotateEnemy(enemyPosition: Pair<Double, Double>, angle: Double): Pair<Double, Double> {

    val (enemyX, enemyY) = enemyPosition
    val enemyPolarRadius = Math.sqrt(enemyX * enemyX + enemyY * enemyY)
    val enemyPolarAngle = Math.atan2(enemyY, enemyX)  // Calculate the angle in radians

    val newAngle = Math.toRadians(Math.toDegrees(enemyPolarAngle) + angle)  // Calculate the new angle in degrees after rotating counterclockwise

    val newX = enemyPolarRadius * Math.cos(newAngle)
    val newY = enemyPolarRadius * Math.sin(newAngle)

    return Pair(newX, newY)
}
/**
 * Given an enemy's current position in the Cartesian coordinate system and an angle,
 * rotate the enemy's position counterclockwise by the given angle in the polar coordinate system.
 *
 * @param enemyPosition A pair containing the enemy's current position (x, y) in the Cartesian coordinate system.
 * @param angle The angle in degrees by which to rotate the enemy's position.
 * @return A pair containing the enemy's rotated position (r, theta) in the polar coordinate system.
 */
fun rotateEnemy(enemyPosition: Pair<Double, Double>, angle: Double): Pair<Double, Double> {
/**
 * Given an enemy's current position in the Cartesian coordinate system and an angle,
 * rotate the enemy's position counterclockwise by the given angle in the polar coordinate system.
 *
 * @param enemyPosition A pair containing the enemy's current position (x, y) in the Cartesian coordinate system.
 * @param angle The angle in degrees by which to rotate the enemy's position.
 * @return A pair containing the enemy's rotated position (r, theta) in the polar coordinate system.
 */
fun rotateEnemy(enemyPosition: Pair<Double, Double>, angle: Double): Pair<Double, Double> {

    val (enemyX, enemyY) = enemyPosition
    val enemyPolarRadius = Math.sqrt(enemyX * enemyX + enemyY * enemyY)
    val enemyPolarAngle = Math.atan2(enemyY, enemyX)  // Calculate the angle in radians

    val newAngle = Math.toRadians(Math.toDegrees(enemyPolarAngle) + angle)  // Calculate the new angle in degrees after rotating counterclockwise

    val newX = enemyPolarRadius * Math.cos(newAngle)
    val newY = enemyPolarRadius * Math.sin(newAngle)

    return Pair(newX, newY)
}