-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchunk-YEU3QODT.js
2 lines (2 loc) · 2.84 KB
/
chunk-YEU3QODT.js
1
2
import{i as s}from"./chunk-6QGFZL3G.js";import{m as i,n as o}from"./chunk-Q4G5UL72.js";function F(t){return t.endsWith("v")||["x","y","z"].includes(t)?"Rotation":t.startsWith("2")||["M","E","S"].includes(t)?"Inner":"Outer"}var c;function h(){if(c)return c;c={};let t=[...Object.keys(s.moves),...Object.keys(s.derivedMoves)];for(let e of t)c[e]=F(e);return c}var m={OBTM:{Rotation:{constantFactor:0,amountFactor:0},Outer:{constantFactor:1,amountFactor:0},Inner:{constantFactor:2,amountFactor:0}},RBTM:{Rotation:{constantFactor:0,amountFactor:0},Outer:{constantFactor:1,amountFactor:0},Inner:{constantFactor:1,amountFactor:0}},OBQTM:{Rotation:{constantFactor:0,amountFactor:0},Outer:{constantFactor:0,amountFactor:1},Inner:{constantFactor:0,amountFactor:2}},RBQTM:{Rotation:{constantFactor:0,amountFactor:0},Outer:{constantFactor:0,amountFactor:1},Inner:{constantFactor:0,amountFactor:1}},ETM:{Rotation:{constantFactor:1,amountFactor:0},Outer:{constantFactor:1,amountFactor:0},Inner:{constantFactor:1,amountFactor:0}}};function M(t,e){let r=m[t];if(!r)throw new Error(`Invalid metric for 3x3x3: ${t}`);let n=h(),a=e.quantum.toString();if(!(a in n))throw new Error(`Invalid move for 3x3x3 ${t}: ${a}`);let g=n[a],{constantFactor:f,amountFactor:x}=r[g];return f+x*Math.abs(e.amount)}var u=class extends i{constructor(r){super();this.metric=r}traverseAlg(r){let n=0;for(let a of r.childAlgNodes())n+=this.traverseAlgNode(a);return n}traverseGrouping(r){let n=r.alg;return this.traverseAlg(n)*Math.abs(r.amount)}traverseMove(r){return this.metric(r)}traverseCommutator(r){return 2*(this.traverseAlg(r.A)+this.traverseAlg(r.B))}traverseConjugate(r){return 2*this.traverseAlg(r.A)+this.traverseAlg(r.B)}traversePause(r){return 0}traverseNewline(r){return 0}traverseLineComment(r){return 0}};function p(t){return"A"<=t&&t<="Z"}function y(t){let e=t.family;return p(e[0])&&e[e.length-1]==="v"||e==="x"||e==="y"||e==="z"||e==="T"?0:1}function d(t){return 1}function T(t){let e=t.family;return p(e[0])&&e[e.length-1]==="v"||e==="x"||e==="y"||e==="z"||e==="T"?0:1}function A(t){return Math.abs(t.amount)*T(t)}var B=o(u,[y]),b=o(u,[d]),C=o(u,[A]),R=o(u,[T]);function O(t,e,r){if(t.id==="3x3x3"){if(e in m)return o(u,[n=>M(e,n)])(r)}else switch(e){case"ETM":return b(r);case"RBTM":{if(t.pg)return R(r);break}case"RBQTM":{if(t.pg)return C(r);break}}throw new Error("Unsupported puzzle or metric.")}var l=class extends i{traverseAlg(e){let r=0;for(let n of e.childAlgNodes())r+=this.traverseAlgNode(n);return r}traverseGrouping(e){return this.traverseAlg(e.alg)*Math.abs(e.amount)}traverseMove(e){return 1}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 1}traverseNewline(e){return 0}traverseLineComment(e){return 0}},k=o(l);export{B as a,O as b,k as c};
//# sourceMappingURL=chunk-YEU3QODT.js.map