input: Write a python function that calculates the highest score achievable after battling enemies. The function should take an integer list `enemyEnergies` representing the energy levels of various enemies and an integer `currentEnergy` representing the initial energy amount. Begin with zero points and unmarked enemies. You can perform the following actions multiple times to gain score:
  
  - Select an unmarked enemy `i` if `currentEnergy` is at least equal to `enemyEnergies[i]`. This costs the enemy's energy but earns 1 point.
  - If you already have points, you can also select an unmarked enemy `i`, which adds the enemy's energy to yours without earning a point.
  
  The function should return the highest score achievable with the optimal use of operations.
output: def maxScore(enemyEnergies, currentEnergy):
      enemyEnergies.sort()
      score = 0
      left, right = 0, len(enemyEnergies) - 1
      
      while left <= right:
          if currentEnergy >= enemyEnergies[left]:
              currentEnergy -= enemyEnergies[left]
              score += 1
              left += 1
          elif score > 0:
              currentEnergy += enemyEnergies[right]
              score -= 1
              right -= 1
          else:
              break
      
      return score