diff --git a/server/index.js b/server/index.js index cc172b7..cb04953 100644 --- a/server/index.js +++ b/server/index.js @@ -250,8 +250,6 @@ function lockPiece(player) { } } - if (player.currentPiece.y <= 0) player.eliminated = true; - const rowsCleared = clearRows(player); if (!spawnPiece(player)) player.eliminated = true; @@ -293,19 +291,12 @@ function sendGarbage(sender, rowsCleared) { } function addGarbageToPlayer(player) { - player.board.pop(); + // Remove top row and add garbage to bottom + player.board.shift(); const garbageRow = Array(BOARD_WIDTH).fill(GARBAGE_COLOR); garbageRow[Math.floor(Math.random() * BOARD_WIDTH)] = 0; - player.board.unshift(garbageRow); - - for (let row = 0; row < 2; row++) { - for (let col = 0; col < BOARD_WIDTH; col++) { - if (player.board[row][col] !== 0) { - player.eliminated = true; - return; - } - } - } + player.board.push(garbageRow); + // Elimination is handled by spawnPiece when a new piece can't fit } function startGame() {