Problem getting further in game


#1

So, my problem is getting further in game. i recently got in kelvintaph mountain. im stuck in “kelvintaph crusader” and “binary deployment” ive tried both and dont understand what to do, i even did go back to cloudrip and repeated the levels from “left side” of cloudrip mountain to understand “iterating through indexes” or whatever its called to understand it better which i thought was the problem in “binary deployment”, but even after i did i still cannot understand how to do the level, i even just tried to spawn like 45 soldiers and tried to command them to move, placed as in picture of hints and couldnt do that either, in “kelvintaph crusader” i can move myself to safety but cant command friends after i kill witch.
last time i got stuck in first levels of “iterating through indexes” i just reseted my game and did everything again and i dont know what i should do now, should i do “left side” of cloudrip 3rd time and hope i could learn something new, because even the second time i didnt really learn much new, besides “split” and “trim” things and kind of understood iterating thing better.
i just dont know how i could learn to beat these levels. i even thought about go and try to learn some other programming languages. but people say python is easy for beginners so i dont know if i could understand them either.


#2

Feel free to include your current code and we may be able to walk you through the problem.


#3

@ossiose123 For Binary deployment do you understand the concept of binary numbers?


#4
def toBinary(number):
    string = " "
    while number != 0:
        remainder = number % 2
        number = (number - remainder) / 2
        string = remainder + string
    return string
    
def comFriends():
    for x in range(20, 63, 6):
        for y in range(28, 57, 7):
            self.command(friend, "move", {"x": x, "y": y})
for friend in self.findFriends():
    number = toBinary(friend.deployment)
    if friend.type == "paladin":
        for i in range(len(number)):
            if number[i] > 0:
                self.summon("archer")
            if number[i] < 1:
                self.summon("soldier")
                friend = self.findNearest(self.findFriends())
                if friend.type != "paladin":
                    comFriends()

i know there is something wrong in comFriends where i am supposed to send friends to points but i cant figure out how i do that one by one


#5

okay i got my friends to move, previously when i tried this tactic i tried to start from up to down and instead of doing negative ysteps i did positive ysteps. anyway, now they go from down to up but i think there is new, problem. there is 41 built troops when there should be 40 so i summon wrong somehow… heres my code now:

def toBinary(number):
    string = " "
    while number != 0:
        remainder = number % 2
        number = (number - remainder) / 2
        string = remainder + string
    return string
def comFriends():
    minX = 20
    maxX = 62
    maxY = 58
    minY = 28
    line = 0
    for friend in self.findFriends():
        if friend.type != "paladin":
            if friend.type != "warlock":
                if line <= 8:
                    self.command(friend, "move", {"x": minX, "y": minY})
                    line += 1
                    minX += 6
                    if minX == maxX + 6:
                        minX = 20
                        minY += 7
                    if line == 8:
                        line = 0
for friend in self.findFriends():
    number = toBinary(friend.deployment)
    if friend.type == "paladin":
        for i in range(len(number)):
            numbe = number[i]
            if numbe > 0:
                self.summon("archer")
            if numbe < 1:
                self.summon("soldier")
                friend = self.findNearest(self.findFriends())
                friends = self.findFriends()
            comFriends()

#6

can anyone help please?


#7

You could find the last friend in the friends[] array, which is the friend that was just summoned and send that into the comFriends() function as an argument.

Right now in the first code segment you are calling comFriends() only for the soldier’s You might try moving that code back one level. The code self.findNearest(self.findFriends()) might be able to be used to send the friend to the comFriends() function.