Tool Request: call_6X1JHX8IH3CKedHMeIS7Xkli - create_file
{"file_name":"script.js","content":"const cells = document.querySelectorAll('.cell');\nconst statusText = document.getElementById('status');\nconst restartBtn = document.getElementById('restart');\nlet board = ['', '', '', '', '', '', '', '', ''];\nlet currentPlayer = 'X';\nlet running = false;\n\nconst winConditions = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6]\n];\n\n// Initialize game\ninitializeGame();\n\nfunction initializeGame() {\n cells.forEach(cell => cell.addEventListener('click', cellClicked));\n restartBtn.addEventListener('click', restartGame);\n statusText.textContent = `${currentPlayer}'s turn`;\n running = true;\n}\n\nfunction cellClicked() {\n const index = this.getAttribute('data-index');\n if (board[index] !== '' || !running) {\n return;\n }\n updateCell(this, index);\n checkWinner();\n}\n\nfunction updateCell(cell, index) {\n board[index] = currentPlayer;\n cell.textContent = currentPlayer;\n}\n\nfunction changePlayer() {\n currentPlayer = currentPlayer === 'X' ? 'O' : 'X';\n statusText.textContent = `${currentPlayer}'s turn`;\n}\n\nfunction checkWinner() {\n let roundWon = false;\n for (let i = 0; i < winConditions.length; i++) {\n const condition = winConditions[i];\n const cellA = board[condition[0]];\n const cellB = board[condition[1]];\n const cellC = board[condition[2]];\n if (cellA === '' || cellB === '' || cellC === '') {\n continue;\n }\n if (cellA === cellB && cellB === cellC) {\n roundWon = true;\n break;\n }\n }\n if (roundWon) {\n statusText.textContent = `${currentPlayer} wins!`;\n running = false;\n } else if (!board.includes('')) {\n statusText.textContent = `Draw!`;\n running = false;\n } else {\n changePlayer();\n }\n}\n\nfunction restartGame() {\n currentPlayer = 'X';\n board = ['', '', '', '', '', '', '', '', ''];\n statusText.textContent = `${currentPlayer}'s turn`;\n cells.forEach(cell => cell.textContent = '');\n running = true;\n}"}