mtosity 0.0.2 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -24
- package/dist/cli.js +118 -0
- package/dist/commands/clock.js +303 -0
- package/dist/commands/game.js +30 -0
- package/dist/commands/harmonica.js +70 -0
- package/dist/commands/help.js +46 -0
- package/dist/commands/me.js +189 -0
- package/dist/commands/spicetify.js +153 -0
- package/dist/commands/system.js +195 -0
- package/dist/commands/whisky.js +158 -0
- package/dist/commands/youtube.js +73 -0
- package/dist/games/invaders/entities.js +47 -0
- package/dist/games/invaders/index.js +223 -0
- package/dist/games/invaders/renderer.js +105 -0
- package/dist/games/invaders/wave.js +44 -0
- package/dist/games/terminal.js +62 -0
- package/dist/games/tetris/bastard.js +56 -0
- package/dist/games/tetris/board.js +142 -0
- package/dist/games/tetris/index.js +146 -0
- package/dist/games/tetris/pieces.js +149 -0
- package/dist/games/tetris/renderer.js +188 -0
- package/dist/index.js +2 -169
- package/dist/utils/ffmpeg.js +15 -0
- package/dist/utils/network.js +29 -0
- package/package.json +4 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseKey = parseKey;
|
|
4
|
+
exports.hideCursor = hideCursor;
|
|
5
|
+
exports.showCursor = showCursor;
|
|
6
|
+
exports.moveTo = moveTo;
|
|
7
|
+
exports.clearScreen = clearScreen;
|
|
8
|
+
exports.clearLine = clearLine;
|
|
9
|
+
exports.enterGame = enterGame;
|
|
10
|
+
function parseKey(data) {
|
|
11
|
+
const s = data.toString();
|
|
12
|
+
if (s === "\x03")
|
|
13
|
+
return { name: "q", ctrl: true }; // Ctrl+C → quit
|
|
14
|
+
if (s === "\x1B[A")
|
|
15
|
+
return { name: "up", ctrl: false };
|
|
16
|
+
if (s === "\x1B[B")
|
|
17
|
+
return { name: "down", ctrl: false };
|
|
18
|
+
if (s === "\x1B[C")
|
|
19
|
+
return { name: "right", ctrl: false };
|
|
20
|
+
if (s === "\x1B[D")
|
|
21
|
+
return { name: "left", ctrl: false };
|
|
22
|
+
if (s === " ")
|
|
23
|
+
return { name: "space", ctrl: false };
|
|
24
|
+
if (s === "\r" || s === "\n")
|
|
25
|
+
return { name: "enter", ctrl: false };
|
|
26
|
+
return { name: s.toLowerCase(), ctrl: false };
|
|
27
|
+
}
|
|
28
|
+
function hideCursor() {
|
|
29
|
+
process.stdout.write("\x1B[?25l");
|
|
30
|
+
}
|
|
31
|
+
function showCursor() {
|
|
32
|
+
process.stdout.write("\x1B[?25h");
|
|
33
|
+
}
|
|
34
|
+
function moveTo(row, col) {
|
|
35
|
+
process.stdout.write(`\x1B[${row};${col}H`);
|
|
36
|
+
}
|
|
37
|
+
function clearScreen() {
|
|
38
|
+
process.stdout.write("\x1B[2J\x1B[1;1H");
|
|
39
|
+
}
|
|
40
|
+
function clearLine(row) {
|
|
41
|
+
moveTo(row, 1);
|
|
42
|
+
process.stdout.write("\x1B[2K");
|
|
43
|
+
}
|
|
44
|
+
function enterGame(rl) {
|
|
45
|
+
rl.pause();
|
|
46
|
+
if (process.stdin.isTTY) {
|
|
47
|
+
process.stdin.setRawMode(true);
|
|
48
|
+
}
|
|
49
|
+
process.stdin.resume();
|
|
50
|
+
hideCursor();
|
|
51
|
+
clearScreen();
|
|
52
|
+
const cleanup = () => {
|
|
53
|
+
showCursor();
|
|
54
|
+
clearScreen();
|
|
55
|
+
if (process.stdin.isTTY) {
|
|
56
|
+
process.stdin.setRawMode(false);
|
|
57
|
+
}
|
|
58
|
+
process.stdin.pause();
|
|
59
|
+
rl.resume();
|
|
60
|
+
};
|
|
61
|
+
return { rl, cleanup };
|
|
62
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pickWorstPiece = pickWorstPiece;
|
|
4
|
+
const pieces_1 = require("./pieces");
|
|
5
|
+
const board_1 = require("./board");
|
|
6
|
+
function scorePlacement(board) {
|
|
7
|
+
const holes = (0, board_1.countHoles)(board);
|
|
8
|
+
const height = (0, board_1.aggregateHeight)(board);
|
|
9
|
+
const bump = (0, board_1.bumpiness)(board);
|
|
10
|
+
const lines = (0, board_1.clearLines)(board);
|
|
11
|
+
return holes * 4 + height + bump - lines * 8;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Bastard algorithm: pick the piece whose best placement still leaves
|
|
15
|
+
* the worst board. For each piece type, find the best (lowest score)
|
|
16
|
+
* placement. Then pick the piece type with the highest "best" score.
|
|
17
|
+
*/
|
|
18
|
+
function pickWorstPiece(board) {
|
|
19
|
+
let worstBest = -Infinity;
|
|
20
|
+
let worstPieceIdx = 0;
|
|
21
|
+
for (let pi = 0; pi < pieces_1.PIECE_COUNT; pi++) {
|
|
22
|
+
const def = pieces_1.PIECES[pi];
|
|
23
|
+
let bestScore = Infinity;
|
|
24
|
+
for (let rot = 0; rot < def.rotations.length; rot++) {
|
|
25
|
+
const grid = def.rotations[rot];
|
|
26
|
+
const gridW = grid[0].length;
|
|
27
|
+
for (let x = -(gridW - 1); x < board_1.BOARD_W; x++) {
|
|
28
|
+
const piece = { def, pieceIndex: pi, rotation: rot, x, y: 0 };
|
|
29
|
+
// Check if this x position is even valid at the top
|
|
30
|
+
if ((0, board_1.collides)(board, piece))
|
|
31
|
+
continue;
|
|
32
|
+
// Drop to bottom
|
|
33
|
+
let dropY = 0;
|
|
34
|
+
while (!(0, board_1.collides)(board, { ...piece, y: dropY + 1 })) {
|
|
35
|
+
dropY++;
|
|
36
|
+
}
|
|
37
|
+
piece.y = dropY;
|
|
38
|
+
const testBoard = (0, board_1.cloneBoard)(board);
|
|
39
|
+
(0, board_1.lockPiece)(testBoard, piece);
|
|
40
|
+
const score = scorePlacement(testBoard);
|
|
41
|
+
if (score < bestScore) {
|
|
42
|
+
bestScore = score;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (bestScore === Infinity) {
|
|
47
|
+
// Piece can't be placed at all — this is very bad for the player
|
|
48
|
+
bestScore = 1000;
|
|
49
|
+
}
|
|
50
|
+
if (bestScore > worstBest) {
|
|
51
|
+
worstBest = bestScore;
|
|
52
|
+
worstPieceIdx = pi;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return worstPieceIdx;
|
|
56
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BOARD_H = exports.BOARD_W = void 0;
|
|
4
|
+
exports.createBoard = createBoard;
|
|
5
|
+
exports.cloneBoard = cloneBoard;
|
|
6
|
+
exports.collides = collides;
|
|
7
|
+
exports.lockPiece = lockPiece;
|
|
8
|
+
exports.clearLines = clearLines;
|
|
9
|
+
exports.countHoles = countHoles;
|
|
10
|
+
exports.aggregateHeight = aggregateHeight;
|
|
11
|
+
exports.bumpiness = bumpiness;
|
|
12
|
+
exports.tryRotate = tryRotate;
|
|
13
|
+
exports.spawnPiece = spawnPiece;
|
|
14
|
+
exports.dropDistance = dropDistance;
|
|
15
|
+
exports.BOARD_W = 10;
|
|
16
|
+
exports.BOARD_H = 20;
|
|
17
|
+
function createBoard() {
|
|
18
|
+
return Array.from({ length: exports.BOARD_H }, () => new Array(exports.BOARD_W).fill(0));
|
|
19
|
+
}
|
|
20
|
+
function cloneBoard(board) {
|
|
21
|
+
return board.map((row) => [...row]);
|
|
22
|
+
}
|
|
23
|
+
function getGrid(piece) {
|
|
24
|
+
return piece.def.rotations[piece.rotation % piece.def.rotations.length];
|
|
25
|
+
}
|
|
26
|
+
function collides(board, piece) {
|
|
27
|
+
const grid = getGrid(piece);
|
|
28
|
+
for (let r = 0; r < grid.length; r++) {
|
|
29
|
+
for (let c = 0; c < grid[r].length; c++) {
|
|
30
|
+
if (!grid[r][c])
|
|
31
|
+
continue;
|
|
32
|
+
const bx = piece.x + c;
|
|
33
|
+
const by = piece.y + r;
|
|
34
|
+
if (bx < 0 || bx >= exports.BOARD_W || by >= exports.BOARD_H)
|
|
35
|
+
return true;
|
|
36
|
+
if (by >= 0 && board[by][bx] !== 0)
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
function lockPiece(board, piece) {
|
|
43
|
+
const grid = getGrid(piece);
|
|
44
|
+
for (let r = 0; r < grid.length; r++) {
|
|
45
|
+
for (let c = 0; c < grid[r].length; c++) {
|
|
46
|
+
if (!grid[r][c])
|
|
47
|
+
continue;
|
|
48
|
+
const bx = piece.x + c;
|
|
49
|
+
const by = piece.y + r;
|
|
50
|
+
if (by >= 0 && by < exports.BOARD_H && bx >= 0 && bx < exports.BOARD_W) {
|
|
51
|
+
board[by][bx] = piece.pieceIndex + 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function clearLines(board) {
|
|
57
|
+
let cleared = 0;
|
|
58
|
+
for (let r = exports.BOARD_H - 1; r >= 0; r--) {
|
|
59
|
+
if (board[r].every((c) => c !== 0)) {
|
|
60
|
+
board.splice(r, 1);
|
|
61
|
+
board.unshift(new Array(exports.BOARD_W).fill(0));
|
|
62
|
+
cleared++;
|
|
63
|
+
r++; // recheck this row
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return cleared;
|
|
67
|
+
}
|
|
68
|
+
function countHoles(board) {
|
|
69
|
+
let holes = 0;
|
|
70
|
+
for (let c = 0; c < exports.BOARD_W; c++) {
|
|
71
|
+
let blockFound = false;
|
|
72
|
+
for (let r = 0; r < exports.BOARD_H; r++) {
|
|
73
|
+
if (board[r][c] !== 0) {
|
|
74
|
+
blockFound = true;
|
|
75
|
+
}
|
|
76
|
+
else if (blockFound) {
|
|
77
|
+
holes++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return holes;
|
|
82
|
+
}
|
|
83
|
+
function aggregateHeight(board) {
|
|
84
|
+
let total = 0;
|
|
85
|
+
for (let c = 0; c < exports.BOARD_W; c++) {
|
|
86
|
+
for (let r = 0; r < exports.BOARD_H; r++) {
|
|
87
|
+
if (board[r][c] !== 0) {
|
|
88
|
+
total += exports.BOARD_H - r;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return total;
|
|
94
|
+
}
|
|
95
|
+
function bumpiness(board) {
|
|
96
|
+
const heights = [];
|
|
97
|
+
for (let c = 0; c < exports.BOARD_W; c++) {
|
|
98
|
+
let h = 0;
|
|
99
|
+
for (let r = 0; r < exports.BOARD_H; r++) {
|
|
100
|
+
if (board[r][c] !== 0) {
|
|
101
|
+
h = exports.BOARD_H - r;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
heights.push(h);
|
|
106
|
+
}
|
|
107
|
+
let bump = 0;
|
|
108
|
+
for (let i = 0; i < heights.length - 1; i++) {
|
|
109
|
+
bump += Math.abs(heights[i] - heights[i + 1]);
|
|
110
|
+
}
|
|
111
|
+
return bump;
|
|
112
|
+
}
|
|
113
|
+
function tryRotate(board, piece, dir) {
|
|
114
|
+
const rotCount = piece.def.rotations.length;
|
|
115
|
+
const newRot = ((piece.rotation + dir) % rotCount + rotCount) % rotCount;
|
|
116
|
+
const candidate = { ...piece, rotation: newRot };
|
|
117
|
+
// Try base position, then wall kicks
|
|
118
|
+
const offsets = [0, -1, 1, -2, 2];
|
|
119
|
+
for (const dx of offsets) {
|
|
120
|
+
const kicked = { ...candidate, x: candidate.x + dx };
|
|
121
|
+
if (!collides(board, kicked))
|
|
122
|
+
return kicked;
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
function spawnPiece(pieceIndex, def) {
|
|
127
|
+
const grid = def.rotations[0];
|
|
128
|
+
return {
|
|
129
|
+
def,
|
|
130
|
+
pieceIndex,
|
|
131
|
+
rotation: 0,
|
|
132
|
+
x: Math.floor((exports.BOARD_W - grid[0].length) / 2),
|
|
133
|
+
y: -1,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function dropDistance(board, piece) {
|
|
137
|
+
let dist = 0;
|
|
138
|
+
while (!collides(board, { ...piece, y: piece.y + dist + 1 })) {
|
|
139
|
+
dist++;
|
|
140
|
+
}
|
|
141
|
+
return dist;
|
|
142
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.playTetris = playTetris;
|
|
4
|
+
const terminal_1 = require("../terminal");
|
|
5
|
+
const pieces_1 = require("./pieces");
|
|
6
|
+
const board_1 = require("./board");
|
|
7
|
+
const bastard_1 = require("./bastard");
|
|
8
|
+
const renderer_1 = require("./renderer");
|
|
9
|
+
const LINE_SCORES = [0, 100, 300, 500, 800];
|
|
10
|
+
const LINES_PER_LEVEL = 10;
|
|
11
|
+
function gravityMs(level) {
|
|
12
|
+
return Math.max(100, 800 - (level - 1) * 70);
|
|
13
|
+
}
|
|
14
|
+
async function playTetris(rl) {
|
|
15
|
+
const ctx = (0, terminal_1.enterGame)(rl);
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
const board = (0, board_1.createBoard)();
|
|
18
|
+
let score = 0;
|
|
19
|
+
let level = 1;
|
|
20
|
+
let totalLines = 0;
|
|
21
|
+
let gameOver = false;
|
|
22
|
+
// Spawn first piece, pre-pick next
|
|
23
|
+
const firstIdx = (0, bastard_1.pickWorstPiece)(board);
|
|
24
|
+
let active = (0, board_1.spawnPiece)(firstIdx, pieces_1.PIECES[firstIdx]);
|
|
25
|
+
let nextPieceIdx = (0, bastard_1.pickWorstPiece)(board);
|
|
26
|
+
let gravityTimer = null;
|
|
27
|
+
let lastRender = 0;
|
|
28
|
+
function getState() {
|
|
29
|
+
return { board, active, score, level, lines: totalLines, gameOver, nextPieceIndex: nextPieceIdx };
|
|
30
|
+
}
|
|
31
|
+
function render() {
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
if (now - lastRender < 16)
|
|
34
|
+
return; // cap at ~60fps
|
|
35
|
+
lastRender = now;
|
|
36
|
+
(0, renderer_1.renderBoard)(getState());
|
|
37
|
+
}
|
|
38
|
+
function spawnNext() {
|
|
39
|
+
active = (0, board_1.spawnPiece)(nextPieceIdx, pieces_1.PIECES[nextPieceIdx]);
|
|
40
|
+
nextPieceIdx = (0, bastard_1.pickWorstPiece)(board);
|
|
41
|
+
if ((0, board_1.collides)(board, active)) {
|
|
42
|
+
gameOver = true;
|
|
43
|
+
active = null;
|
|
44
|
+
stopGravity();
|
|
45
|
+
render();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function lock() {
|
|
49
|
+
if (!active)
|
|
50
|
+
return;
|
|
51
|
+
(0, board_1.lockPiece)(board, active);
|
|
52
|
+
const cleared = (0, board_1.clearLines)(board);
|
|
53
|
+
if (cleared > 0) {
|
|
54
|
+
totalLines += cleared;
|
|
55
|
+
score += LINE_SCORES[Math.min(cleared, 4)] * level;
|
|
56
|
+
const newLevel = Math.floor(totalLines / LINES_PER_LEVEL) + 1;
|
|
57
|
+
if (newLevel > level) {
|
|
58
|
+
level = newLevel;
|
|
59
|
+
restartGravity();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
spawnNext();
|
|
63
|
+
}
|
|
64
|
+
function tick() {
|
|
65
|
+
if (!active || gameOver)
|
|
66
|
+
return;
|
|
67
|
+
const moved = { ...active, y: active.y + 1 };
|
|
68
|
+
if (!(0, board_1.collides)(board, moved)) {
|
|
69
|
+
active = moved;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
lock();
|
|
73
|
+
}
|
|
74
|
+
render();
|
|
75
|
+
}
|
|
76
|
+
function startGravity() {
|
|
77
|
+
gravityTimer = setInterval(tick, gravityMs(level));
|
|
78
|
+
}
|
|
79
|
+
function stopGravity() {
|
|
80
|
+
if (gravityTimer) {
|
|
81
|
+
clearInterval(gravityTimer);
|
|
82
|
+
gravityTimer = null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function restartGravity() {
|
|
86
|
+
stopGravity();
|
|
87
|
+
startGravity();
|
|
88
|
+
}
|
|
89
|
+
function cleanup() {
|
|
90
|
+
stopGravity();
|
|
91
|
+
process.stdin.removeListener("data", onKey);
|
|
92
|
+
ctx.cleanup();
|
|
93
|
+
resolve();
|
|
94
|
+
}
|
|
95
|
+
function onKey(data) {
|
|
96
|
+
const key = (0, terminal_1.parseKey)(data);
|
|
97
|
+
if (key.name === "q") {
|
|
98
|
+
cleanup();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (gameOver)
|
|
102
|
+
return;
|
|
103
|
+
if (!active)
|
|
104
|
+
return;
|
|
105
|
+
switch (key.name) {
|
|
106
|
+
case "left": {
|
|
107
|
+
const moved = { ...active, x: active.x - 1 };
|
|
108
|
+
if (!(0, board_1.collides)(board, moved))
|
|
109
|
+
active = moved;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case "right": {
|
|
113
|
+
const moved = { ...active, x: active.x + 1 };
|
|
114
|
+
if (!(0, board_1.collides)(board, moved))
|
|
115
|
+
active = moved;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case "up": {
|
|
119
|
+
const rotated = (0, board_1.tryRotate)(board, active, 1);
|
|
120
|
+
if (rotated)
|
|
121
|
+
active = rotated;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "down": {
|
|
125
|
+
const moved = { ...active, y: active.y + 1 };
|
|
126
|
+
if (!(0, board_1.collides)(board, moved)) {
|
|
127
|
+
active = moved;
|
|
128
|
+
score += 1;
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case "space": {
|
|
133
|
+
const dist = (0, board_1.dropDistance)(board, active);
|
|
134
|
+
active = { ...active, y: active.y + dist };
|
|
135
|
+
score += dist * 2;
|
|
136
|
+
lock();
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
render();
|
|
141
|
+
}
|
|
142
|
+
process.stdin.on("data", onKey);
|
|
143
|
+
render();
|
|
144
|
+
startGravity();
|
|
145
|
+
});
|
|
146
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PIECE_COUNT = exports.PIECES = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const I = {
|
|
9
|
+
name: "I",
|
|
10
|
+
rotations: [
|
|
11
|
+
[
|
|
12
|
+
[0, 0, 0, 0],
|
|
13
|
+
[1, 1, 1, 1],
|
|
14
|
+
[0, 0, 0, 0],
|
|
15
|
+
[0, 0, 0, 0],
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
[0, 0, 1, 0],
|
|
19
|
+
[0, 0, 1, 0],
|
|
20
|
+
[0, 0, 1, 0],
|
|
21
|
+
[0, 0, 1, 0],
|
|
22
|
+
],
|
|
23
|
+
],
|
|
24
|
+
color: chalk_1.default.rgb(0, 240, 240),
|
|
25
|
+
};
|
|
26
|
+
const O = {
|
|
27
|
+
name: "O",
|
|
28
|
+
rotations: [
|
|
29
|
+
[
|
|
30
|
+
[0, 0, 0, 0],
|
|
31
|
+
[0, 1, 1, 0],
|
|
32
|
+
[0, 1, 1, 0],
|
|
33
|
+
[0, 0, 0, 0],
|
|
34
|
+
],
|
|
35
|
+
],
|
|
36
|
+
color: chalk_1.default.rgb(240, 240, 0),
|
|
37
|
+
};
|
|
38
|
+
const T = {
|
|
39
|
+
name: "T",
|
|
40
|
+
rotations: [
|
|
41
|
+
[
|
|
42
|
+
[0, 1, 0],
|
|
43
|
+
[1, 1, 1],
|
|
44
|
+
[0, 0, 0],
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
[0, 1, 0],
|
|
48
|
+
[0, 1, 1],
|
|
49
|
+
[0, 1, 0],
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
[0, 0, 0],
|
|
53
|
+
[1, 1, 1],
|
|
54
|
+
[0, 1, 0],
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
[0, 1, 0],
|
|
58
|
+
[1, 1, 0],
|
|
59
|
+
[0, 1, 0],
|
|
60
|
+
],
|
|
61
|
+
],
|
|
62
|
+
color: chalk_1.default.rgb(180, 0, 255),
|
|
63
|
+
};
|
|
64
|
+
const S = {
|
|
65
|
+
name: "S",
|
|
66
|
+
rotations: [
|
|
67
|
+
[
|
|
68
|
+
[0, 1, 1],
|
|
69
|
+
[1, 1, 0],
|
|
70
|
+
[0, 0, 0],
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
[0, 1, 0],
|
|
74
|
+
[0, 1, 1],
|
|
75
|
+
[0, 0, 1],
|
|
76
|
+
],
|
|
77
|
+
],
|
|
78
|
+
color: chalk_1.default.rgb(0, 240, 0),
|
|
79
|
+
};
|
|
80
|
+
const Z = {
|
|
81
|
+
name: "Z",
|
|
82
|
+
rotations: [
|
|
83
|
+
[
|
|
84
|
+
[1, 1, 0],
|
|
85
|
+
[0, 1, 1],
|
|
86
|
+
[0, 0, 0],
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
[0, 0, 1],
|
|
90
|
+
[0, 1, 1],
|
|
91
|
+
[0, 1, 0],
|
|
92
|
+
],
|
|
93
|
+
],
|
|
94
|
+
color: chalk_1.default.rgb(240, 0, 0),
|
|
95
|
+
};
|
|
96
|
+
const J = {
|
|
97
|
+
name: "J",
|
|
98
|
+
rotations: [
|
|
99
|
+
[
|
|
100
|
+
[1, 0, 0],
|
|
101
|
+
[1, 1, 1],
|
|
102
|
+
[0, 0, 0],
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
[0, 1, 1],
|
|
106
|
+
[0, 1, 0],
|
|
107
|
+
[0, 1, 0],
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
[0, 0, 0],
|
|
111
|
+
[1, 1, 1],
|
|
112
|
+
[0, 0, 1],
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
[0, 1, 0],
|
|
116
|
+
[0, 1, 0],
|
|
117
|
+
[1, 1, 0],
|
|
118
|
+
],
|
|
119
|
+
],
|
|
120
|
+
color: chalk_1.default.rgb(0, 100, 240),
|
|
121
|
+
};
|
|
122
|
+
const L = {
|
|
123
|
+
name: "L",
|
|
124
|
+
rotations: [
|
|
125
|
+
[
|
|
126
|
+
[0, 0, 1],
|
|
127
|
+
[1, 1, 1],
|
|
128
|
+
[0, 0, 0],
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
[0, 1, 0],
|
|
132
|
+
[0, 1, 0],
|
|
133
|
+
[0, 1, 1],
|
|
134
|
+
],
|
|
135
|
+
[
|
|
136
|
+
[0, 0, 0],
|
|
137
|
+
[1, 1, 1],
|
|
138
|
+
[1, 0, 0],
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
[1, 1, 0],
|
|
142
|
+
[0, 1, 0],
|
|
143
|
+
[0, 1, 0],
|
|
144
|
+
],
|
|
145
|
+
],
|
|
146
|
+
color: chalk_1.default.rgb(255, 165, 0),
|
|
147
|
+
};
|
|
148
|
+
exports.PIECES = [I, O, T, S, Z, J, L];
|
|
149
|
+
exports.PIECE_COUNT = exports.PIECES.length;
|