Spaces:
Sleeping
Sleeping
File size: 1,730 Bytes
8d694b6 7f7b2cc 1afe868 9d0c4b5 c6ef322 8d694b6 c6ef322 fce499e 4c67d79 7f7b2cc c6ef322 8d694b6 7f7b2cc f3bc628 9d0c4b5 f3bc628 9d0c4b5 1afe868 c6ef322 1afe868 8d694b6 f3bc628 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
export type FacingDirection = 'front' | 'back' | 'right' | 'left' | 'up' | 'down';
export type RotationDirection = 'clockwise' | 'counter-clockwise';
export const CubeColors: Record<FacingDirection, string> = {
front: '#ff0000', // Red
back: '#ff00ff', // Purple
right: '#0000ff', // Blue
left: '#00ff00', // Green
up: '#ffff00', // Yellow
down: '#ffffff', // White
};
export const Color2Index: Record<string, number> = {
'#ff0000': 0,
'#ff00ff': 1,
'#0000ff': 2,
'#00ff00': 3,
'#ffff00': 4,
'#ffffff': 5,
};
export const Index2Color: Record<number, string> = {
0: 'R',
1: 'P',
2: 'B',
3: 'G',
4: 'Y',
5: 'W',
};
export const Rotations: Record<FacingDirection, [number, number, number]> = {
front: [0, 0, 0],
back: [0, Math.PI, 0],
right: [0, Math.PI / 2, 0],
left: [0, -Math.PI / 2, 0],
up: [-Math.PI / 2, 0, 0],
down: [Math.PI / 2, 0, 0],
};
export type RotationStep = {
faceDirection: FacingDirection;
direction: RotationDirection;
};
export const Actions: Array<RotationStep> = [
{ faceDirection: 'front', direction: 'clockwise' },
{ faceDirection: 'front', direction: 'counter-clockwise' },
{ faceDirection: 'back', direction: 'clockwise' },
{ faceDirection: 'back', direction: 'counter-clockwise' },
{ faceDirection: 'right', direction: 'clockwise' },
{ faceDirection: 'right', direction: 'counter-clockwise' },
{ faceDirection: 'left', direction: 'clockwise' },
{ faceDirection: 'left', direction: 'counter-clockwise' },
{ faceDirection: 'up', direction: 'clockwise' },
{ faceDirection: 'up', direction: 'counter-clockwise' },
{ faceDirection: 'down', direction: 'clockwise' },
{ faceDirection: 'down', direction: 'counter-clockwise' },
];
|