leftEnemy = self.findNearestEnemy()
if leftEnemy:
self.attack(leftEnemy)
self.attack(leftEnemy)
# Now move to the right entrance.
# Use "if" to attack if there is an enemy.
self.moveXY(60, 34)
self.moveXY(35, 34)
Find nearest enemy.
If there is an enemy, attack enemy twice.
Move to the right position.
Move to the left position.
You need to find the nearest enemy from each X. If I were you, I would reset the level, then use the same technique to find rightEnemy that the default code uses to find leftEnemy.