I have been doing this, but it is not as efficient:
def summon():
if self.gold > 45:
self.summon("soldier")
self.summon("archer")
I have been doing this, but it is not as efficient:
def summon():
if self.gold > 45:
self.summon("soldier")
self.summon("archer")
There are a few ways to do it.
You could add 1 to a counter every time you summon a soldier and reset it when you summon an archer. (similar to decoy drill but resenting the count instead of break
)
You could use % and len(self.findFriends())
There is a level in the mountain world that covers that exact topic. You could go play that.
I confirm, there is a mountain level teaching you this, bu’t I can remember the name.
The idea is to:
#define a summon array
summonList=["soldier","archer","archer","paladin"]
#an a looping counther through the array
summonNext=0
Then in your summoning function you’ll try to summon from the summonList (pseudocode):
if enough gold to summon summonList[summonNext] :
summon summonList[summonNext]
#increment the counter looping back to 0 if it overpasses the array length
summonNext=(summonNext+1) % len(summonList)
Yeah, that’s definitely the better way to do it.
My method will only work for 2 types. After that will become too complicated.