Skip to content

Commit

Permalink
Add max for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Jul 28, 2024
1 parent e23cf9e commit 1bacdb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ debug:
max_steps: 16
log_frequency: 1
disable_wild_encounters: True
disable_ai_actions: True
disable_ai_actions: False
use_global_map: False
reduce_res: False
animate_scripts: True
Expand Down
10 changes: 4 additions & 6 deletions pokemonred_puffer/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,15 +677,13 @@ def run_action_on_emulator(self, action):

if not self.disable_ai_actions:
self.pyboy.send_input(VALID_ACTIONS[action])
self.pyboy.send_input(VALID_RELEASE_ACTIONS[action], delay=8)
# TODO: Function-ize this
self.user_control = False
while not self.user_control:
self.pyboy.tick(1, render=False)

self.user_control = False
self.pyboy.send_input(VALID_RELEASE_ACTIONS[action])
while not self.user_control:
count = 0
while not self.user_control and count < self.action_freq:
self.pyboy.tick(1, render=False)
count += 1
else:
self.pyboy.tick(self.action_freq, render=True)

Expand Down

0 comments on commit 1bacdb3

Please sign in to comment.