Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError in PokemonOptimizer #3761

Closed
cmezh opened this issue Aug 12, 2016 · 5 comments
Closed

IndexError in PokemonOptimizer #3761

cmezh opened this issue Aug 12, 2016 · 5 comments

Comments

@cmezh
Copy link
Contributor

cmezh commented Aug 12, 2016

@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: 50cd7bf
Python Version: Python 2.7.12

@cmezh
Copy link
Contributor Author

cmezh commented Aug 12, 2016

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
Copy link
Contributor Author

cmezh commented Aug 12, 2016

Why have you closed this issue?

@Vvkmnn
Copy link

Vvkmnn commented Aug 13, 2016

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

Thanks for the temp fix @cmezh

@k4n30
Copy link
Contributor

k4n30 commented Aug 14, 2016

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

@julienlavergne
Copy link
Contributor

Can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@k4n30 @Vvkmnn @julienlavergne @cmezh and others