From 063b8498a68531ff7c0520e1df65c642f2d39fc1 Mon Sep 17 00:00:00 2001 From: Voxel Date: Mon, 14 Apr 2025 16:16:01 -0400 Subject: [PATCH] Create script.js --- assets/games/tictactoe/script.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 assets/games/tictactoe/script.js diff --git a/assets/games/tictactoe/script.js b/assets/games/tictactoe/script.js new file mode 100644 index 0000000..28f856c --- /dev/null +++ b/assets/games/tictactoe/script.js @@ -0,0 +1,10 @@ +let board = ['', '', '', '', '', '', '', '', '']; +let currentPlayer = 'X'; + +function makeMove(index) { + if (!board[index]) { + board[index] = currentPlayer; + document.querySelectorAll('.cell')[index].textContent = currentPlayer; + currentPlayer = currentPlayer === 'X' ? 'O' : 'X'; + } +}