pmariglia / showdown

A Pokemon Showdown Battle Bot written in Python
GNU General Public License v3.0
257 stars 175 forks source link

IndexError: tuple index out of range #106

Closed variat42 closed 2 years ago

variat42 commented 2 years ago

What:

Traceback (most recent call last):
  File "run.py", line 111, in <module>
    asyncio.get_event_loop().run_until_complete(showdown())
  File "C:\Users\Dominis\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", line 467, in run_until_complete
    return future.result()
  File "run.py", line 94, in showdown
    winner = await pokemon_battle(ps_websocket_client, config.pokemon_mode)
  File "C:\Pokebot\attacker\showdown\run_battle.py", line 178, in pokemon_battle
    battle = await start_battle(ps_websocket_client, pokemon_battle_type)
  File "C:\Pokebot\attacker\showdown\run_battle.py", line 169, in start_battle
    battle = await start_standard_battle(ps_websocket_client, pokemon_battle_type)
  File "C:\Pokebot\attacker\showdown\run_battle.py", line 159, in start_standard_battle
    await handle_team_preview(battle, ps_websocket_client)
  File "C:\Pokebot\attacker\showdown\run_battle.py", line 53, in handle_team_preview
    best_move = await async_pick_move(battle_copy)
  File "C:\Pokebot\attacker\showdown\run_battle.py", line 38, in async_pick_move
    pool, battle_copy.find_best_move
  File "C:\Users\xxxx\AppData\Local\Programs\Python\Python36\lib\concurrent\futures\thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Pokebot\attacker\showdown\battle_bots\safest\main.py", line 49, in find_best_move
    safest_move = pick_safest_move_from_battles(battles)
  File "C:\Pokebot\attacker\showdown\battle_bots\safest\main.py", line 38, in pick_safest_move_from_battles
    bot_choice = decision[0]
IndexError: tuple index out of range

When: From what i noticed the error happen at the begining of the combat (before the bot get to pick an pokemon to start yet), when enemy team got 2 duplicated pokemons (for example Urshifu and Urshifu-Rapid-Strike)

pmariglia commented 2 years ago

when enemy team got 2 duplicated pokemons (for example Urshifu and Urshifu-Rapid-Strike)

Duplicate of #3

Yes this will cause an error. The bot will error if either team has two pokemon of the same species. This means that certain formats that allow this will not work.

pmariglia commented 2 years ago

Closing due to being a duplicate of #3.