Pull Request: New "Scramble Yourself" Train Mode & UI Improvements#52
Merged
Conversation
…yer shifts happen
…cube must be rotated the same way as the virtual cube
…w only center pieces are colored
There was a problem hiding this comment.
Pull request overview
This PR adds a new connected-smart-cube training flow (“Scramble Yourself”) and updates training/settings/statistics plumbing to support new hint behaviors, stickering options, and improved session settings UI.
Changes:
- Introduces
TrainClassicScramblemode (manual scrambling + countdown + recognition/execution timing + stats integration). - Extends hint/stickering/settings types and UI (e.g., hidden hints, “centers-only” stickering, manual smart hint behavior, tab persistence, inline session name editing).
- Updates stats trainMode compression/decompression and updates multiple training components’ timer/undo/hint presentation.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/utils/moveValidator.ts | Adds invertRotationsWithoutReversing to support frame mapping for rotations. |
| src/lib/utils/moveValidator.test.ts | Adds unit tests for move validation utilities (currently contains a compile-breaking syntax error). |
| src/lib/utils/checkF2LState.ts | Extends F2L checking to also report whether the entire F2L is solved. |
| src/lib/types/statisticsState.ts | Adds smartScramble train mode and compressed mode code ss. |
| src/lib/types/session.ts | Adds new session settings for smart hint behavior and scramble-yourself mode configuration. |
| src/lib/types/globalState.ts | Adds new hint/stickering options and session settings modal UI state (tab + advanced toggles). |
| src/lib/trainCases.test.ts | Updates session settings test defaults to include new required fields. |
| src/lib/statisticsState.svelte.ts | Adds mapping support for smartScramble ↔ ss compression. |
| src/lib/sessionState.svelte.ts | Adds defaults for new session settings (hint behavior + scramble-yourself settings). |
| src/lib/globalState.svelte.ts | Adds ephemeral UI state for advanced toggles + tab persistence. |
| src/lib/components/TwistyPlayer.svelte | Adds disableAutoScramble, new stickering mode centers-only, and updates F2L callback signature. |
| src/lib/components/TrainView/TrainView.svelte | Routes to TrainClassicScramble when connected + scramble-yourself enabled. |
| src/lib/components/TrainView/TrainClassicSmart.svelte | Adds manual hint behavior support; adjusts validation/undo/timer behaviors accordingly. |
| src/lib/components/TrainView/TrainClassicScramble.svelte | New training component implementing the scramble-yourself state machine + stats recording. |
| src/lib/components/TrainView/TrainClassic.svelte | Ensures timer resets properly when skipping cases; hides hint UI when hints are “hidden”. |
| src/lib/components/TrainView/Timer.svelte | Adjusts layout wrapper spacing. |
| src/lib/components/TrainView/SmartTimer.svelte | Adjusts layout wrapper spacing. |
| src/lib/components/TrainView/HintButtonSmart.svelte | Moves undo UI overlay into the button container to avoid layout shifts. |
| src/lib/components/TrainView/HintButton.svelte | Changes algorithm display rendering (chips → text string) and layout wrapper spacing. |
| src/lib/components/TrainView/DrillTimer.svelte | Adjusts layout wrapper spacing. |
| src/lib/components/Session/SessionSettingsModal.svelte | Major settings modal UI update: tabs, inline name editing, advanced sections, scramble-yourself settings. |
| src/lib/components/Modals/SessionStatsModal.svelte | Adds display/filter support for the new smartScramble train mode and UI tweaks. |
| src/lib/components/Modals/CaseStatsModal.svelte | Adds display/filter support for the new smartScramble train mode and small UI tweaks. |
| src/lib/components/Modal.svelte | Refactors header/footer snippet passing into FlowbiteModal props. |
| docs/implementation_plan_scramble_yourself_mode.md | Documents the implementation plan and design decisions for the new mode. |
| .gitignore | Ignores a new docs video script file. |
Comment on lines
+139
to
+143
| const seq1 = ['R', 'U', "R'"]; | ||
| const seq2 = ['R', 'U', "R'"]; | ||
| // Match full sequence | ||
| expect(matchesMoveSequence(['R', 'U', "R'"], ['R', 'U', "R'"]).match).toBe(true); | ||
|
|
Comment on lines
+209
to
+211
| if (stickering === 'centers-only') { | ||
| // 24 hyphens for edges and 24 hyphens for corners to hide all their stickers | ||
| return 'EDGES:IIIIIIIIIIII,CORNERS:IIIIIIII,CENTERS:------'; |
Comment on lines
+157
to
+163
| <button | ||
| type="button" | ||
| onclick={startEditingName} | ||
| class="rounded-lg p-1 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-500 dark:hover:bg-gray-700 dark:hover:text-white" | ||
| > | ||
| <Pencil class="size-4" /> | ||
| </button> |
Comment on lines
+524
to
+540
| function onNext() { | ||
| drillTimerRef?.reset(); | ||
| advanceToNextTrainCase(); | ||
| phase = 'scrambling'; | ||
| undoMoves = []; | ||
| twistyPlayerRef?.reset(); | ||
| movesAdded = ''; | ||
| } | ||
|
|
||
| function onPrevious() { | ||
| drillTimerRef?.reset(); | ||
| advanceToPreviousTrainCase(); | ||
| phase = 'scrambling'; | ||
| undoMoves = []; | ||
| twistyPlayerRef?.reset(); | ||
| movesAdded = ''; | ||
| } |
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.
Pull Request: New "Scramble Yourself" Train Mode & UI Improvements
Description
This PR introduces a brand new training mode—"Scramble Yourself" Mode (
TrainClassicScramble)—where users manually scramble their Bluetooth Smart Cube to match the case, instead of having it pre-scrambled. It also includes substantial UI improvements to the Session Settings Modal, and several bug fixes for hint behavior and undo functionality across all training modes.Key Features & Changes
🆕 New "Scramble Yourself" Train Mode (
TrainClassicScramble)⚙️ Session Settings Modal Enhancements
💡 Hint & Algorithm Updates
TrainClassicSmart.🐛 Bug Fixes & UX Improvements
TrainClassicScrambleand ignored wide move checks when algorithm hints are hidden.