Jofthomas commited on
Commit
ac45dce
·
verified ·
1 Parent(s): 327de6d

Update agents.py

Browse files
Files changed (1) hide show
  1. agents.py +4 -5
agents.py CHANGED
@@ -17,7 +17,6 @@ import time
17
 
18
  # --- Poke-Env ---
19
  from poke_env.player import Player
20
- from poke_env.environment.battle import Battle
21
  from poke_env.environment.move import Move
22
  from poke_env.environment.pokemon import Pokemon
23
  from typing import Optional, Dict, Any, Union
@@ -121,7 +120,7 @@ class LLMAgentBase(Player):
121
  self.battle_history = []
122
  self.battle_delay = battle_delay
123
 
124
- def _format_battle_state(self, battle: Battle) -> str:
125
  active_pkmn = battle.active_pokemon
126
  active_pkmn_info = f"Your active Pokemon: {active_pkmn.species} " \
127
  f"(Type: {'/'.join(map(str, active_pkmn.types))}) " \
@@ -167,7 +166,7 @@ class LLMAgentBase(Player):
167
  f"Opponent Side Conditions: {battle.opponent_side_conditions}"
168
  return state_str.strip()
169
 
170
- def _find_move_by_name(self, battle: Battle, move_name: str) -> Optional[Move]:
171
  normalized_name = normalize_name(move_name)
172
  # Prioritize exact ID match
173
  for move in battle.available_moves:
@@ -180,7 +179,7 @@ class LLMAgentBase(Player):
180
  return move
181
  return None
182
 
183
- def _find_pokemon_by_name(self, battle: Battle, pokemon_name: str) -> Optional[Pokemon]:
184
  normalized_name = normalize_name(pokemon_name)
185
  for pkmn in battle.available_switches:
186
  # Normalize the species name for comparison
@@ -188,7 +187,7 @@ class LLMAgentBase(Player):
188
  return pkmn
189
  return None
190
 
191
- async def choose_move(self, battle: Battle) -> str:
192
  #time.sleep(self.battle_delay)
193
 
194
  battle_state_str = self._format_battle_state(battle)
 
17
 
18
  # --- Poke-Env ---
19
  from poke_env.player import Player
 
20
  from poke_env.environment.move import Move
21
  from poke_env.environment.pokemon import Pokemon
22
  from typing import Optional, Dict, Any, Union
 
120
  self.battle_history = []
121
  self.battle_delay = battle_delay
122
 
123
+ def _format_battle_state(self, battle) -> str:
124
  active_pkmn = battle.active_pokemon
125
  active_pkmn_info = f"Your active Pokemon: {active_pkmn.species} " \
126
  f"(Type: {'/'.join(map(str, active_pkmn.types))}) " \
 
166
  f"Opponent Side Conditions: {battle.opponent_side_conditions}"
167
  return state_str.strip()
168
 
169
+ def _find_move_by_name(self, battle, move_name) -> Optional[Move]:
170
  normalized_name = normalize_name(move_name)
171
  # Prioritize exact ID match
172
  for move in battle.available_moves:
 
179
  return move
180
  return None
181
 
182
+ def _find_pokemon_by_name(self, battle, pokemon_name) -> Optional[Pokemon]:
183
  normalized_name = normalize_name(pokemon_name)
184
  for pkmn in battle.available_switches:
185
  # Normalize the species name for comparison
 
187
  return pkmn
188
  return None
189
 
190
+ async def choose_move(self, battle) -> str:
191
  #time.sleep(self.battle_delay)
192
 
193
  battle_state_str = self._format_battle_state(battle)