From ce4706ea50415440aba20fde670d04efb84e7564 Mon Sep 17 00:00:00 2001 From: kenny Date: Mon, 25 Mar 2019 15:50:35 -0600 Subject: [PATCH] added minimal_action_set function to each environment --- environments/asterix.py | 4 ++++ environments/breakout.py | 4 ++++ environments/freeway.py | 4 ++++ environments/seaquest.py | 4 ++++ environments/space_invaders.py | 4 ++++ minatar_environment/environment.py | 3 +++ setup.py | 2 +- 7 files changed, 24 insertions(+), 1 deletion(-) diff --git a/environments/asterix.py b/environments/asterix.py index e60cfd7..5c5ff4f 100644 --- a/environments/asterix.py +++ b/environments/asterix.py @@ -149,3 +149,7 @@ def reset(self): # Dimensionality of the game-state (10x10xn) def state_shape(self): return [10,10,len(self.channels)] + + def minimal_action_set(self): + minimal_actions = ['n','l','u','r','d'] + return [self.action_map.index(x) for x in minimal_actions] diff --git a/environments/breakout.py b/environments/breakout.py index a349170..499066b 100644 --- a/environments/breakout.py +++ b/environments/breakout.py @@ -124,3 +124,7 @@ def reset(self): # Dimensionality of the game-state (10x10xn) def state_shape(self): return [10,10,len(self.channels)] + + def minimal_action_set(self): + minimal_actions = ['n','l','r'] + return [self.action_map.index(x) for x in minimal_actions] diff --git a/environments/freeway.py b/environments/freeway.py index 219eb41..a9a1ab4 100644 --- a/environments/freeway.py +++ b/environments/freeway.py @@ -138,3 +138,7 @@ def reset(self): # Dimensionality of the game-state (10x10xn) def state_shape(self): return [10,10,len(self.channels)] + + def minimal_action_set(self): + minimal_actions = ['n','u','d'] + return [self.action_map.index(x) for x in minimal_actions] diff --git a/environments/seaquest.py b/environments/seaquest.py index 6e81eab..9a4bc56 100644 --- a/environments/seaquest.py +++ b/environments/seaquest.py @@ -305,3 +305,7 @@ def reset(self): # Dimensionality of the game-state (10x10xn) def state_shape(self): return [10,10,len(self.channels)] + + def minimal_action_set(self): + minimal_actions = ['n','l','u','r','d','f'] + return [self.action_map.index(x) for x in minimal_actions] diff --git a/environments/space_invaders.py b/environments/space_invaders.py index 9262236..76ad3ef 100644 --- a/environments/space_invaders.py +++ b/environments/space_invaders.py @@ -150,3 +150,7 @@ def reset(self): # Dimensionality of the game-state (10x10xn) def state_shape(self): return [10,10,len(self.channels)] + + def minimal_action_set(self): + minimal_actions = ['n','l','r','f'] + return [self.action_map.index(x) for x in minimal_actions] diff --git a/minatar_environment/environment.py b/minatar_environment/environment.py index 77787d8..8a03d0c 100644 --- a/minatar_environment/environment.py +++ b/minatar_environment/environment.py @@ -48,3 +48,6 @@ def num_actions(self): def game_name(self): return self.env_name + + def minimal_action_set(self): + return self.env.minimal_action_set() diff --git a/setup.py b/setup.py index 61c3934..4bfe880 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup setup(name='MinAtar', - version='1.0.1', + version='1.0.2', description='A miniaturized version of the arcade learning environment.', url='https://github.com/kenjyoung/MinAtar', author='Kenny Young',