Commit Graph

16 Commits

Author SHA1 Message Date
Gianluca De Cola
36a7fe5a31 Add test gym utils play. Fix #2729 (#2743)
* refactoring play function. Tests for keys to action mapping.

* Add mocking pygame events.

* partial event processing in class.

* pre-commit.

* quit pygame after tests.

* fix typos in functions names.

* Add type hint.

* Add test for play function.

* remove mockKeyEvent.

* remove unused main code.

* Adding type hints.

* catch custom exception in tests.

* Fix magic numbers.

* Add test with an actual environment.

* fix comment.

* Add TODO memo on env.render.

* change map with list comprehension.

* remove unused imports.

* Add type hint.

* typo.

* docstring.
2022-04-18 11:30:56 -04:00
Andrea PIERRÉ
e913bc81b8 Improve pre-commit workflow (#2602)
* feat: add `isort` to `pre-commit`

* ci: skip `__init__.py` file for `isort`

* ci: make `isort` mandatory in lint pipeline

* docs: add a section on Git hooks

* ci: check isort diff

* fix: isort from master branch

* docs: add pre-commit badge

* ci: update black + bandit versions

* feat: add PR template

* refactor: PR template

* ci: remove bandit

* docs: add Black badge

* ci: try to remove all `|| true` statements

* ci: remove lint_python job

- Remove `lint_python` CI job
- Move `pyupgrade` job to `pre-commit` workflow

* fix: avoid messing with typing

* docs: add a note on running `pre-cpmmit` manually

* ci: apply `pre-commit` to the whole codebase
2022-03-31 15:50:38 -04:00
Elijah K
61d9f266bc Py36+ syntax in gym/utils: derived by running pyupgrade --py36-plus gym/utils/**.py and flynt gym --ll 120 (#2472)
Co-authored-by: Ilya Kamen <ilya.kamenshchikov@bosch.com>
2021-11-14 08:50:53 -05:00
J K Terry
78d2b512d8 redo black (#2272) 2021-07-29 15:39:42 -04:00
Justin Terry
e9d2c41f2b redo black 2021-07-29 12:42:48 -04:00
Christian Clauss
bb81e141ea Blacken the codebase (#2265) 2021-07-28 20:26:34 -04:00
martinResearch
f37830bbe2 getting play working with montain_car game (#1393)
* Update play.py

getting the play function working with game where the observation space is not a Box.

* Update mountain_car.py

adding get_keys_to_action method to the montain_car environement

* Update play.py

clean for pull request

* Update play.py

cleaning

* Update play.py

cleaning
2019-03-22 14:51:00 -07:00
Christopher Hesse
aa3e029926 better errors for play.py, fixes #1350 (#1376) 2019-03-22 14:27:57 -07:00
Justin Francis
1a321d32d1 Add argpars for environment in play.py (#641)
Add an Argpars --env for environment with default set to: MontezumaRevengeNoFrameskip-v4
2019-03-07 12:53:00 -08:00
Felix Yan
fb7dc3e59f Fix a typo in gym/utils/play.py (#1187) 2018-10-23 14:20:14 -07:00
Christian Kauten
a77b139e58 Update play.py (#1026)
resolve KeyError from missing key in action dict. use `(dict).get` with a default value of NOP (0).
2018-08-09 10:40:57 -07:00
Evan Shelhamer
ac137fc7eb bump Atari envs to v4 given ROM fixes
see 199fdf3ac3
2017-05-12 18:14:33 -07:00
Evan Shelhamer
42a42fd393 play: set example fps to 60 as in original Atari 2017-05-12 16:35:33 -07:00
Evan Shelhamer
77b1e25b24 play: drop callback b.c. of slowdown 2017-05-12 16:35:33 -07:00
Evan Shelhamer
d1211037c2 fix play utility
- import pyglet window to fix mysterious issue with ui focus
  (hat tip @jeanharb)
- make matplotlib backend take effect by picking before plot import
- fix misc. issues with example usage
2017-05-12 16:35:33 -07:00
Tom Brown
d337f4e571 TimeLimit refactor with Monitor Simplification (#482)
* fix double reset, as suggested by @jietang

* better floors and ceilings

* add convenience methods to monitor

* add wrappers to gym namespace

* allow playing Atari games, with potentially more coming in the future

* simplify example in docs

* Move play out of the Env

* fix tests

* no more deprecation warnings

* remove env.monitor

* monitor simplification

* monitor simplifications

* monitor related fixes

* a few changes suggested by linter

* timestep_limit fixes

* keep track of gym env variables for future compatibility

* timestep_limit => max_episode_timesteps

* don't apply TimeLimit wrapper in make for VNC envs

* Respect old timestep_limit argument

* Pass max_episode_seconds through registration

* Don't include deprecation warnings yet
2017-02-01 13:10:59 -08:00