Skip to content

Commit

Permalink
[puzzle-geometry] Rename several icosehedral puzzles.
Browse files Browse the repository at this point in the history
As suggested at: #336
  • Loading branch information
lgarron committed Oct 3, 2024
1 parent 2ddd0dd commit f9b74a8
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
3 changes: 3 additions & 0 deletions script/test/src/import-restrictions/allowedImports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ export const mainAllowedImports: AllowedImports = {
"src/sites/experiments.cubing.net/cubing.js/rust/wasm": {
static: ["getbuiltinmodule-ponyfill"],
},
"src/sites/alpha.twizzle.net/explore": {
static: ["src/cubing/puzzle-geometry/cubing-private"],
},
};

// This is a separate definition because the `spec` files are interleaved with source files, and it's easier to run a separate check for them.
Expand Down
4 changes: 2 additions & 2 deletions src/bin/puzzle-geometry-bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ little chop, pyramorphix, mastermorphix, pyraminx, Jing pyraminx,
master paramorphix, megaminx, gigaminx, pentultimate, starminx,
starminx 2, pyraminx crystal, chopasaurus, big chop, skewb diamond,
FTO, Christopher's jewel, octastar, Trajber's octahedron, radio chop,
icosamate, icosahedron 2, icosahedron 3, icosahedron static faces,
icosahedron moving faces, and Eitan's star.
icosamate, Regular Astrominx, Regular Astrominx + Big Chop,
Redicosahedron, Redicosahedron with centers,Icosaminx, and Eitan's star.
Examples:
puzzlegeometry --ss 2x2x2
Expand Down
13 changes: 7 additions & 6 deletions src/cubing/puzzle-geometry/PGPuzzles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ const expectedData: { [name: string]: string | null } = {
"Trajber's octahedron": "Trajber's octahedron, 8, 7, 26, 3, 9, 120",
"radio chop": "radio chop, 20, 10, 92, 3, 20, 41580",
icosamate: slow("icosamate, 20, 4, 32, 2, 12, 720"),
"icosahedron 2": slow("icosahedron 2, 20, 9, 102, 3, 18, 432630"),
"icosahedron 3": slow("icosahedron 3, 20, 18, 360, 6, 48, 1615854240"),
"icosahedron static faces": slow(
"icosahedron static faces, 20, 7, 62, 3, 18, 180",
"Regular Astrominx": slow("Regular Astrominx, 20, 9, 102, 3, 18, 432630"),
"Regular Astrominx + Big Chop": slow(
"Regular Astrominx + Big Chop, 20, 18, 360, 6, 48, 1615854240",
),
"icosahedron moving faces": slow(
"icosahedron moving faces, 20, 7, 62, 3, 18, 180",
Redicosahedron: slow("Redicosahedron, 20, 6, 42, 2, 18, 180"),
"Redicosahedron with centers": slow(
"Redicosahedron with centers, 20, 7, 62, 3, 18, 180",
),
Icosaminx: slow("Icosaminx, 20, 7, 62, 3, 18, 180"),
"Eitan's star": slow("Eitan's star, 20, 13, 152, 4, 30, 384560"),
"2x2x2 + dino": "2x2x2 + dino, 6, 8, 24, 1, 18, 70",
"2x2x2 + little chop": "2x2x2 + little chop, 6, 8, 48, 2, 18, 168",
Expand Down
16 changes: 12 additions & 4 deletions src/cubing/puzzle-geometry/PGPuzzles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ export const PGPuzzles: { [name: string]: PuzzleDescriptionString } = {
"Trajber's octahedron": "o v 0.433012701892219",
"radio chop": "i f 0",
icosamate: "i v 0",
"icosahedron 2": "i v 0.18759247376021",
"icosahedron 3": "i v 0.18759247376021 e 0",
"icosahedron static faces": "i v 0.84",
"icosahedron moving faces": "i v 0.73",
"Regular Astrominx": "i v 0.18759247376021",
"Regular Astrominx + Big Chop": "i v 0.18759247376021 e 0",
Redicosahedron: "i v 0.794654472291766",
"Redicosahedron with centers": "i v 0.84",
Icosaminx: "i v 0.73",
"Eitan's star": "i f 0.61803398874989",
"2x2x2 + dino": "c f 0 v 0.577350269189626",
"2x2x2 + little chop": "c f 0 e 0",
Expand All @@ -85,4 +86,11 @@ export const PGPuzzles: { [name: string]: PuzzleDescriptionString } = {
"starminx combo": "d f 0.23606797749979 v 0.937962370425399",
};

export const legacyPuzzleNameMapping: Partial<Record<string, string>> = {
"icosahedron 2": "Regular Astrominx",
"icosahedron 3": "Regular Astrominx + Big Chop",
"icosahedron static faces": "Redicosahedron with centers",
"icosahedron moving faces": "Icosaminx",
};

export type PuzzleName = keyof typeof PGPuzzles;
1 change: 1 addition & 0 deletions src/cubing/puzzle-geometry/cubing-private/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { legacyPuzzleNameMapping } from "../PGPuzzles";
8 changes: 7 additions & 1 deletion src/sites/alpha.twizzle.net/explore/url-params.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// TODO: implement URL listener.

import { Alg } from "../../../cubing/alg";
import { legacyPuzzleNameMapping } from "../../../cubing/puzzle-geometry/cubing-private";

export interface PartialURLParamValues {
alg?: Alg;
puzzle?: string;
puzzlegeometry?: string;
"puzzle-description": string;
"puzzle-description"?: string;
"debug-show-render-stats"?: boolean;
tempo?: string;
}
Expand Down Expand Up @@ -135,3 +136,8 @@ export function setURLParams(newParams: PartialURLParamValues): void {
}
window.history.replaceState("", "", url.toString());
}

const remappedPuzzleName = legacyPuzzleNameMapping[getURLParam("puzzle")];
if (remappedPuzzleName) {
setURLParams({ puzzle: remappedPuzzleName });
}

0 comments on commit f9b74a8

Please sign in to comment.