Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
src/envs/maze_env/server/maze.py
CHANGED
|
@@ -10,7 +10,6 @@
|
|
| 10 |
import logging
|
| 11 |
from enum import Enum, IntEnum
|
| 12 |
|
| 13 |
-
import matplotlib.pyplot as plt
|
| 14 |
import numpy as np
|
| 15 |
|
| 16 |
|
|
@@ -137,33 +136,6 @@ class Maze:
|
|
| 137 |
self.__ax1.get_figure().canvas.draw()
|
| 138 |
self.__ax1.get_figure().canvas.flush_events()
|
| 139 |
|
| 140 |
-
def render(self, content=Render.NOTHING):
|
| 141 |
-
""" Record what will be rendered during play and/or training.
|
| 142 |
-
|
| 143 |
-
:param Render content: NOTHING, TRAINING, MOVES
|
| 144 |
-
"""
|
| 145 |
-
self.__render = content
|
| 146 |
-
|
| 147 |
-
if self.__render == Render.NOTHING:
|
| 148 |
-
if self.__ax1:
|
| 149 |
-
self.__ax1.get_figure().close()
|
| 150 |
-
self.__ax1 = None
|
| 151 |
-
if self.__ax2:
|
| 152 |
-
self.__ax2.get_figure().close()
|
| 153 |
-
self.__ax2 = None
|
| 154 |
-
if self.__render == Render.TRAINING:
|
| 155 |
-
if self.__ax2 is None:
|
| 156 |
-
fig, self.__ax2 = plt.subplots(1, 1, tight_layout=True)
|
| 157 |
-
fig.canvas.set_window_title("Best move")
|
| 158 |
-
self.__ax2.set_axis_off()
|
| 159 |
-
self.render_q(None)
|
| 160 |
-
if self.__render in (Render.MOVES, Render.TRAINING):
|
| 161 |
-
if self.__ax1 is None:
|
| 162 |
-
fig, self.__ax1 = plt.subplots(1, 1, tight_layout=True)
|
| 163 |
-
fig.canvas.set_window_title("Maze")
|
| 164 |
-
|
| 165 |
-
plt.show(block=False)
|
| 166 |
-
|
| 167 |
def step(self, action):
|
| 168 |
""" Move the agent according to 'action' and return the new state, reward and game status.
|
| 169 |
|
|
|
|
| 10 |
import logging
|
| 11 |
from enum import Enum, IntEnum
|
| 12 |
|
|
|
|
| 13 |
import numpy as np
|
| 14 |
|
| 15 |
|
|
|
|
| 136 |
self.__ax1.get_figure().canvas.draw()
|
| 137 |
self.__ax1.get_figure().canvas.flush_events()
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
def step(self, action):
|
| 140 |
""" Move the agent according to 'action' and return the new state, reward and game status.
|
| 141 |
|