Right. So I'm making a game. The way I worked it up is you have troops in formations, and these formations are represented in a list. This isn't going to be a complicated matter. I'm not pulling a Total War, least not yet, but I need a way that, if one formation has more troops, the troops loop back around to the start of the opposing list to do their little combat checks
orc1 = orcs.Ogre("Ojjo")
orc2 = orcs.Orc("Durek")
orc3 = orcs.Goblin("Spleesh")
orcform = [orc1,orc2,orc3]
leg1 = imp.Militia("Hans")
leg2 = imp.Archer("Daan")
leg3 = imp.Ballista("The Deathmachine")
leg4 = imp.Slinger("Gus")
impform = [leg1, leg2, leg3, leg4]
def formexchange(attackform, defendform):
tally = []
for attacker, defender in zip(attackform, defendform):
tally.append(exchange(attacker, defender))
return (tally)
formexchange(impform,orcform)
A few funcs aren't in there, but I think you can get the picture
So this is just a simple zip, obviously. I think this'd be easier if I didn't care to have them fight till everything on one side is dead, but I don't. I need a way to have the impform[3] basically start back at orcform[0] I need to make this repeatable and I need to do this cleanly.... least as clean as possible
Also, ignore the iffy way I'm naming my troops. Already going to fix that with a little name generator