Auto-translated
Now, let's develop the program's algorithm.
1) The Fairies should move 8 cells upwards. After that, the Zombies move, and the turn passes to the Peasant (Screen01).
2) Now, the program should click the button to skip the Peasant's turn, after which the Ballista will fire automatically, and the turn will pass to the Fairy (Screen02).
3) The Fairies should move 8 cells downwards. After that, the Zombies move again, and the turn passes to the Peasant (Screen03).
4) Now, the program should click the button to skip the Peasant's turn again, after which the Ballista will fire automatically again, and the turn will pass to the Fairy again (Screen04).
After this, the battle proceeds cyclically: Fairies move up, Peasant's turn is skipped, the Ballista fires, and so on.
Note: if the hero has the Artillery skill, it is best to check the "Ballista" option in the auto-battle settings and uncheck the "Warriors" option. After that, in the battle, you need to click the "Automatic Battle" button. As a result, the Ballista will fire automatically (as if the hero did not have the Artillery skill), and the player will control the armies (by IronAxe).
The program's algorithm has been developed.