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

Improved logic for _is_game_over #14

Open
helpingstar opened this issue Jun 1, 2023 · 0 comments
Open

Improved logic for _is_game_over #14

helpingstar opened this issue Jun 1, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@helpingstar
Copy link
Owner

if self._is_reach_goal():
reward = 1
terminated = True
else:
self.spawnblock()
terminated = self._is_game_over()
if terminated:
self._update_best_score()
reward = -1
else:
reward = 0
else:
self.is_legal = False
terminated = False
reward = 0
self._update_legal_moves()

When action_mask is all 0, it means the game is over. The current code uses the same logic twice. This can be improved.

@helpingstar helpingstar added the enhancement New feature or request label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant