Skip to content

Commit

Permalink
Merge pull request Farama-Foundation#310 from PettingZoo-Team/change-…
Browse files Browse the repository at this point in the history
…pistonball-defaults

Improve pistonball defaults and documentation
  • Loading branch information
jkterry1 authored Feb 3, 2021
2 parents dfddfd0 + c627121 commit 789411a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/butterfly/pistonball.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ Keys *a* and *d* control which piston is selected to move (initially the rightmo
### Arguments

```Python
pistonball.env(n_pistons=20, local_ratio=0.2, time_penalty=-0.1, continuous=False, random_drop=True, random_rotate=True, ball_mass=0.75, ball_friction=0.3, ball_elasticity=1.5, max_cycles=900)
pistonball.env(n_pistons=20, local_ratio=0, time_penalty=-0.1, continuous=True, random_drop=True, random_rotate=True, ball_mass=0.75, ball_friction=0.3, ball_elasticity=1.5, max_cycles=125)
```

`n_pistons`: The number of pistons (agents) in the environment.

`local_ratio`: Weight applied to local reward and global reward. Global reward weight will always be 1 - `local_ratio`.
`local_ratio`: Weight applied to local reward and global reward. Global reward weight will always be 1 - `local_ratio`. The local reward is an additional reward for the ball moving to pistons the ball is over for reward shaping. The current implementation is probably problematic, but we are unaware of a superior option. We may remove this in the future.

`time_penalty`: Amount of reward added to each piston each time step. Higher values mean higher weight towards getting the ball across the screen to terminate the game.

Expand Down
2 changes: 1 addition & 1 deletion pettingzoo/butterfly/pistonball/pistonball.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class raw_env(AECEnv, EzPickle):

metadata = {'render.modes': ['human', "rgb_array"], 'name': "pistonball_v3"}

def __init__(self, n_pistons=20, local_ratio=0.2, time_penalty=-0.1, continuous=False, random_drop=True, random_rotate=True, ball_mass=0.75, ball_friction=0.3, ball_elasticity=1.5, max_cycles=900):
def __init__(self, n_pistons=20, local_ratio=0, time_penalty=-0.1, continuous=True, random_drop=True, random_rotate=True, ball_mass=0.75, ball_friction=0.3, ball_elasticity=1.5, max_cycles=125):
EzPickle.__init__(self, n_pistons, local_ratio, time_penalty, continuous, random_drop, random_rotate, ball_mass, ball_friction, ball_elasticity, max_cycles)
self.n_pistons = n_pistons
self.piston_head_height = 11
Expand Down

0 comments on commit 789411a

Please sign in to comment.