Updated humanPlayer.py to the new input mapping

This commit is contained in:
Dominik Moritz Roth 2022-06-29 12:42:20 +02:00
parent d92758c4fd
commit d998d816a1

View File

@ -48,6 +48,7 @@ def playEnv(env):
pos = pygame.mouse.get_pos() pos = pygame.mouse.get_pos()
pos = (min(max((pos[0]-env.joystick_offset[0]-20)/60, 0), 1), pos = (min(max((pos[0]-env.joystick_offset[0]-20)/60, 0), 1),
min(max((pos[1]-env.joystick_offset[1]-20)/60, 0), 1)) min(max((pos[1]-env.joystick_offset[1]-20)/60, 0), 1))
pos = pos[0]*2-1, pos[1]*2-1
obs, rew, done, info = env.step(np.array(pos, dtype=np.float32)) obs, rew, done, info = env.step(np.array(pos, dtype=np.float32))
print('Reward: '+str(rew)) print('Reward: '+str(rew))
print('Score: '+str(info)) print('Score: '+str(info))