PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

IndexError in PokemonOptimizer

Open cmezh opened this issue 10 years ago • 5 comments

@Anakin5, please take a look. screenshot_2016-08-13-00-23-51 Values in this get_top_rank call:

sorted_family == [Squirtle]
criteria.get("top", 1) == 2

config.json

{
    "auth_service": "google",
    "username": "@gmail.com",
    "password": "",
    "location": "56.010607, 92.876573",
    "gmapkey": "AIzaSyDwpF7mutXL5hn6XLMgT3tOl8kxvwGCIm8",
    "//gmapkey": "AIzaSyD1FsUjgCfvNB_QFTPe8QyddPt4jOvG3cU",
    "tasks": [
        {
            "type": "HandleSoftBan"
        },
        {
            "type": "SleepSchedule",
            "config": {
                "enabled": true,
                "time": "03:17",
                "duration": "07:15",
                "time_random_offset": "00:24",
                "duration_random_offset": "00:43"
            }
        },
        {
            "type": "UpdateLiveStats",
            "config": {
                "enabled": true,
                "min_interval": 10,
                "stats": ["uptime", "km_walked", "stardust_earned", "level_stats", "xp_earned", "xp_per_hour", "stops_visited", "pokemon_caught", "pokemon_evolved"],
                "terminal_log": true,
                "terminal_title": true
            }
        },
        {
            "type": "RecycleItems",
            "config": {
                "min_empty_space": 10,
                "item_filter": {
                    "Pokeball": { "keep": 100 },
                    "Greatball": { "keep": 100 },
                    "Ultraball": { "keep": 100 },
                    "Masterball": { "keep": 100 },
                    "Razz Berry": { "keep": 100 },
                    "Potion": { "keep": 0 },
                    "Super Potion": { "keep": 0 },
                    "Hyper Potion": { "keep": 0 },
                    "Max Potion": { "keep": 0 },
                    "Revive": { "keep": 0 },
                    "Max Revive": { "keep": 0 }
                }
            }
        },
        {
            "type": "CollectLevelUpReward"
        },
        {
            "type": "IncubateEggs",
            "config": {
                "longer_eggs_first": true
            }
        },
        {
            "type": "PokemonOptimizer",
            "config": {
                "transfer": true,
                "evolve": true,
                "use_lucky_egg": true,
                "evolve_only_with_lucky_egg": false,
                "minimum_evolve_for_lucky_egg": 90,
                "keep": [
                    {
                        "top": 2,
                        "evolve": true,
                        "// Available sorting keys are:": true,
                        "// iv, cp, ncp, ivcp, max_cp, iv_attack, iv_defense, iv_stamina, hp_max, level": true,
                        "sort": ["cp"]
                    }
                ]
            }
        },
        {
            "type": "CatchVisiblePokemon"
        },
        {
            "type": "CatchLuredPokemon"
        },
        {
            "type": "MoveToFort",
            "config": {
                "lure_attraction": true,
                "lure_max_distance": 2000
            }
        },
        {
            "type": "SpinFort"
        },
        {
            "type": "FollowSpiral",
            "config": {
                "diameter": 10,
                "step_size": 70
            }
        }
    ],
    "map_object_cache_time": 5,
    "forts": {
        "avoid_circles": true,
        "max_circle_size": 100
    },
    "websocket_server": true,
    "walk": 80,
    "action_wait_min": 0,
    "action_wait_max": 1,
    "debug": false,
    "test": false,
    "health_record": false,
    "location_cache": true,
    "distance_unit": "km",
    "reconnecting_timeout": 15,
    "//evolve_captured": "Pidgey,Rattata,Zubat,Weedle,Drowzee,Spearow,Venonat,Caterpie,Krabby,Paras,Jigglypuff,Sandshrew,Vulpix,Meowth,Psyduck,Mankey,Tentacool,Ponyta,Slowpoke,Magnemite,Doduo,Seel,Voltorb,Horsea,Goldeen,Staryu,Ekans",
    "catch_randomize_reticle_factor": 1.0,
    "catch_randomize_spin_factor": 1.0,
    "catch": {
        "any": {
            "catch_above_cp": 0,
            "catch_above_iv": 0,
            "logic": "or"
        }
    },
    "catch_throw_parameters": {
        "excellent_rate": 0.1,
        "great_rate": 0.5,
        "nice_rate": 0.3,
        "normal_rate": 0.1,
        "spin_success_rate": 0.6
    },
    "vips" : {
        "any": {
            "catch_above_cp": 200,
            "catch_above_iv": 0,
            "logic": "and"
        },
        "Lapras": {},
        "Moltres": {},
        "Zapdos": {},
        "Articuno": {},
        "Mewtwo": {},
        "Dragonite": {},
        "Snorlax": {},
        "Mew": {},
        "Arcanine": {},
        "Vaporeon": {},
        "Gyarados": {},
        "Exeggutor": {},
        "Muk": {},
        "Weezing": {},
        "Flareon": {}
    }
}

Other Information

OS: Ubuntu 16.04 Branch: dev Git Commit: 50cd7bf243eab90b88a2d8bd99e105b39647f331 Python Version: Python 2.7.12

cmezh avatar Aug 12 '16 17:08 cmezh

Quick workaround: worst = sorted_family[criteria.get("top", 1) - 1] if len(sorted_family) >= criteria.get("top", 1) else [] I'm not sure that it is completely correct, but it works.

cmezh avatar Aug 12 '16 21:08 cmezh

Why have you closed this issue?

cmezh avatar Aug 12 '16 22:08 cmezh

I just got this error. This shouldn't be closed.

Thanks for the temp fix @cmezh

Vvkmnn avatar Aug 13 '16 03:08 Vvkmnn

Going to reopen until PR is merged as more issues are being created about the same issue

k4n30 avatar Aug 14 '16 02:08 k4n30

Can be closed

julienlavergne avatar Aug 16 '16 22:08 julienlavergne