UNPKG

arcanumcube

Version:
130 lines (129 loc) 4.38 kB
export declare const CUBE_SIZE = 3; export declare const SIDE_MAX: number; export declare const SIDE_MIN = 0; export declare const SIDE_MIDDLE: number; export declare const STICKER_COLOR: { UP: number; FRONT: number; RIGHT: number; DOWN: number; BACK: number; LEFT: number; PLAIN: number; }; export type StickerColor = (typeof STICKER_COLOR)[keyof typeof STICKER_COLOR]; export declare const CUBE: { readonly AXIS: "axis"; readonly CENTER: "center"; readonly EDGE: "edge"; readonly CORNER: "corner"; readonly STICKER: "sticker"; }; export type CubeType = (typeof CUBE)[keyof typeof CUBE]; export declare const FACE: Record<string, number>; export type Face = (typeof FACE)[keyof typeof FACE]; export declare const TWIST: { readonly U: "U"; readonly UR: "U'"; readonly F: "F"; readonly FR: "F'"; readonly R: "R"; readonly RR: "R'"; readonly D: "D"; readonly DR: "D'"; readonly B: "B"; readonly BR: "B'"; readonly L: "L"; readonly LR: "L'"; readonly M: "M"; readonly MR: "M'"; readonly E: "E"; readonly ER: "E'"; readonly S: "S"; readonly SR: "S'"; readonly U2: "U2"; readonly F2: "F2"; readonly R2: "R2"; readonly D2: "D2"; readonly B2: "B2"; readonly L2: "L2"; readonly M2: "M2"; readonly E2: "E2"; readonly S2: "S2"; }; export type Twist = (typeof TWIST)[keyof typeof TWIST]; export declare const SINGLE_TWIST_LIST: readonly ["U", "U'", "F", "F'", "R", "R'", "D", "D'", "B", "B'", "L", "L'", "M", "M'", "E", "E'", "S", "S'"]; export declare const DOUBLE_TWIST_LIST: readonly ["U2", "F2", "R2", "D2", "B2", "L2", "M2", "E2", "S2"]; export declare const TWIST_LIST: ("U" | "F" | "R" | "D" | "B" | "L" | "U'" | "F'" | "R'" | "D'" | "B'" | "L'" | "M" | "M'" | "E" | "E'" | "S" | "S'" | "U2" | "F2" | "R2" | "D2" | "B2" | "L2" | "M2" | "E2" | "S2")[]; export declare const CUBE_ANGLES: Twist[][][][]; export declare const TWIST_RULE: Record<Twist, { axis: [x: number, y: number, z: number]; levels: number[]; steps: number; }>; export declare function getStickerIndex(x: number, y: number, z: number, face: Face): number; export declare function getCubeFromStickerIndex(index: number): [x: number, y: number, z: number, face: Face]; export declare function getRandomTwistList(steps?: number): Twist[]; export declare function MatchGoalState(state: StickerColor[]): boolean; export type Sticker = { face: Face; color: StickerColor; }; /** One small cube class that makes up the Arcanum Cube */ export declare class Cube { type: string; position: { x: number; y: number; z: number; }; protected _stickers: Sticker[]; protected _initialPosition: { x: number; y: number; z: number; }; constructor(x: number, y: number, z: number); getStickers(): Sticker[]; init(): void; reset(): void; rotateStickerFace(twists: Twist[], reverse?: boolean, init?: boolean): void; } /** Arcanum Cube object class */ export declare class ArcanumCube { /** output debug information to console */ debug: boolean; /** history of twisting */ protected _history: Twist[]; /** cube objects matrix */ protected _matrix: Cube[][][]; constructor(options?: { debug?: boolean; }); init(): void; reset(): void; scramble(steps?: number): void; undo(steps?: number): void; isSolved(): boolean; getHistory(): Twist[]; getUndoList(steps?: number): Twist[]; twist(twist: Twist | Twist[], reverse?: boolean): void; private _twist; rotateMatrix(twist: Twist, reverse?: boolean): void; getStickerColors(): StickerColor[]; dumpStickers(): void; } export declare function getNextStickerColors(stickers: StickerColor[], twist: Twist): StickerColor[]; export declare function getArrayForTensor(stickers: StickerColor[]): number[][][]; export declare function getCubePermutationGroup(twist: Twist, reverse?: boolean): { before: number[][]; after: number[][]; stickers: { before: number[]; after: number[]; }; }; export declare function getStickerPermutationGroup(position: [x: number, y: number, z: number], position2: [x: number, y: number, z: number], twists: Twist[], reverse?: boolean): { before: number[]; after: number[]; };