Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MO Connect 4, Breakthrough and Samegame #21

Merged
merged 35 commits into from
Jan 22, 2024
Merged

MO Connect 4, Breakthrough and Samegame #21

merged 35 commits into from
Jan 22, 2024

Conversation

rradules
Copy link
Collaborator

@rradules rradules commented Dec 7, 2023

  • MO Connect 4, Breakthrough and Samegame environments
  • Also adds the "is_parallelizable" key to the metadata dict of the environments, when missing, to allow selective testing of the parallel environments

Copy link
Collaborator

@ffelten ffelten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a very quick check because I don't have much connection :-)

momaland/envs/breakthrough/breakthrough.py Show resolved Hide resolved
momaland/envs/breakthrough/breakthrough.py Show resolved Hide resolved
@override
def reset(self, seed=None, options=None):
if seed is not None:
np.random.seed(seed)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the PZ convention is to store self.seed and self.np_random from that call now. And use the self.np_random for rng stuff

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.random generators seem to not actually have all their state defined by the seed alone, which is why I store/restore their entire state in samegame.py. What do you think about that solution?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the only stochastic environment is samegame, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right

momaland/envs/connect4/connect4.py Show resolved Hide resolved
momaland/envs/connect4/connect4.py Show resolved Hide resolved
momaland/envs/samegame/samegame.py Outdated Show resolved Hide resolved
momaland/envs/samegame/samegame.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@wilrop wilrop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I just had some small questions or suggestions, but I think this is ready to be included into main.

I also very much liked the introduction of the check_[ENV].py files and think it might be useful to add one of those for every supported environment. The benefit is that you can just run the file to see if the output of the game still makes a little bit of sense. We could even put such sanity checks into an automated test for every environment. What do others think? @rradules @ffelten

momaland/envs/breakthrough/breakthrough.py Show resolved Hide resolved
momaland/envs/breakthrough/breakthrough.py Outdated Show resolved Hide resolved
momaland/envs/breakthrough/breakthrough.py Outdated Show resolved Hide resolved
momaland/envs/breakthrough/breakthrough.py Outdated Show resolved Hide resolved
momaland/envs/breakthrough/breakthrough.py Outdated Show resolved Hide resolved
momaland/envs/connect4/connect4.py Show resolved Hide resolved
@@ -0,0 +1,49 @@
"""MO Connect4 check."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually very much like these "check" files you have implemented. I think it would be good to have one of these sanity checks for each environment, maybe in a dedicated test runner? This should be discussed also with @rradules

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. CrazyRL environments have these as well in the main environment files 👍

momaland/envs/samegame/samegame.py Outdated Show resolved Hide resolved
momaland/envs/samegame/samegame.py Outdated Show resolved Hide resolved
momaland/envs/samegame/samegame.py Outdated Show resolved Hide resolved
@ffelten
Copy link
Collaborator

ffelten commented Dec 12, 2023

Looks good! I just had some small questions or suggestions, but I think this is ready to be included into main.

I also very much liked the introduction of the check_[ENV].py files and think it might be useful to add one of those for every supported environment. The benefit is that you can just run the file to see if the output of the game still makes a little bit of sense. We could even put such sanity checks into an automated test for every environment. What do others think? @rradules @ffelten

I'm not sure what's the addition here exactly but we can if needed define a run_episode helper somewhere and call it from __main__ in the env file.

@wilrop
Copy link
Collaborator

wilrop commented Dec 13, 2023

@ffelten Having thought about it a little bit more, I realised that having such a check env file is only useful during development, and after that has concluded its role is taken over by the test_module method. Therefore, you can ignore the remark :)

@rradules rradules requested review from threepwoody and removed request for hiazmani December 18, 2023 12:51
@rradules rradules merged commit c8b12c2 into main Jan 22, 2024
10 checks passed
@rradules rradules deleted the mo-games branch January 22, 2024 19:41
@hiazmani hiazmani restored the mo-games branch January 23, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants