Skip to content

Commit

Permalink
[puzzles] Add Megaminx key map.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Nov 30, 2024
1 parent e15d139 commit ce3586f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const cube3x3x3KeyMapping: { [key: number | string]: AlgLeaf } = {
KeyH: new Move("F"),
KeyG: new Move("F'"),

KeyN: new Move("x'"),
KeyC: new Move("l"),
KeyR: new Move("l'"),
KeyU: new Move("r"),
Expand All @@ -28,6 +27,7 @@ export const cube3x3x3KeyMapping: { [key: number | string]: AlgLeaf } = {
KeyT: new Move("x"),
KeyY: new Move("x"),
KeyV: new Move("x'"),
KeyN: new Move("x'"),
Semicolon: new Move("y"),
KeyA: new Move("y'"),
KeyP: new Move("z"),
Expand Down
2 changes: 1 addition & 1 deletion src/cubing/puzzles/implementations/3x3x3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ export const cube3x3x3 = {
): Promise<StickeringMask> => cubeLikeStickeringMask(cube3x3x3, stickering),
stickerings: () => cubeLikeStickeringList("3x3x3"),
puzzleSpecificSimplifyOptions: puzzleSpecificSimplifyOptions333,
keyMapping: async () => cube3x3x3KeyMapping,
keyMapping: async () => cube3x3x3KeyMapping, // TODO: async loading
} satisfies PuzzleLoader;
3 changes: 3 additions & 0 deletions src/cubing/puzzles/implementations/megaminx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
megaminxStickeringMask,
megaminxStickerings,
} from "../../stickerings/megaminx-stickerings";
import { megaminxKeyMapping } from "./megaminxKeyMapping";

class MegaminxPuzzleLoader extends PGPuzzleLoader {
constructor() {
Expand All @@ -25,6 +26,8 @@ class MegaminxPuzzleLoader extends PGPuzzleLoader {
return (await import("../dynamic/megaminx/puzzles-dynamic-megaminx"))
.megaminxLLSVG;
});

keyMapping = async () => megaminxKeyMapping; // TODO: async loading
}

export const megaminx = new MegaminxPuzzleLoader();
41 changes: 41 additions & 0 deletions src/cubing/puzzles/implementations/megaminx/megaminxKeyMapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Move, Pause, type AlgLeaf } from "../../../alg";

// See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code

export const megaminxKeyMapping: { [key: number | string]: AlgLeaf } = {
KeyI: new Move("R"),
KeyK: new Move("R'"),
KeyW: new Move("B"),
KeyO: new Move("B'"),
KeyS: new Move("FR"),
KeyL: new Move("FR'"),
KeyD: new Move("L"),
KeyE: new Move("L'"),
KeyJ: new Move("U"),
KeyF: new Move("U'"),
KeyH: new Move("F"),
KeyG: new Move("F'"),

KeyC: new Move("Lw"),
KeyR: new Move("Lw'"),
KeyU: new Move("Rw"),
KeyM: new Move("Rw'"),

KeyX: new Move("d"),
Comma: new Move("d'"),

KeyT: new Move("Rv"),
KeyY: new Move("Rv"),
KeyV: new Move("Rv'"),
KeyN: new Move("Rv'"),
Semicolon: new Move("y"),
KeyA: new Move("y'"),
KeyP: new Move("z"),
KeyQ: new Move("z'"),

KeyZ: new Move("2L'"),
KeyB: new Move("2R"),
Period: new Move("2R'"),

Backquote: new Pause(),
};

0 comments on commit ce3586f

Please sign in to comment.