Open
Conversation
- findPieces.tsx - Fixed getUpdate to handle invalid square values (undefined/NaN/out-of-bounds)
- findPieces.tsx - Reset state after detecting a move so subsequent moves can be detected
- math.tsx - Fixed zeros to use Array.from({ length: rows }, ...) instead of sparse array
- gameSlice.tsx - Added playUci method with makeSan for opponent moves
- types.tsx - Added fromOpponent field to prevent sending opponent moves back to Lichess
- lichess.tsx - Changed alert() to console.error() for error handling
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.
Please note - this commit was AI-generated and I am not a very competent TS dev, please review before accepting. Summary of changes:
src/utils/findPieces.tsx- FixedgetUpdatefunction (line 132)if (square == -1)toif (typeof square !== 'number' || !Number.isInteger(square) || square < 0 || square >= 64)TypeError: can't access property 0, update[square] is undefined- handles undefined/NaN/out-of-bounds square values from tensor operationssrc/utils/findPieces.tsx- Reset state after move detection (lines 223, 240)state = zeros(64, 12);after both move detection pathssrc/utils/math.tsx- Fixed zeros functionArray.from(Array(rows), ...)toArray.from({ length: rows }, ...)src/components/play/playSidebar.tsx- Fixed opponent move handlingboard.move(lastMove)toboard.playUci(lastMove)fromOpponentcheck to prevent sending opponent moves back to Lichesssrc/slices/gameSlice.tsx- Added playUci methodparseUciimport andmakeSanfor converting UCI moves to SAN notationsrc/types.tsx&src/slices/gameSlice.tsx- AddedfromOpponentfieldsrc/utils/lichess.tsx- Removed alert popupalert(err)toconsole.error(err)