repeat_action_probability applied BELOW frameskip — sticky at the raw action level, the standard v5 stochasticity. We build the ALE env with sticky 0 and add it here so the demo replay (which must be deterministic) can bypass it.
| 38 | |
| 39 | |
| 40 | class StickyActionEnv: |
| 41 | """repeat_action_probability applied BELOW frameskip — sticky at the raw |
| 42 | action level, the standard v5 stochasticity. We build the ALE env with |
| 43 | sticky 0 and add it here so the demo replay (which must be deterministic) |
| 44 | can bypass it.""" |
| 45 | |
| 46 | def __init__(self, p=0.25): |
| 47 | self.p = p |
| 48 | self.last = 0 |
| 49 | |
| 50 | def reset(self): |
| 51 | self.last = 0 |
| 52 | |
| 53 | def filter(self, action, rng): |
| 54 | if rng.random() < self.p: |
| 55 | return self.last |
| 56 | self.last = action |
| 57 | return action |
| 58 | |
| 59 | |
| 60 | class ReplayResetEnv: |