This commit is contained in:
Dragon Fire
2021-01-09 13:51:10 -05:00
parent 35efe22246
commit cf2dd37d1b
+7 -3
View File
@@ -108,9 +108,13 @@ module.exports = class TicTacToeCommand extends Command {
const newBoard = [[], [], []]; const newBoard = [[], [], []];
let col = 0; let col = 0;
for (const piece of board) { for (const piece of board) {
if (piece === 'X') newBoard[col].push('x'); if (piece === 'X') {
if (piece === 'O') newBoard[col].push('o'); newBoard[col].push('x');
newBoard[col].push('_'); } else if (piece === 'O') {
newBoard[col].push('o');
} else {
newBoard[col].push('_');
}
if (newBoard[col].length === 3) col++; if (newBoard[col].length === 3) col++;
} }
return newBoard; return newBoard;