Skip to content

Pull Request: New "Scramble Yourself" Train Mode & UI Improvements#52

Merged
Dave2ooo merged 46 commits into
mainfrom
trainmode-smart-scramble
Jun 8, 2026
Merged

Pull Request: New "Scramble Yourself" Train Mode & UI Improvements#52
Dave2ooo merged 46 commits into
mainfrom
trainmode-smart-scramble

Conversation

@Dave2ooo

@Dave2ooo Dave2ooo commented Jun 8, 2026

Copy link
Copy Markdown
Owner

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)

  • Manual Scrambling Integration: A dedicated new mode where users must physically scramble the cube themselves based on the provided scramble sequence.
  • Improved Scramble UI:
    • Added directional arrows next to the scramble sequence.
    • Option to hide virtual cube piece colors (showing only center pieces) while scrambling to prevent looking ahead.
    • Removed the green outline when the correct move is applied during scrambling.
    • Added clear instructions on how to hold the cube during this mode.
  • Rotation Matching & Validation: The smart cube must now be rotated exactly to match the virtual cube's orientation. The app checks if the F2L case is fully solved before automatically proceeding to the next case.
  • Statistics Integration: The new train mode is fully integrated into the Statistics tracking, Session Stats, and Case Stats Modals.

⚙️ Session Settings Modal Enhancements

  • Inline-Editable Session Names: Session names can now be edited inline directly in the modal header (focus outline and blur issues resolved).
  • Tab Persistence: The active tab in the session settings modal is now persisted across opens.
  • Advanced Settings: Reorganized the arrangement, styled advanced buttons, and moved checkboxes for a cleaner interface.

💡 Hint & Algorithm Updates

  • "None" Option for Alg Hint: Users can now select "None" for algorithm hints, which bypasses algorithm validation in TrainClassicSmart.
  • "Always Show" Mode Support: Added a setting to manually show the hint algorithm when the smart cube is connected, properly supporting auto-track vs. manual hint behavior.
  • Visibility Toggles: Preserved the interactive hint viewer when toggling visibility, and correctly hide hint settings when "Hidden" or "Always Show" is selected.

🐛 Bug Fixes & UX Improvements

  • Undo Moves UI: Changed the "Undo Required" notification to appear on top of the scramble/alg to prevent layout shifts. Undo moves are now cleared when manually selecting the next case.
  • Timer Fixes: Fixed the timer not resetting when manually switching to the next case.
  • Validation Fixes: Restored move validation for scrambles in TrainClassicScramble and ignored wide move checks when algorithm hints are hidden.

Dave2ooo added 30 commits June 2, 2026 19:17
…cube must be rotated the same way as the virtual cube
Copilot AI review requested due to automatic review settings June 8, 2026 16:51
@Dave2ooo Dave2ooo merged commit 91c7cec into main Jun 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TrainClassicScramble mode (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 smartScrambless 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 = '';
}
@Dave2ooo Dave2ooo deleted the trainmode-smart-scramble branch June 10, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants