From c5f4f9526af8f8aa057ead5ed623b04e189ca44e Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Sun, 1 May 2022 10:48:41 +1000 Subject: [PATCH 1/3] Explicitly specify gym version 0.20.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d33850a..5c0f3d4 100644 --- a/setup.py +++ b/setup.py @@ -3,5 +3,5 @@ setup( name='gym_go', version='0.0.1', - install_requires=['gym'] # and other dependencies + install_requires=['gym==0.20.0'] # and other dependencies ) From 53ffc843eb08ff25224bf27f824ab293266e25b6 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Sun, 1 May 2022 12:02:56 +1000 Subject: [PATCH 2/3] Bump gym version to 0.21.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5c0f3d4..85f9319 100644 --- a/setup.py +++ b/setup.py @@ -3,5 +3,5 @@ setup( name='gym_go', version='0.0.1', - install_requires=['gym==0.20.0'] # and other dependencies + install_requires=['gym==0.21.0'] # and other dependencies ) From 6eca9a8ca2a0cc9271b0a6206e7c20b7b79cfd6a Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Sun, 1 May 2022 12:04:09 +1000 Subject: [PATCH 3/3] Always reset environment before use --- README.md | 1 + demo.py | 1 + gym_go/tests/test_basics.py | 3 +++ gym_go/tests/test_invalid_moves.py | 2 ++ 4 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 943e08d..4059f3a 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ pip install -e . import gym go_env = gym.make('gym_go:go-v0', size=7, komi=0, reward_method='real') +go_env.reset() first_action = (2,5) second_action = (5,2) diff --git a/demo.py b/demo.py index 9c9d2d5..39615f3 100644 --- a/demo.py +++ b/demo.py @@ -10,6 +10,7 @@ # Initialize environment go_env = gym.make('gym_go:go-v0', size=args.boardsize, komi=args.komi) +go_env.reset() # Game loop done = False diff --git a/gym_go/tests/test_basics.py b/gym_go/tests/test_basics.py index 307ed1f..abc4945 100644 --- a/gym_go/tests/test_basics.py +++ b/gym_go/tests/test_basics.py @@ -174,6 +174,7 @@ def test_num_liberties(self): def test_komi(self): env = gym.make('gym_go:go-v0', size=7, komi=2.5, reward_method='real') + env.reset() # White win _ = env.step(None) @@ -224,6 +225,7 @@ def test_children(self): def test_real_reward(self): env = gym.make('gym_go:go-v0', size=7, reward_method='real') + env.reset() # In game state, reward, done, info = env.step((0, 0)) @@ -259,6 +261,7 @@ def test_real_reward(self): def test_heuristic_reward(self): env = gym.make('gym_go:go-v0', size=7, reward_method='heuristic') + env.reset() # In game state, reward, done, info = env.step((0, 0)) diff --git a/gym_go/tests/test_invalid_moves.py b/gym_go/tests/test_invalid_moves.py index 3693bbe..809d94f 100644 --- a/gym_go/tests/test_invalid_moves.py +++ b/gym_go/tests/test_invalid_moves.py @@ -186,6 +186,7 @@ def test_small_suicide(self): """ self.env = gym.make('gym_go:go-v0', size=3, reward_method='real') + self.env.reset() for move in [6, 7, 8, 5, 4, 8, 0, 1]: state, reward, done, info = self.env.step(move) @@ -203,6 +204,7 @@ def test_invalid_after_capture(self): """ self.env = gym.make('gym_go:go-v0', size=3, reward_method='real') + self.env.reset() for move in [0, 8, 6, 4, 1, 2, 3, 7]: state, reward, done, info = self.env.step(move)