mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-19 21:42:02 +00:00
* Refactor/document algorithmic environments and add tests. * test for 3 row addition * Fix failing rollout test by reinserting quirk in reversedAddition env * todo regarding addition3-v0 * Fix python 3 division issues * typo fix * Re-generate python3 rollout file to account for ReversedAddition bug fix
17 lines
490 B
Python
17 lines
490 B
Python
"""
|
|
Task is to reverse content over the input tape.
|
|
http://arxiv.org/abs/1511.07275
|
|
"""
|
|
|
|
import numpy as np
|
|
from gym.envs.algorithmic import algorithmic_env
|
|
|
|
class ReverseEnv(algorithmic_env.TapeAlgorithmicEnv):
|
|
MIN_REWARD_SHORTFALL_FOR_PROMOTION = -.1
|
|
def __init__(self, base=2):
|
|
super(ReverseEnv, self).__init__(base=base, chars=True, starting_min_length=1)
|
|
self.last = 50
|
|
|
|
def target_from_input_data(self, input_str):
|
|
return list(reversed(input_str))
|