Repository navigation
Fix camera detection, persistent board locks, and move overlays - #6
Merged
Merged
Conversation
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.
Camera scans could lose their board boundary while refocusing, repeat stale corners indefinitely, or fail before detection because the API and detector accepted different arguments. This change restores image analysis, keeps a dashed boundary for up to eight seconds while hiding unverified advice, and releases expired geometry even when the client echoes old corners.
The detector now uses grid-line candidates and lighting-aware checker measurements, with occupancy sampling that tolerates moderate defocus. The frontend selects the sharpest of three camera frames, requests continuous focus where supported, preserves explicit manual corners, and follows automatic board rotation. Side-to-move correction is independent of playing color. Canceled captures cannot send stale requests, and unverified responses cannot consume position setup or replace the active position.
Cold Railway containers also receive a 15-second allowance to initialize Stockfish and load its neural network, followed by the normal three-second operation timeout. Previously, an initialization timeout could leave the deployment permanently using the weaker fallback engine.
Validation: 105 backend tests, 6 overlay unit tests, and 16 browser tests passed, including actual browser-to-backend image analysis, phone/tablet/desktop layouts, blur/shadow/low-contrast cases, lock expiry, turn tracking, camera cancellation, and aligned legal move overlays. The 16 engine tests also pass after adding a delayed real UCI subprocess regression for cold startup (106 backend cases in total). A saved physical photo localized successfully; the heavily occluded screen photo was withheld as unreadable.
Piece identities still require a standard starting arrangement or an exact FEN setup for an existing game. Downloaded experimental classifiers were evaluated and excluded after misreading physical pieces. Severe blur or occlusion cannot be treated as a verified position.