mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
Fix
This commit is contained in:
@@ -105,11 +105,13 @@ module.exports = class TicTacToeCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
convertBoard(board) {
|
convertBoard(board) {
|
||||||
const newBoard = [];
|
const newBoard = [[], [], []];
|
||||||
|
let col = 0;
|
||||||
for (const piece of board) {
|
for (const piece of board) {
|
||||||
if (piece === 'X') newBoard.push('x');
|
if (piece === 'X') newBoard[col].push('x');
|
||||||
if (piece === 'O') newBoard.push('o');
|
if (piece === 'O') newBoard[col].push('o');
|
||||||
newBoard.push('_');
|
newBoard[col].push('_');
|
||||||
|
if (newBoard[col].length === 3) col++;
|
||||||
}
|
}
|
||||||
return newBoard;
|
return newBoard;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user