Fix puzzle loop state handling and zero counting - #53
Open
marccyzz wants to merge 2 commits into
Open
Conversation
This patch improves the puzzle bot flow in `puzzle.py`. It refreshes the captured puzzle image before reading the current piece color and before rebuilding the board state, so the bot no longer relies on stale image data between states. It also fixes the board-state evaluation by using `count_zeros()` correctly and adds a small debug output to help inspect detected free cells during runtime. These changes should make the puzzle state machine more reliable and reduce cases where the bot clicks based on outdated puzzle information.
Fix `count_zeros()` so the puzzle board state uses the correct number of empty cells.
|
is it working ? |
Author
|
unfortunately not |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes a few issues in the puzzle bot logic.
Changes:
tetris.pyplay_game()Why:
The previous implementation could work with stale screenshots and could also treat a successful move as a failed one. That could lead to wrong board detection, incorrect state transitions, and clicks outside the intended puzzle area.
I tested the logic flow locally and the changes are meant to make the puzzle state machine more reliable.