JeffreyHyer / auto-coc

Bot to auto play Clash of Clans via BlueStacks Android emulator on Windows
32 stars 14 forks source link

Varying number of barracks #11

Open darrensapalo opened 9 years ago

darrensapalo commented 9 years ago

Not all clash of clan villages have four (4) barracks.

Allow users to set the barracks at the top of the config file. barracksCount = 3

Modify code.

    # Modify as necessary maybe?
    theBarracks = [
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
    ]
    totalTroops = 0

    for (index, count) in enumerate(troops):
        theBarracks[barracksCount][index] = floor((count / barracksCount))
        theBarracks[barracksCount][index] = floor((count / barracksCount))
        theBarracks[barracksCount][index] = floor((count / barracksCount))

        totalTroops += count

        if (count % barracksCount > 0):
            for i in range(0, (count % barracksCount)):

I'm thinking the solution should be something like this, but I'm not familiar with Python.

JeffreyHyer commented 9 years ago

That won't quite work (the code) but I can see your point. I'll make the number of barracks configurable, as suggested. Thanks for the feedback!

ClydeZhao commented 9 years ago

Hey, Jeffery. The tool doesn't work very well in my computer. Could it be the problem of resolution? What's more, the version that I download does not support troop donation and the training time for troops is constant.

darrensapalo commented 9 years ago

Personally, I suspected that the failure of the pattern matching is caused by different systems possibly have different window sizes for the Bluestacks application. Performance improved after updating the images using Windows' snipping tool.

I haven't tested troop donation before.