25 lines
686 B
Python
25 lines
686 B
Python
import gymnasium as gym
|
|
|
|
class MyCustomEnv(gym.Env):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.action_space = gym.spaces.Discrete(2)
|
|
self.observation_space = gym.spaces.Discrete(10)
|
|
|
|
def step(self, action):
|
|
observation = self.observation_space.sample()
|
|
reward = 1.0
|
|
terminated = False
|
|
truncated = False
|
|
info = {}
|
|
return observation, reward, terminated, truncated, info
|
|
|
|
def reset(self, seed=None, options=None):
|
|
super().reset(seed=seed)
|
|
observation = self.observation_space.sample()
|
|
info = {}
|
|
return observation, info
|
|
|
|
def render(self, mode='human'):
|
|
pass
|