mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-23 15:04:20 +00:00
Cleanup, removal of unmaintained code (#836)
* add dtype to Box * remove board_game, debugging, safety, parameter_tuning environments * massive set of breaking changes - remove python logging module - _step, _reset, _seed, _close => non underscored method - remove benchmark and scoring folder * Improve render("human"), now resizable, closable window. * get rid of default step and reset in wrappers, so it doesn’t silently fail for people with underscore methods * CubeCrash unit test environment * followup fixes * MemorizeDigits unit test envrionment * refactored spaces a bit fixed indentation disabled test_env_semantics * fix unit tests * fixes * CubeCrash, MemorizeDigits tested * gym backwards compatibility patch * gym backwards compatibility, followup fixes * changelist, add spaces to main namespaces * undo_logger_setup for backwards compat * remove configuration.py
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import numpy as np
|
||||
from gym import Space, spaces
|
||||
|
||||
import gym, time
|
||||
from gym.spaces import prng
|
||||
|
||||
class Discrete(gym.Space):
|
||||
class Discrete(Space):
|
||||
"""
|
||||
{0,1,...,n-1}
|
||||
|
||||
@@ -12,8 +10,9 @@ class Discrete(gym.Space):
|
||||
"""
|
||||
def __init__(self, n):
|
||||
self.n = n
|
||||
Space.__init__(self, (), np.int64)
|
||||
def sample(self):
|
||||
return prng.np_random.randint(self.n)
|
||||
return spaces.np_random.randint(self.n)
|
||||
def contains(self, x):
|
||||
if isinstance(x, int):
|
||||
as_int = x
|
||||
@@ -22,10 +21,6 @@ class Discrete(gym.Space):
|
||||
else:
|
||||
return False
|
||||
return as_int >= 0 and as_int < self.n
|
||||
|
||||
@property
|
||||
def shape(self):
|
||||
return (self.n,)
|
||||
def __repr__(self):
|
||||
return "Discrete(%d)" % self.n
|
||||
def __eq__(self, other):
|
||||
|
Reference in New Issue
Block a user