Steelclaw a bit confused in level Steelclaw Gap

thank you , so i get it but it stil says it

1 Like

that is my full code

1 Like

defendPoints = [{“x”: 35, “y”: 63},{“x”: 61, “y”: 63},{“x”: 32, “y”: 26},{“x”: 64, “y”: 26}]

summonTypes = [“soldier”,“soldier”,“soldier”,“soldier”,“archer”,“archer”,“archer”,“archer”]

def summonTroops():
type = summonTypes[len(self.built) % len(summonTypes)]
if self.gold >= self.costOf(type):
self.summon(type)

def commandTroops():
friends = self.findFriends()
for friendIndex, friend in enumerate(friends):
# Use % to wrap around defendPoints based on friendIndex
pass
# Command your minion to defend the defendPoint
defendPoint=defendPoints[friendIndex % len(defendPoints)
self.command(friend, “defend”, defendPoint)
loop:
summonTroops()
commandTroops()

whats wrong?

1 Like

I DID THE LEVEL! :grinning:

1 Like

I GOT THEWRONG IDEA ON the %

1 Like

I modified my code a little bit once I got it to work to work in pythontutor.com so I could better visualize what the modulo process does…

here is a link for anyone that cares to view it…

defendPoints = [{"x": 35, "y": 63},{"x": 61, "y": 63},{"x": 32, "y": 26},{"x": 64, "y": 26}]

summonTypes = ["soldier","soldier","soldier","soldier","archer","archer","archer","archer"]

def commandTroops():
    friends = ['soldier0','soldier1','soldier2','soldier3','archer4','archer5','archer6','archer7']
    for friendIndex, friend in enumerate(friends):
        # Use % to wrap around defendPoints based on friendIndex
        point = defendPoints[friendIndex % len(defendPoints)]
        # Command your minion to defend the defendPoint
        #self.command(friend, "defend", point)


commandTroops()

go to pythontutor.com and paste that part of the code in and run it. It won’t let me do the link, it is too long. But it will show you what happens.

1 Like

About this level but not about the code =))

I make sweet strategy to survive BONUS time and hit PLAY button.

so in PLAY mode I survived for 60 sec and get bonus but when I hit SUBMIT, I was not so lucky and one soldier died.

But I still get extra bonus XP and GEMS

I think it may be a bug.

BTW, I replayed the level to proove my gems =)

2 Likes