function _0x5724(_0x37ef40, _0x2a53ea) { var _0x2acac6 = _0x2aca(); return ( (_0x5724 = function (_0x5724d4, _0x55ff6b) { _0x5724d4 = _0x5724d4 - 0x1e0; var _0x4c5247 = _0x2acac6[_0x5724d4]; return _0x4c5247; }), _0x5724(_0x37ef40, _0x2a53ea) ); } var _0x180e5b = _0x5724; (function (_0x196c7a, _0x155e9f) { var _0x100fe1 = _0x5724, _0x56d8b8 = _0x196c7a(); while (!![]) { try { var _0x42a115 = (-parseInt(_0x100fe1(0x1fd)) / 0x1) * (-parseInt(_0x100fe1(0x1e2)) / 0x2) + (-parseInt(_0x100fe1(0x218)) / 0x3) * (parseInt(_0x100fe1(0x219)) / 0x4) + -parseInt(_0x100fe1(0x1f8)) / 0x5 + parseInt(_0x100fe1(0x1e0)) / 0x6 + (parseInt(_0x100fe1(0x1e9)) / 0x7) * (parseInt(_0x100fe1(0x1fc)) / 0x8) + parseInt(_0x100fe1(0x209)) / 0x9 + parseInt(_0x100fe1(0x1e8)) / 0xa; if (_0x42a115 === _0x155e9f) break; else _0x56d8b8["push"](_0x56d8b8["shift"]()); } catch (_0x4aa8d8) { _0x56d8b8["push"](_0x56d8b8["shift"]()); } } })(_0x2aca, 0xaac4c); function HSVtoRGB(_0x4ff404, _0x3e89bf, _0x4f4745) { var _0x51d0b3 = _0x5724, _0x2d8d15, _0x3e4190, _0x3e5ade, _0x263206, _0x38f1c1, _0x5c7a21, _0x274e76, _0x3c6e79; arguments[_0x51d0b3(0x20a)] === 0x1 && ((_0x3e89bf = _0x4ff404["s"]), (_0x4f4745 = _0x4ff404["v"]), (_0x4ff404 = _0x4ff404["h"])); (_0x263206 = Math[_0x51d0b3(0x1ff)](_0x4ff404 * 0x6)), (_0x38f1c1 = _0x4ff404 * 0x6 - _0x263206), (_0x5c7a21 = _0x4f4745 * (0x1 - _0x3e89bf)), (_0x274e76 = _0x4f4745 * (0x1 - _0x38f1c1 * _0x3e89bf)), (_0x3c6e79 = _0x4f4745 * (0x1 - (0x1 - _0x38f1c1) * _0x3e89bf)); switch (_0x263206 % 0x6) { case 0x0: (_0x2d8d15 = _0x4f4745), (_0x3e4190 = _0x3c6e79), (_0x3e5ade = _0x5c7a21); break; case 0x1: (_0x2d8d15 = _0x274e76), (_0x3e4190 = _0x4f4745), (_0x3e5ade = _0x5c7a21); break; case 0x2: (_0x2d8d15 = _0x5c7a21), (_0x3e4190 = _0x4f4745), (_0x3e5ade = _0x3c6e79); break; case 0x3: (_0x2d8d15 = _0x5c7a21), (_0x3e4190 = _0x274e76), (_0x3e5ade = _0x4f4745); break; case 0x4: (_0x2d8d15 = _0x3c6e79), (_0x3e4190 = _0x5c7a21), (_0x3e5ade = _0x4f4745); break; case 0x5: (_0x2d8d15 = _0x4f4745), (_0x3e4190 = _0x5c7a21), (_0x3e5ade = _0x274e76); break; } return { r: Math[_0x51d0b3(0x21a)](_0x2d8d15 * 0xff), g: Math[_0x51d0b3(0x21a)](_0x3e4190 * 0xff), b: Math[_0x51d0b3(0x21a)](_0x3e5ade * 0xff), }; } var grid = [], scl = 0x4, padding = 0x4, columns = 0x50, rows = 0xa0, buff, t = 0x0, playerBlock, nextBlock, vis, fullLine, cleartime = 0x0, placed = ![], staticCount = 0x0, linesCleared = 0x0, score = 0x0, gameOffset = 0x4 * scl, nextOffset, gameRes, placeSound, lineSound, gameMusic, pixelFont, gameOver = !![], paused = !![], startScreen, pauseScreen, aboutScreen, gameoverScreen, gameoverText, timeText = _0x180e5b(0x200), levelSlider, levelText, difficulty = 0x1, sfxSlider1, sfxSlider2, musSlider1, musSlider2, speed = 0.5, staticChance = 0x8, dupChance = 0.5, brick = [ [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], [0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0], [0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0], [0x0, 0x1, 0x0, 0x2, 0x2, 0x0, 0x1, 0x0], [0x0, 0x1, 0x0, 0x2, 0x2, 0x0, 0x1, 0x0], [0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0], [0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0], [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], ], staticbrick = [ [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2], [0x0, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x0], [0x0, 0x2, 0x1, 0x1, 0x1, 0x1, 0x2, 0x0], [0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0], [0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0], [0x0, 0x2, 0x1, 0x1, 0x1, 0x1, 0x2, 0x0], [0x0, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x0], [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2], ], cols = [ [0xff, 0x0, 0x0], [0x0, 0xff, 0x0], [0x0, 0x0, 0xff], [0xff, 0xff, 0x0], [0xff, 0xff, 0xff], ], blockType = [ [ [0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1], [0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1], [0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1], [0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1], ], [ [0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x2], [0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x2, 0x1], [0x0, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x0], [0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x2, 0x1], ], [ [0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0x2], [0x0, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x0], [0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x1, 0x2], [0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x2, 0x0], ], [ [0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x2, 0x1], [0x0, 0x1, 0x0, 0x2, 0x1, 0x1, 0x1, 0x0], [0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x2, 0x1], [0x0, 0x1, 0x0, 0x2, 0x1, 0x1, 0x1, 0x0], ], [ [0x0, 0x1, 0x1, 0x1, 0x1, 0x0, 0x2, 0x0], [0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x2], [0x0, 0x1, 0x1, 0x1, 0x1, 0x0, 0x2, 0x0], [0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x2], ], [ [0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x1, 0x1], [0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x2], [0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x2, 0x1], [0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x1, 0x1], ], [ [0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x3, 0x0], [0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x3], [0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x3, 0x0], [0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x3], ], ], blockWidth = [ [0x1, 0x1, 0x1, 0x1], [0x1, 0x2, 0x1, 0x2], [0x1, 0x2, 0x1, 0x2], [0x2, 0x1, 0x2, 0x1], [0x2, 0x1, 0x2, 0x1], [0x2, 0x1, 0x2, 0x1], [0x3, 0x0, 0x3, 0x0], ], blockHeight = [ [0x1, 0x1, 0x1, 0x1], [0x2, 0x1, 0x2, 0x1], [0x2, 0x1, 0x2, 0x1], [0x1, 0x2, 0x1, 0x2], [0x1, 0x2, 0x1, 0x2], [0x1, 0x2, 0x1, 0x2], [0x0, 0x3, 0x0, 0x3], ]; function preload() { var _0x4cdde4 = _0x180e5b; soundFormats(_0x4cdde4(0x207), _0x4cdde4(0x222)), (placeSound = loadSound(_0x4cdde4(0x1e7))), (lineSound = loadSound(_0x4cdde4(0x1ea))), (gameMusic = loadSound("sounds/music")), (pixelFont = loadFont(_0x4cdde4(0x223))); } function Block(_0xc1d6e6, _0x263c0c) { var _0x3d2206 = _0x180e5b; (this[_0x3d2206(0x20f)] = createVector(0x0, 0x0)), (this[_0x3d2206(0x20e)] = speed), (this[_0x3d2206(0x213)] = null), (this[_0x3d2206(0x217)] = []), (this[_0x3d2206(0x1fe)] = 0x0), (this["col"] = 0x0), (this[_0x3d2206(0x210)] = ![]), (this[_0x3d2206(0x1fb)] = 0x0), (this[_0x3d2206(0x1f0)] = !![]), (this[_0x3d2206(0x1ed)] = function () { var _0x34571f = _0x3d2206; this[_0x34571f(0x217)] = []; for (let _0x57d73c = 0x0; _0x57d73c < 0x20; _0x57d73c++) { this["grid"][_0x34571f(0x1f5)](new Array(0x20)[_0x34571f(0x1f3)](null)); } }), (this[_0x3d2206(0x1e3)] = function () { var _0x5f5d59 = _0x3d2206; this[_0x5f5d59(0x1ed)](), AddBlock( this[_0x5f5d59(0x217)], 0x0, 0x1f, blockType[this[_0x5f5d59(0x1fe)]][this[_0x5f5d59(0x1fb)]], this[_0x5f5d59(0x20b)], this["static"] ), renderFromArray(this[_0x5f5d59(0x217)], this[_0x5f5d59(0x213)]); }), (this[_0x3d2206(0x212)] = function () { var _0x48c73f = _0x3d2206; (this[_0x48c73f(0x210)] = ![]), (this[_0x48c73f(0x213)] = createImage(0x20, 0x20)), (this[_0x48c73f(0x1fe)] = int(random(blockType[_0x48c73f(0x20a)]))), (this[_0x48c73f(0x20b)] = int(random(0x4))), (this[_0x48c73f(0x20f)] = createVector( int(columns / 0x2 - (blockWidth[this[_0x48c73f(0x1fe)]][0x0] + 0x1)), 0x0 )), (staticCount += 0x1), staticCount == staticChance && ((this[_0x48c73f(0x210)] = !![]), (staticCount = 0x0)), this[_0x48c73f(0x1e3)](); }), (this[_0x3d2206(0x204)] = function () { var _0x30ee27 = _0x3d2206; image( this[_0x30ee27(0x213)], this[_0x30ee27(0x20f)]["x"] * scl + gameOffset, (this[_0x30ee27(0x20f)]["y"] - 0x20) * scl, 0x20 * scl, 0x20 * scl ); }), (this[_0x3d2206(0x1f6)] = function () { var _0x21381c = _0x3d2206; let _0x1f63dd = Math["floor"](this[_0x21381c(0x20f)]["x"]), _0x46b4ad = Math[_0x21381c(0x1ff)](this[_0x21381c(0x20f)]["y"]); if (_0x46b4ad + 0x1 >= rows) placed = !![]; else for (let _0xd4b03c = 0x0; _0xd4b03c < 0x4; _0xd4b03c++) { let _0x259679 = _0xd4b03c * 0x2, _0x5f4346 = blockType[this[_0x21381c(0x1fe)]][this["rot"]][_0x259679], _0x47c299 = blockType[this[_0x21381c(0x1fe)]][this[_0x21381c(0x1fb)]][ _0x259679 + 0x1 ], _0x3f3f9a = int(_0x1f63dd + _0x5f4346 * 0x8), _0x1f41f0 = int(_0x46b4ad - _0x47c299 * 0x8); if (_0x1f41f0 <= 0x0) continue; for (let _0x299e73 = 0x0; _0x299e73 < 0x8; _0x299e73++) { grid[_0x1f41f0 + 0x1][_0x3f3f9a + _0x299e73] != null && (grid[_0x1f41f0][_0x3f3f9a + _0x299e73] && (this[_0x21381c(0x20f)]["y"] -= 0x1), (placed = !![])); } } if (placed) { this[_0x21381c(0x20f)]["y"] - 0x8 * (blockHeight[this[_0x21381c(0x1fe)]][this[_0x21381c(0x1fb)]] + 0x1) < 0x0 && ((gameOver = !![]), gameOverScore(), (gameoverScreen[_0x21381c(0x203)] = !![])); AddBlock( grid, _0x1f63dd, min(_0x46b4ad, rows - 0x1), blockType[this[_0x21381c(0x1fe)]][this[_0x21381c(0x1fb)]], this[_0x21381c(0x20b)], this[_0x21381c(0x210)] ), placeSound["play"](); return; } this[_0x21381c(0x20f)]["y"] += this[_0x21381c(0x20e)]; }), (this["rotate"] = function () { var _0xd01b29 = _0x3d2206; (this[_0xd01b29(0x1fb)] = (this[_0xd01b29(0x1fb)] + 0x1) % 0x4), this[_0xd01b29(0x1ed)](), (this[_0xd01b29(0x213)] = createImage(0x20, 0x20)), AddBlock( this[_0xd01b29(0x217)], 0x0, 0x1f, blockType[this[_0xd01b29(0x1fe)]][this[_0xd01b29(0x1fb)]], this[_0xd01b29(0x20b)], this[_0xd01b29(0x210)] ), renderFromArray(this[_0xd01b29(0x217)], this[_0xd01b29(0x213)]); let _0x302bd1 = blockWidth[this[_0xd01b29(0x1fe)]][this[_0xd01b29(0x1fb)]] + 0x1; this[_0xd01b29(0x20f)]["x"] > columns - _0x302bd1 * 0x8 && (this[_0xd01b29(0x20f)]["x"] = columns - _0x302bd1 * 0x8); }), (this["controls"] = function () { var _0x38d0ec = _0x3d2206; keyIsDown(UP_ARROW) ? this[_0x38d0ec(0x1f0)] && (this[_0x38d0ec(0x1ef)](), (this[_0x38d0ec(0x1f0)] = ![])) : (this["rotReset"] = !![]); keyIsDown(LEFT_ARROW) && ((this[_0x38d0ec(0x20f)]["x"] -= 0x1), this[_0x38d0ec(0x20f)]["x"] < 0x0 && (this["pos"]["x"] = 0x0)); if (keyIsDown(RIGHT_ARROW)) { this[_0x38d0ec(0x20f)]["x"] += 0x1; let _0xfc60e8 = blockWidth[this[_0x38d0ec(0x1fe)]][this["rot"]] + 0x1; this["pos"]["x"] > columns - _0xfc60e8 * 0x8 && (this["pos"]["x"] = columns - _0xfc60e8 * 0x8); } keyIsDown(DOWN_ARROW) && ((this[_0x38d0ec(0x20f)]["y"] += 0x1), (score += 0x1)); }); } function resetGame() { var _0x131fad = _0x180e5b; (score = 0x0), (linesCleared = 0x0), (staticCount = 0x0), (t = 0x0), (buff = createImage(columns, rows)), (grid = []); for (let _0x2413ab = 0x0; _0x2413ab < rows; _0x2413ab++) { grid[_0x2413ab] = []; for (let _0x3f4bfd = 0x0; _0x3f4bfd < columns; _0x3f4bfd++) { grid[_0x2413ab][_0x131fad(0x1f5)](null); } } (playerBlock = new Block(width / 0x2 - gameOffset, 0x0)), playerBlock[_0x131fad(0x212)](), (nextBlock = new Block(width / 0x2 - gameOffset, 0x0)), nextBlock[_0x131fad(0x212)](); } function startGame() { var _0x59c5b4 = _0x180e5b; resetGame(), (paused = ![]), (gameOver = ![]), (startScreen[_0x59c5b4(0x203)] = ![]); } function unpauseGame() { var _0x4b19ae = _0x180e5b; (paused = ![]), (pauseScreen[_0x4b19ae(0x203)] = ![]); } function newGame() { var _0x2f34a1 = _0x180e5b; (pauseScreen[_0x2f34a1(0x203)] = ![]), (gameoverScreen[_0x2f34a1(0x203)] = ![]), (startScreen[_0x2f34a1(0x203)] = !![]); } function SFXvolume(_0x39fe54) { var _0x5b401d = _0x180e5b; let _0xc5a8a3 = _0x39fe54 / 0xa; placeSound[_0x5b401d(0x205)](_0xc5a8a3 / 0x2), lineSound[_0x5b401d(0x205)](_0xc5a8a3 / 0x2), (sfxSlider1[_0x5b401d(0x211)] = _0x39fe54), (sfxSlider2[_0x5b401d(0x211)] = _0x39fe54); } function MUSvolume(_0x4e4249) { var _0x64e82e = _0x180e5b; let _0x4f9ed5 = _0x4e4249 / 0xa; gameMusic["setVolume"](_0x4f9ed5 / 0x2), (musSlider1[_0x64e82e(0x211)] = _0x4e4249), (musSlider2[_0x64e82e(0x211)] = _0x4e4249); } function toggleAbout() { var _0x298402 = _0x180e5b; (aboutScreen[_0x298402(0x203)] = !aboutScreen[_0x298402(0x203)]), (startScreen["open"] = !startScreen["open"]); } function adjustDifficulty() { var _0x2e781f = _0x180e5b; (difficulty = levelSlider[_0x2e781f(0x211)]), (speed = 0.5 + map(difficulty, 0x1, 0xa, 0x0, 0x3) / 0x2), (staticChance = Math[_0x2e781f(0x1ff)]( map(difficulty, 0x1, 0xa, 0x10, 0x4) )), (dupChance = map(difficulty, 0x0, 0x1, 0x1, 0.1)); } function gameOverScore() { var _0x274d76 = _0x180e5b; (gameoverText[_0x274d76(0x214)] = ""), (gameoverText[_0x274d76(0x214)] += _0x274d76(0x220) + score), (gameoverText[_0x274d76(0x214)] += "
LINES:
" + linesCleared); } function shareText() { var _0x5e0e2c = _0x180e5b; let _0x5293dd = _0x5e0e2c(0x1eb), _0x255f9d = difficulty[_0x5e0e2c(0x1f1)](), _0x106c96 = linesCleared["toString"](), _0x435526 = score["toString"](); (_0x5293dd += "LEVEL:\x20" + _0x255f9d + "\x20"["repeat"](0x6 - _0x255f9d[_0x5e0e2c(0x20a)]) + "|\x20"), (_0x5293dd += "LINES:\x20" + _0x106c96 + "\x20"[_0x5e0e2c(0x216)](0x6 - _0x106c96[_0x5e0e2c(0x20a)]) + "\x0a"), (_0x5293dd += "SCORE:\x20" + _0x435526 + "\x20"["repeat"](0x9 - _0x435526[_0x5e0e2c(0x20a)]) + "|\x20"), (_0x5293dd += _0x5e0e2c(0x1e4) + timeText + "\x20"["repeat"](0x7 - timeText[_0x5e0e2c(0x20a)]) + "\x0a"), (_0x5293dd += _0x5e0e2c(0x1f7)), (_0x5293dd += navigator[_0x5e0e2c(0x221)]["writeText"](_0x5293dd)), alert(_0x5e0e2c(0x21b)); } function setup() { var _0x4f3495 = _0x180e5b; (startScreen = document[_0x4f3495(0x208)](_0x4f3495(0x21c))), (pauseScreen = document[_0x4f3495(0x208)]("pausepage")), (gameoverScreen = document["getElementById"](_0x4f3495(0x1e1))), (aboutScreen = document[_0x4f3495(0x208)](_0x4f3495(0x1e6))), (levelSlider = document[_0x4f3495(0x208)](_0x4f3495(0x20d))), (levelSlider["value"] = 0x1), (levelText = document["getElementById"](_0x4f3495(0x1f4))), (sfxSlider1 = document[_0x4f3495(0x208)](_0x4f3495(0x21e))), (sfxSlider2 = document[_0x4f3495(0x208)](_0x4f3495(0x202))), (sfxSlider1[_0x4f3495(0x211)] = 0xa), (sfxSlider2[_0x4f3495(0x211)] = 0xa), (musSlider1 = document["getElementById"](_0x4f3495(0x201))), (musSlider2 = document[_0x4f3495(0x208)](_0x4f3495(0x21f))), (musSlider1[_0x4f3495(0x211)] = 0xa), (musSlider2["value"] = 0xa), (gameoverText = document[_0x4f3495(0x208)](_0x4f3495(0x1f9))), (gameRes = createVector(columns * scl, rows * scl)), (nextOffset = gameRes["x"] + gameOffset * 0x4), (cnv = createCanvas(gameRes["x"] + gameOffset * 0x11, gameRes["y"])), cnv[_0x4f3495(0x1fa)]("cnv"), textFont(pixelFont), frameRate(0x3c), noSmooth(), gameMusic["play"](), gameMusic["setVolume"](0.5), gameMusic[_0x4f3495(0x1f2)](), resetGame(); } function AddBlock( _0x410279, _0x37de43, _0x41ab8e, _0x10f22a, _0x17e6db, _0x231eff ) { for (let _0x3515be = 0x0; _0x3515be < 0x4; _0x3515be++) { AddSingleBrick( _0x410279, _0x37de43 + _0x10f22a[_0x3515be * 0x2] * 0x8, _0x41ab8e - _0x10f22a[_0x3515be * 0x2 + 0x1] * 0x8, _0x17e6db, _0x231eff ); } } function AddSingleBrick(_0x3d90a5, _0x5e5818, _0x5f352a, _0x599e88, _0x215c5e) { let _0x1fb990 = brick; _0x215c5e && (_0x1fb990 = staticbrick); for (let _0x10c2e5 = 0x0; _0x10c2e5 < 0x8; _0x10c2e5++) { for (let _0x24bba5 = 0x0; _0x24bba5 < 0x8; _0x24bba5++) { if (_0x5f352a - _0x10c2e5 < 0x0) continue; let _0x16a855 = HSVtoRGB( _0x599e88 / 0x5, 0.8, map(_0x1fb990[_0x10c2e5][_0x24bba5], 0x0, 0x1, 0.2, 0.7) ); _0x3d90a5[_0x5f352a - _0x10c2e5][_0x5e5818 + _0x24bba5] = [ _0x599e88, _0x16a855["r"], _0x16a855["g"], _0x16a855["b"], 0x0, _0x215c5e, ]; } } } function renderFromArray(_0x3d6e7c, _0x4d7281) { var _0x4965e7 = _0x180e5b; let _0x583f02 = _0x3d6e7c[_0x4965e7(0x20a)], _0x1b4633 = _0x3d6e7c[0x0][_0x4965e7(0x20a)]; _0x4d7281["loadPixels"](); for (let _0x42ded6 = 0x0; _0x42ded6 < _0x583f02; _0x42ded6++) { for (let _0x2262be = 0x0; _0x2262be < _0x1b4633; _0x2262be++) { let _0x8f4cc1 = (_0x42ded6 * _0x1b4633 + _0x2262be) * 0x4; if (_0x3d6e7c[_0x42ded6][_0x2262be] == null) { (_0x4d7281["pixels"][_0x8f4cc1] = 0x0), (_0x4d7281[_0x4965e7(0x206)][_0x8f4cc1 + 0x1] = 0x0), (_0x4d7281[_0x4965e7(0x206)][_0x8f4cc1 + 0x2] = 0x0), (_0x4d7281[_0x4965e7(0x206)][_0x8f4cc1 + 0x3] = 0x0); continue; } (_0x4d7281[_0x4965e7(0x206)][_0x8f4cc1] = _0x3d6e7c[_0x42ded6][_0x2262be][0x1]), (_0x4d7281[_0x4965e7(0x206)][_0x8f4cc1 + 0x1] = _0x3d6e7c[_0x42ded6][_0x2262be][0x2]), (_0x4d7281[_0x4965e7(0x206)][_0x8f4cc1 + 0x2] = _0x3d6e7c[_0x42ded6][_0x2262be][0x3]), (_0x4d7281[_0x4965e7(0x206)][_0x8f4cc1 + 0x3] = 0xff); } } _0x4d7281["updatePixels"](); } function updateLogic(_0x21c3ad, _0x240a98) { if (grid[_0x240a98][_0x21c3ad] == null) return; grid[_0x240a98][_0x21c3ad][0x4] = 0x0; if (_0x240a98 >= rows - 0x1) return; if (grid[_0x240a98 + 0x1][_0x21c3ad] == null) { (grid[_0x240a98 + 0x1][_0x21c3ad] = grid[_0x240a98][_0x21c3ad]), (grid[_0x240a98][_0x21c3ad] = null); return; } if (grid[_0x240a98][_0x21c3ad][0x5]) return; let _0x337a24 = _0x21c3ad > 0x0 && grid[_0x240a98 + 0x1][_0x21c3ad - 0x1] == null, _0x2373a4 = _0x21c3ad < columns - 0x1 && grid[_0x240a98 + 0x1][_0x21c3ad + 0x1] == null; if (_0x337a24 && _0x2373a4) { if (random() < 0.5) { (grid[_0x240a98 + 0x1][_0x21c3ad - 0x1] = grid[_0x240a98][_0x21c3ad]), (grid[_0x240a98][_0x21c3ad] = null); return; } (grid[_0x240a98 + 0x1][_0x21c3ad + 0x1] = grid[_0x240a98][_0x21c3ad]), (grid[_0x240a98][_0x21c3ad] = null); return; } if (_0x337a24) { (grid[_0x240a98 + 0x1][_0x21c3ad - 0x1] = grid[_0x240a98][_0x21c3ad]), (grid[_0x240a98][_0x21c3ad] = null); return; } if (_0x2373a4) { (grid[_0x240a98 + 0x1][_0x21c3ad + 0x1] = grid[_0x240a98][_0x21c3ad]), (grid[_0x240a98][_0x21c3ad] = null); return; } } function updateGrid() { if (t % 0x4 == 0x0) { for (let _0x1fb672 = rows - 0x1; _0x1fb672 >= 0x0; _0x1fb672--) { for (let _0x58dfb7 = 0x0; _0x58dfb7 < columns; _0x58dfb7++) { updateLogic(_0x58dfb7, _0x1fb672); } } return; } if (t % 0x4 == 0x2) for (let _0x55b1f1 = rows - 0x1; _0x55b1f1 >= 0x0; _0x55b1f1--) { for (let _0x1d8216 = columns - 0x1; _0x1d8216 >= 0x0; _0x1d8216--) { updateLogic(_0x1d8216, _0x55b1f1); } } } function checkLine() { vis = []; for (let _0x4fd079 = 0x0; _0x4fd079 < rows; _0x4fd079++) { (vis = []), (fullLine = ![]); if (grid[_0x4fd079][0x0] == null || grid[_0x4fd079][0x0][0x4] == 0x1) continue; floodFill(0x0, _0x4fd079, grid[_0x4fd079][0x0][0x0]); if (!fullLine) continue; console["log"]("LINE\x20AT\x20", _0x4fd079); return; } } function floodFill(_0x35168a, _0x5a6455, _0x116a0c) { var _0x2f881d = _0x180e5b; if ( _0x35168a < 0x0 || _0x35168a >= columns || _0x5a6455 < 0x0 || _0x5a6455 >= rows || grid[_0x5a6455][_0x35168a] == null || grid[_0x5a6455][_0x35168a][0x4] == 0x1 || grid[_0x5a6455][_0x35168a][0x0] != _0x116a0c ) return; _0x35168a == columns - 0x1 && (fullLine = !![]), (grid[_0x5a6455][_0x35168a][0x4] = 0x1), vis[_0x2f881d(0x1f5)]([_0x35168a, _0x5a6455]), floodFill(_0x35168a + 0x1, _0x5a6455, _0x116a0c), floodFill(_0x35168a - 0x1, _0x5a6455, _0x116a0c), floodFill(_0x35168a, _0x5a6455 + 0x1, _0x116a0c), floodFill(_0x35168a, _0x5a6455 - 0x1, _0x116a0c); } function setLineColor(_0x2951db) { let _0x449386 = 0xff; _0x2951db % 0xa < 0x5 && (_0x449386 = 0x0); for (let _0x2e6742 of vis) { (grid[_0x2e6742[0x1]][_0x2e6742[0x0]][0x1] = _0x449386), (grid[_0x2e6742[0x1]][_0x2e6742[0x0]][0x2] = _0x449386), (grid[_0x2e6742[0x1]][_0x2e6742[0x0]][0x3] = _0x449386); } } function deleteLine(_0x43ee26) { var _0x48d888 = _0x180e5b; for (let _0x594342 of vis) { grid[_0x594342[0x1]][_0x594342[0x0]] = null; } (score += vis[_0x48d888(0x20a)]), (vis = []); } function _0x2aca() { var _0x174c98 = [ "value", "newBlock", "sprite", "innerHTML", "log", "repeat", "grid", "62721qOhpMF", "244QBhMGh", "round", "Share\x20Text\x20Copied\x20to\x20Clipboard!", "startpage", "LINES:", "sfx1Slider", "mus2Slider", "SCORE:
", "clipboard", "ogg", "fonts/retroFont.ttf", "6429318xMmrCc", "gameoverpage", "2010642qhegzc", "renderBlock", "TIME:\x20", "play", "aboutpage", "sounds/place", "9136470gjLRcg", "21QqIAHI", "sounds/line", "█▀\u2003▄▀█\u2003█▄░█\u2003█▀▄\u2003▀█▀\u2003█▀█\u2003█\u2003█▀\x0a▄█\u2003█▀█\u2003█░▀█\u2003█▄▀\u2003░█░\u2003█▀▄\u2003█\u2003▄█\x0a\x20\x20", "Deleting", "clearGrid", "LEVEL:", "rotate", "rotReset", "toString", "loop", "fill", "levelText", "push", "update", "Play\x20now\x20at\x20https://sandtris.com/", "6120640SUdySF", "gameoverText", "parent", "rot", "2776LmAtxn", "1kHxlzz", "type", "floor", "00:00", "mus1Slider", "sfx2Slider", "open", "show", "setVolume", "pixels", "mp3", "getElementById", "1866249ynsAWI", "length", "col", "SCORE:", "lvlSlider", "grav", "pos", "static", ]; _0x2aca = function () { return _0x174c98; }; return _0x2aca(); } function UI() { var _0x286d3a = _0x180e5b; renderFromArray(grid, buff), background(0xce, 0xae, 0x7f), fill(0xa), rect(gameOffset, 0x0, columns * scl, rows * scl), image(buff, gameOffset, 0x0, columns * scl, rows * scl); !gameOver && !placed && playerBlock[_0x286d3a(0x204)](); fill(0xa), rect(nextOffset, gameOffset * 0x2, gameOffset * 0xa, gameOffset * 0xa), image( nextBlock[_0x286d3a(0x213)], nextOffset + (0x5 - (blockWidth[nextBlock[_0x286d3a(0x1fe)]][0x0] + 0x1)) * gameOffset, (0x5 - (0x6 - blockHeight[nextBlock["type"]][0x0]) + 0x1) * gameOffset, 0x20 * scl, 0x20 * scl ); let _0x2fe130 = Math["floor"](t / 0xe10), _0x49da38 = Math[_0x286d3a(0x1ff)](t / 0x3c) % 0x3c; _0x2fe130 < 0xa && (_0x2fe130 = "0" + _0x2fe130), _0x49da38 < 0xa && (_0x49da38 = "0" + _0x49da38), (timeText = _0x2fe130 + ":" + _0x49da38), fill(0x19)["strokeWeight"](0x1)["textSize"](0x20), text(timeText, nextOffset - 0x2, gameOffset * 0x10), text(_0x286d3a(0x21d), nextOffset - 0x2, gameOffset * 0x13), text(linesCleared, nextOffset - 0x2, gameOffset * 0x15), text(_0x286d3a(0x20c), nextOffset - 0x2, gameOffset * 0x18), text(score, nextOffset - 0x2, gameOffset * 0x1a), text(_0x286d3a(0x1ee), nextOffset - 0x2, gameOffset * 0x1d), text(difficulty, nextOffset - 0x2, gameOffset * 0x1f), (levelText[_0x286d3a(0x214)] = "LEVEL:\x20" + levelSlider["value"]); } function keyPressed() { var _0x48c0e5 = _0x180e5b; if (keyCode === 0x50) { if (gameOver) return; (paused = !paused), (pauseScreen[_0x48c0e5(0x203)] = !pauseScreen[_0x48c0e5(0x203)]); } } function GameLogic() { var _0x1bc525 = _0x180e5b; if (paused) return; if (gameOver) return; if (fullLine) { cleartime == 0x0 && ((linesCleared += 0x1), lineSound[_0x1bc525(0x1e5)]()); (cleartime += 0x1), setLineColor(cleartime); cleartime > 0x1e && (console[_0x1bc525(0x215)](_0x1bc525(0x1ec)), deleteLine(), (cleartime = 0x0), (fullLine = ![])); return; } placed && ((playerBlock = nextBlock), (nextBlock = new Block(width / 0x2, 0x0)), nextBlock[_0x1bc525(0x212)](), playerBlock[_0x1bc525(0x20b)] == nextBlock["col"] && random() < dupChance && ((nextBlock[_0x1bc525(0x20b)] = (nextBlock[_0x1bc525(0x20b)] + 0x1) % 0x4), nextBlock[_0x1bc525(0x1e3)]()), (placed = ![])), updateGrid(), playerBlock[_0x1bc525(0x1f6)](), playerBlock["controls"](), checkLine(), (t += 0x1); } function draw() { UI(), GameLogic(); }