Skip to content

Commit 1c43df3

Browse files
committed
[twizzle/edit] Use real ETM (rotations count).
1 parent 21f0f48 commit 1c43df3

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/cubing/notation/CountMoves.ts

+9
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ function baseMetric(move: Move): number {
8484
}
8585
}
8686

87+
// TODO: Implement a puzzle-specific way to calculate this.
88+
function etmMetric(_move: Move): number {
89+
return 1;
90+
}
91+
8792
// TODO: Implement a puzzle-specific way to calculate this.
8893
function quantumMetric(move: Move): number {
8994
const fam = move.family;
@@ -104,6 +109,10 @@ const countMovesInstance = new CountMoves(baseMetric);
104109
export const countMoves: (alg: Alg) => number =
105110
countMovesInstance.traverseAlg.bind(countMovesInstance);
106111

112+
const countMovesETMInstance = new CountMoves(etmMetric);
113+
export const countMovesETM: (alg: Alg) => number =
114+
countMovesInstance.traverseAlg.bind(countMovesETMInstance);
115+
107116
const countQuantumMovesInstance = new CountMoves(quantumMetric);
108117
export const countQuantumMoves: (alg: Alg) => number =
109118
countQuantumMovesInstance.traverseAlg.bind(countQuantumMovesInstance);

src/cubing/notation/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Note: this folder is purposely not built as a package entry point (yet).
22

33
export {
4+
countMovesETM as experimentalCountMovesETM,
45
countMoves as experimentalCountMoves,
56
countQuantumMoves as experimentalCountQuantumMoves,
67
} from "./CountMoves";

src/sites/alpha.twizzle.net/edit/app.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Alg, AlgBuilder, LineComment, Newline } from "../../../cubing/alg";
22
import { experimentalEnsureAlg } from "../../../cubing/alg/Alg";
3+
import { experimentalCountMovesETM } from "../../../cubing/notation";
34
import { puzzles } from "../../../cubing/puzzles";
45
import { randomScrambleForEvent } from "../../../cubing/scramble";
56
import {
@@ -17,20 +18,19 @@ import {
1718
TwistyPlayer,
1819
TwistyPlayerConfig,
1920
} from "../../../cubing/twisty";
21+
import { getStickeringGroup } from "../../../cubing/twisty/model/props/puzzle/display/StickeringProp";
22+
import type { AlgWithIssues } from "../../../cubing/twisty/model/props/puzzle/state/AlgProp";
23+
import type { SetupToLocation } from "../../../cubing/twisty/model/props/puzzle/state/SetupAnchorProp";
24+
import { FreshListenerManager } from "../../../cubing/twisty/model/props/TwistyProp";
2025
import { customElementsShim } from "../../../cubing/twisty/views/node-custom-element-shims";
2126
import "../../../cubing/twisty/views/stream/TwistyStreamSource";
2227
import type { TwistyStreamSource } from "../../../cubing/twisty/views/stream/TwistyStreamSource";
2328
import type { TwistyAlgEditor } from "../../../cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor";
29+
import { URLParamUpdater } from "../../../cubing/twisty/views/twizzle/url-params";
2430
import { findOrCreateChild, findOrCreateChildWithClass } from "./dom";
2531
import { examples } from "./examples";
2632
import { APP_TITLE } from "./strings";
2733
import { puzzleGroups, supportedPuzzles } from "./supported-puzzles";
28-
import type { SetupToLocation } from "../../../cubing/twisty/model/props/puzzle/state/SetupAnchorProp";
29-
import { URLParamUpdater } from "../../../cubing/twisty/views/twizzle/url-params";
30-
import type { AlgWithIssues } from "../../../cubing/twisty/model/props/puzzle/state/AlgProp";
31-
import { experimentalCountMoves } from "../../../cubing/notation";
32-
import { getStickeringGroup } from "../../../cubing/twisty/model/props/puzzle/display/StickeringProp";
33-
import { FreshListenerManager } from "../../../cubing/twisty/model/props/TwistyProp";
3434
// import { setURLParams } from "./url-params";
3535

3636
// TODO: introduce concepts in `cubing/twisty` for "this is a valid twisty-player value, but not for the current puzzle".
@@ -266,7 +266,7 @@ class ControlPane {
266266
this.twistyPlayer.experimentalModel.puzzleAlg.addFreshListener(
267267
(algWithIssues: AlgWithIssues) => {
268268
if (algWithIssues.issues.errors.length == 0) {
269-
this.moveCountDisplay.textContent = ` (${experimentalCountMoves(
269+
this.moveCountDisplay.textContent = ` (${experimentalCountMovesETM(
270270
algWithIssues.alg,
271271
)} ETM)`;
272272
} else {

0 commit comments

Comments
 (0)