Skip to content

Commit

Permalink
Hotfix minecart with rgb obs
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasAlegre committed Feb 12, 2024
1 parent 91ab390 commit 47ab9c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 7 additions & 0 deletions mo_gymnasium/envs/minecart/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
max_episode_steps=1000,
)

register(
id="minecart-rgb-v0",
entry_point="mo_gymnasium.envs.minecart.minecart:Minecart",
kwargs={"image_observation": True},
max_episode_steps=1000,
)

register(
id="minecart-deterministic-v0",
entry_point="mo_gymnasium.envs.minecart.minecart:Minecart",
Expand Down
10 changes: 1 addition & 9 deletions mo_gymnasium/envs/minecart/minecart.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import itertools
import json
import math
from copy import deepcopy
from math import ceil
from pathlib import Path
from typing import List, Optional
Expand Down Expand Up @@ -566,7 +565,7 @@ def reset(self, seed=None, **kwargs):
super().reset(seed=seed)

if self.screen is None and self.image_observation:
self.render(mode="rgb_array") # init pygame
self.render() # init pygame

if self.image_observation:
self.render_pygame()
Expand Down Expand Up @@ -675,13 +674,6 @@ def close(self):
pygame.display.quit()
pygame.quit()

def __deepcopy__(self, memo):
this_copy = Minecart(self.image_observation, self.config)
this_copy.cart = deepcopy(self.cart)
this_copy.mines = deepcopy(self.mines)
this_copy.end = self.end
return this_copy


class Mine:
"""Class representing an individual Mine"""
Expand Down

0 comments on commit 47ab9c1

Please sign in to comment.