Remove redundant availability checks#676
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the tutorial excerpt for LLMAgentBase.choose_move() to remove redundant “availability” membership checks that are already guaranteed by _find_move_by_name / _find_pokemon_by_name, keeping the example logic simpler and more consistent with the helper methods.
Changes:
- Removed
and chosen_move in battle.available_movesfrom thechoose_movedecision branch in the English tutorial. - Removed
and chosen_switch in battle.available_switchesfrom thechoose_switchdecision branch in the English tutorial.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| move_name = args.get("move_name") | ||
| if move_name: | ||
| chosen_move = self._find_move_by_name(battle, move_name) | ||
| if chosen_move and chosen_move in battle.available_moves: | ||
| if chosen_move: | ||
| action_taken = True | ||
| chat_msg = f"AI Decision: Using move '{chosen_move.id}'." | ||
| print(chat_msg) |
There was a problem hiding this comment.
The redundant availability checks were removed in the English unit, but the same code excerpt in other locales (e.g., units/es, units/fr, units/zh-CN) still includes chosen_move and chosen_move in battle.available_moves / chosen_switch and chosen_switch in battle.available_switches. If these units are meant to stay in sync, update the translated building_your_pokemon_agent.mdx files to match this logic to avoid inconsistent guidance.
There was a problem hiding this comment.
Ok, I've edited the other locales that contain the bonus-unit3 directory: es, fr, zh-CN
…the bonus-unit3 directory: es, fr, zh-CN
|
Ok, I've edited the other locales that contain the bonus-unit3 directory: es, fr, zh-CN |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR cleans up redundant logical checks in the
LLMAgentBaseaction selectionChanges Made:
and chosen_move in battle.available_movesandand chosen_switch in battle.available_switchesinsidechoose_move(). The helper methods_find_move_by_nameand_find_pokemon_by_namealready exclusively return objects from these lists, making the secondary checks unnecessary.