changed to multi binary action
This commit is contained in:
parent
3e266b1c35
commit
1792c1f971
|
|
@ -141,7 +141,7 @@ class FlowerGameEnv(gym.Env):
|
|||
"state": spaces.Box(low=0.0, high=1.0, shape=(6,), dtype=np.float32)
|
||||
}
|
||||
)
|
||||
self.action_space = spaces.Discrete(4)
|
||||
self.action_space = spaces.MultiBinary(4)
|
||||
|
||||
# --- HSV-Grenzen ---
|
||||
self.yellow_lower = np.array([15, 40, 200], dtype=np.uint8)
|
||||
|
|
@ -230,16 +230,16 @@ class FlowerGameEnv(gym.Env):
|
|||
pyautogui.keyUp("a", _pause=False)
|
||||
pyautogui.keyUp("s", _pause=False)
|
||||
pyautogui.keyUp("d", _pause=False)
|
||||
if action == 0:
|
||||
if action[0] and not action[2]:
|
||||
pyautogui.keyDown("w", _pause=False)
|
||||
elif action == 1:
|
||||
if action[1] and not action[3]:
|
||||
pyautogui.keyDown("a", _pause=False)
|
||||
elif action == 2:
|
||||
if action[2] and not action[0]:
|
||||
pyautogui.keyDown("s", _pause=False)
|
||||
elif action == 3:
|
||||
if action[3] and not action[1]:
|
||||
pyautogui.keyDown("d", _pause=False)
|
||||
|
||||
time.sleep(0.2)
|
||||
time.sleep(0.15)
|
||||
|
||||
obs = self._build_observation()
|
||||
reward = self._calculate_reward()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user