Add game wrapper for 2048 (homebrew)#418
Conversation
|
Awesome, I’ll get back to you asap, but it’ll take some days |
|
Can you point me to the ROM you used? The one here has a different MD5: |
|
Thanks for pointing that out! It seems I had an older version of the ROM. I've updated the wrapper to use the official ROM from wyattferguson's repository (MD5: |
There was a problem hiding this comment.
several unrelated formatting changes have been added, do see if these can be cleaned up.
| for p in sorted(list(set(plugins) - set(game_wrappers))): | ||
| p_name = to_snake_case(p) | ||
| spec = importlib.util.spec_from_file_location( | ||
| p_name, os.path.dirname(os.path.abspath(__file__)) + "/" + p_name + ".py" |
There was a problem hiding this comment.
here as well unrelated formatting changes have been introduced
There was a problem hiding this comment.
unrelated formatting changes have been added, please remove them
bhaskar253
left a comment
There was a problem hiding this comment.
several unrelated formatting changes have been added, please do avoid them
|
Thanks for the feedback! The formatting issues were caused by the Black formatter I had enabled in my editor. I've disabled it and fixed all the formatting. Sorry for the noise! |
Baekalfen
left a comment
There was a problem hiding this comment.
Short and sweet. Really nice work. Nothing functionally needed (if tests pass).
I've add the 2048 ROM to my mirror and added it to the conftest, so it automatically downloads it.
| try: | ||
| with open(self.pyboy.gamerom_file, "rb") as f: | ||
| rom_hash = hashlib.md5(f.read()).hexdigest() | ||
| return rom_hash == "6748719720d57a7dce48d07b2f3c5ede" | ||
| except Exception as e: | ||
| logger.error(f"Error occurred while checking ROM hash: {e}") | ||
| return False |
There was a problem hiding this comment.
I can see the game ROM is missing a title, and that's why you do this. I've tried raising the issue with the author: wyattferguson/2048-gb#1
| self.winner = self.pyboy.memory[0xC0F3] == 1 | ||
|
|
||
| state = self.pyboy.memory[0xC0F4] | ||
| self._game_over = state == 3 |
There was a problem hiding this comment.
What is "3"? You should define this magic number as a constant. Are there other interesting states to document?
There was a problem hiding this comment.
It would be nice if you made all of your addresses constants too, with a meaningful name.
e095403 to
846a7d2
Compare
|
I can see the tests are failing, but you can find the results in the runner outputs EDIT: |
Adds a game wrapper for the 2048 homebrew Game Boy game by wyattferguson.MD5:
6748719720d57a7dce48d07b2f3c5edeSHA256:
a5dd7ad505baf13bdf66736518c2d6708459c3aaf1ed2d2282f05c2d1d958d9cThe wrapper provides:
Tests included in tests/test_2048.py