```
def radialToCartesian(radius, degrees):
radian = 180 / Math.PI
radianOfCharacter = degrees / radian
xOffset = radius * Math.cos(radianOfCharacter)
yOffset = radius * Math.sin(radianOfCharacter)
Pos = [0 , 0]
Pos[0] = xOffset
Pos[1] = yOffset
return Pos
# findSoldierOffset figures out the position a soldier should stand at in relation to the peasant.
def findSoldierOffset(soldiers, i):
# The first argument 'soldiers' should be an array of your soldiers.
soldier = soldiers[i]
angle = i * (360 / len(soldiers))
# The second argument 'i' is the index of the soldier (in soldiers) you want to find the position for.
return angle
# return radialToCartesian(5, angle)
# Use findByType to get an array of your soldiers.
def moveSoldiers( ):
soldiers = self.findFriends()
peasant = self.findByType("peasant")[0]
# Use a for-loop to iterate over range(len(soldiers)).
for i in range(len(soldiers)):
# soldier = soldiers[i];
angle = findSoldierOffset(soldiers , i );#self.say( angle )
Pos = radialToCartesian( 5, angle );
PosX_ToMove = Pos[0] + peasant.pos['x']
PosY_ToMove = Pos[1] + peasant.pos['y']
PosToMove = {'x':PosX_ToMove , 'y':PosY_ToMove}
if soldiers[i].type == "soldier" :
soldier = soldiers[i]
self.command( soldier, "move", PosToMove)
return 0
def summonSoldiers():
if self.gold >= self.costOf("soldier"):
self.summon("soldier")
def pickUpNearestCoin():
peasant = self.findByType("peasant")[0]
enemy = peasant.findNearest( self.findEnemies() )
if enemy:
if self.isReady("cleave"):
self.cleave(enemy)
coins = self.findItems()
coin = peasant.findNearest( coins )
self.moveXY( coin.pos.x , coin.pos.y)
return 0
loop:
pickUpNearestCoin()
summonSoldiers()
moveSoldiers( )
```

It sometimes works well, but sometimes doesn`t.

Because of a lot of enemies, I used code which help for solving ring-bearer

and cleave skill to kill many enemies at one time.