Skip to content

Commit

Permalink
[ARCHIVE] Update ai.js
Browse files Browse the repository at this point in the history
  • Loading branch information
4yman-0 authored Jan 13, 2025
1 parent 700e1b4 commit 8164a79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions archive/webgames/tic-tac-toe/js/ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
});
});
Expand Down

0 comments on commit 8164a79

Please sign in to comment.