// Puzzle definition for Skewb
var pzl = {};
// Define panel vertices in 3D
pzl.panels = [
[[-.0, -.5, -.5], [-.5, -.0, -.5], [-.0, +.5, -.5], [+.5, -.0, -.5]],
[[-.0, -.5, -.5], [-.5, -.0, -.5], [-.5, -.5, -.5]],
[[-.5, +.0, -.5], [-.0, +.5, -.5], [-.5, +.5, -.5]],
[[+.0, +.5, -.5], [+.5, +.0, -.5], [+.5, +.5, -.5]],
[[+.5, -.0, -.5], [+.0, -.5, -.5], [+.5, -.5, -.5]],
[[-.0, -.5, +.5], [-.5, -.0, +.5], [-.0, +.5, +.5], [+.5, -.0, +.5]],
[[-.0, -.5, +.5], [-.5, -.0, +.5], [-.5, -.5, +.5]],
[[-.5, +.0, +.5], [-.0, +.5, +.5], [-.5, +.5, +.5]],
[[+.0, +.5, +.5], [+.5, +.0, +.5], [+.5, +.5, +.5]],
[[+.5, -.0, +.5], [+.0, -.5, +.5], [+.5, -.5, +.5]],
[[+.0, -.5, -.5], [+.5, -.5, -.0], [+.0, -.5, +.5], [-.5, -.5, +.0]],
[[+.0, -.5, -.5], [+.5, -.5, -.0], [+.5, -.5, -.5]],
[[+.0, -.5, +.5], [+.5, -.5, +.0], [+.5, -.5, +.5]],
[[-.0, -.5, -.5], [-.5, -.5, -.0], [-.5, -.5, -.5]],
[[-.0, -.5, +.5], [-.5, -.5, +.0], [-.5, -.5, +.5]],
[[+.0, +.5, -.5], [+.5, +.5, -.0], [+.0, +.5, +.5], [-.5, +.5, +.0]],
[[+.0, +.5, -.5], [+.5, +.5, -.0], [+.5, +.5, -.5]],
[[+.0, +.5, +.5], [+.5, +.5, +.0], [+.5, +.5, +.5]],
[[-.0, +.5, -.5], [-.5, +.5, -.0], [-.5, +.5, -.5]],
[[-.0, +.5, +.5], [-.5, +.5, +.0], [-.5, +.5, +.5]],
[[+.5, -.0, -.5], [+.5, +.5, -.0], [+.5, -.0, +.5], [+.5, -.5, +.0]],
[[+.5, -.0, -.5], [+.5, -.5, -.0], [+.5, -.5, -.5]],
[[+.5, -.5, +.0], [+.5, -.0, +.5], [+.5, -.5, +.5]],
[[+.5, +.0, +.5], [+.5, +.5, +.0], [+.5, +.5, +.5]],
[[+.5, +.5, -.0], [+.5, +.0, -.5], [+.5, +.5, -.5]],
[[-.5, -.0, -.5], [-.5, +.5, -.0], [-.5, -.0, +.5], [-.5, -.5, +.0]],
[[-.5, -.0, -.5], [-.5, -.5, -.0], [-.5, -.5, -.5]],
[[-.5, -.5, +.0], [-.5, -.0, +.5], [-.5, -.5, +.5]],
[[-.5, +.0, +.5], [-.5, +.5, +.0], [-.5, +.5, +.5]],
[[-.5, +.5, -.0], [-.5, +.0, -.5], [-.5, +.5, -.5]]
];
var pnl = pzl.panels;
// Provide a panel that represents each of the puzzle's faces (this is used to create a plane that is used to detect the solved state)
pzl.faces = {
U:pnl[0],
D:pnl[5],
F:pnl[10],
B:pnl[15],
R:pnl[20],
L:pnl[25]
};
var T = Vzr.MoveType; // Three types are ROTATE (A full rotation around the plane's orthogonal axis), TOUCH (rotation of the panels touching the plane), ABOVE (rotation of the panels on and above the plane)
// Define moves
pzl.moves = {
'DFL': {plane: [pnl[20][0], pnl[20][3], pnl[25][2], pnl[25][1]], angle:-120, type: T.ABOVE},
'DFR': {plane: [pnl[0][1], pnl[0][2], pnl[5][3], pnl[5][0]], angle:-120, type: T.ABOVE},
'DBL': {plane: [pnl[0][3], pnl[0][0], pnl[5][2], pnl[5][1]], angle:-120, type: T.ABOVE},
'DBR': {plane: [pnl[0][0], pnl[0][1], pnl[5][2], pnl[5][3]], angle:-120, type: T.ABOVE},
'UFL': {plane: [pnl[5][3], pnl[5][2], pnl[0][1], pnl[0][0]], angle:-120, type: T.ABOVE},
'UFR': {plane: [pnl[5][2], pnl[5][1], pnl[0][0], pnl[0][3]], angle:-120, type: T.ABOVE},
'UBL': {plane: [pnl[5][0], pnl[5][3], pnl[0][2], pnl[0][1]], angle:-120, type: T.ABOVE},
'UBR': {plane: [pnl[25][1], pnl[25][2], pnl[20][3], pnl[20][0]], angle:-120, type: T.ABOVE},
'L': {plane: [pnl[20][0], pnl[20][3], pnl[25][2], pnl[25][1]], angle:120, type: T.ABOVE},
'R': {plane: [pnl[0][0], pnl[0][1], pnl[5][2], pnl[5][3]], angle:120, type: T.ABOVE},
'D': {plane: [pnl[5][2], pnl[5][1], pnl[0][0], pnl[0][3]], angle:120, type: T.ABOVE},
'F': {plane: [pnl[5][2], pnl[5][1], pnl[0][0], pnl[0][3]], angle:120, type: T.ABOVE},
'B': {plane: [pnl[0][3], pnl[0][0], pnl[5][2], pnl[5][1]], angle:120, type: T.ABOVE},
'U': {plane: [pnl[0][3], pnl[0][0], pnl[5][2], pnl[5][1]], angle:120, type: T.ABOVE},
'y' : {plane: [pnl[1][2], pnl[2][2], pnl[3][2], pnl[4][2]], angle:90, type: T.ROTATE},
'z' : {plane: [pnl[16][2], pnl[17][2], pnl[18][2], pnl[19][2]], angle:90, type: T.ROTATE},
'x' : {plane: [pnl[26][2], pnl[27][2], pnl[28][2], pnl[29][2]], angle:90, type: T.ROTATE},
};
// Panels to use for mouse-activated moves
pzl.panelMoves = {
'DFL' : [13, 1, 26],
'DFR' : [11, 21, 4],
'DBL' : [2, 29, 18],
'DBR' : [24, 16, 3],
'UFL' : [14, 6, 27],
'UFR' : [22, 12, 9],
'UBL' : [7, 28, 19],
'UBR' : [17, 8, 23],
};
// Key bindings
pzl.keys = {
'76':'L', // L
'82':'R', // R
'85':'U', // U
'68':'D', // D
'70':'F', // F
'66':'B', // B
'90':'z', // z
'89':'y', // y
'88':'x' //x
};
// CSS colours to use
pzl.palette = {
'y': '#E6D223', // Yellow
'r': '#7F0000', // Red
'o': '#DF622D', // Orange
'b': '#010080', // Blue
'g': '#008001', // Green
'w': '#FFFFFF' // White
};
// Colours of each panel
pzl.fc = "yyyyywwwwwbbbbbgggggrrrrrooooo";
// Initial view angle
pzl.rotation = { pitch:30, yaw:45 };