openai / gym

A toolkit for developing and comparing reinforcement learning algorithms.
https://www.gymlibrary.dev
Other
34.76k stars 8.61k forks source link

Python3 Incompability for frozen_lake.py #76

Closed kevin00036 closed 8 years ago

kevin00036 commented 8 years ago

Running gym with python3.5, task FrozenLake-v0, episodes never terminates even when the agent reaches 'H' or 'G'.

It seems there's some problem with python3 str/bytes. For example, frozen_lake.py line 71: isd = np.array(desc == 'S').astype('float64').ravel() Comparison desc == 'S' will return a big pure python False, rather than a numpy array of booleans. Changing it to desc == b'S' works. Lines 103, 104, 110, 111 also needs modification:

done = bytes(newletter).decode() in 'GH'
rew = float(newletter == b'G')
gdb commented 8 years ago

Good find. Would you be up for opening a pull request?