Skip to content

Commit

Permalink
Fix pyboy sample action to be continuous
Browse files Browse the repository at this point in the history
  • Loading branch information
retinfai committed Feb 27, 2024
1 parent 047c24c commit 8f1d83f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scripts/envrionments/pyboy/mario/mario_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def __init__(self, config: GymEnvironmentConfig) -> None:
]

def sample_action(self) -> int:
return np.random.randint(0, len(self.valid_actions))
return np.random.uniform(
self.min_action_value, self.max_action_value, size=self.action_num
)

def _stats_to_state(self, game_stats: Dict[str, int]) -> List:
state: List = []
Expand Down
4 changes: 3 additions & 1 deletion scripts/envrionments/pyboy/pokemon/pokemon_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def __init__(self, config: GymEnvironmentConfig) -> None:
]

def sample_action(self) -> int:
return np.random.randint(0, len(self.valid_actions))
return np.random.uniform(
self.min_action_value, self.max_action_value, size=self.action_num
)

def _stats_to_state(self, game_stats: Dict[str, any]) -> List[any]:
state: List[any] = []
Expand Down

0 comments on commit 8f1d83f

Please sign in to comment.