Reduce flash size of TetrisAI_V2 by 97%#5317
Merged
softhack007 merged 1 commit intowled:mainfrom Jan 27, 2026
Merged
Conversation
Main branch without Tetris Flash: [======== ] 79.8% (used 1255301 bytes from 1572864 bytes) Main branch with Tetris (+196kb) Flash: [========= ] 92.3% (used 1452049 bytes from 1572864 bytes) This commit with Tetris (+6kb, 97% less flash) Flash: [======== ] 80.2% (used 1261625 bytes from 1572864 bytes)
Contributor
WalkthroughThis PR removes unused include dependencies from three header files in the TetrisAI_v2 module and refactors the TetrisBag class by removing a public method overload and replacing std::rotate with a manual loop implementation. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@usermods/TetrisAI_v2/tetrisbag.h`:
- Around line 86-92: queuePiece() can underflow when the queue is empty because
piecesQueue.size() - 1 will wrap and cause out-of-range access; fix by returning
early (or asserting) when the queue is empty (e.g., check piecesQueue.empty() or
queueLength == 0) before shifting elements and assigning getNextPiece(),
ensuring you guard the piecesQueue access in queuePiece().
Aircoookie
approved these changes
Jan 24, 2026
Member
Aircoookie
left a comment
There was a problem hiding this comment.
LGTM, thank you! Awesome that we can achieve such huge flash savings by avoiding these imports
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.
Main branch without Tetris
Flash: [======== ] 79.8% (used 1255301 bytes from 1572864 bytes)
Main branch with Tetris (+196kb)
Flash: [========= ] 92.3% (used 1452049 bytes from 1572864 bytes)
This commit with Tetris (+6kb, 97% less flash)
Flash: [======== ] 80.2% (used 1261625 bytes from 1572864 bytes)
Summary by CodeRabbit
Release Notes
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.