From 8164a79c28fd315cc3828fbcb30d9801ed861641 Mon Sep 17 00:00:00 2001 From: 4yman <170770027+4yman-0@users.noreply.github.com> Date: Mon, 13 Jan 2025 21:39:09 +0100 Subject: [PATCH] [ARCHIVE] Update ai.js --- archive/webgames/tic-tac-toe/js/ai.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archive/webgames/tic-tac-toe/js/ai.js b/archive/webgames/tic-tac-toe/js/ai.js index 934359b..31cdb73 100644 --- a/archive/webgames/tic-tac-toe/js/ai.js +++ b/archive/webgames/tic-tac-toe/js/ai.js @@ -5,10 +5,10 @@ function AIMove() { const availableMoves = []; // Collect all available moves (empty cells) - Game.cells.forEach(col => { + Game.cells.forEach((col, colIndex) => { col.forEach(cell => { - if (Game.cells[col][cell] === Players.EMPTY) { - availableMoves.push({ col, cell }); + if (col[cell] === Players.EMPTY) { + availableMoves.push({ col: colIndex, cell }); } }); });