Tool Request: 468305445 - create_file
{"file_name":"index.html","content":"<!DOCTYPE html>\n<html>\n<head>\n <title>Tic-Tac-Toe</title>\n <link rel=\"stylesheet\" href=\"style.css\">\n</head>\n<body>\n <h1>Tic-Tac-Toe</h1>\n <div id=\"board\"></div>\n <button onclick=\"resetGame()\">Reset Game</button>\n <script src=\"script.js\"></script>\n</body>\n</html>"}
Tool Request: 982125059 - create_file
{"file_name":"style.css","content":"body {\n font-family: Arial, sans-serif;\n max-width: 600px;\n margin: 0 auto;\n padding: 20px;\n text-align: center;\n}\n\n#board {\n display: grid;\n grid-template-columns: repeat(3, 100px);\n grid-gap: 10px;\n margin: 20px 0;\n}\n\n.cell {\n width: 100px;\n height: 100px;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 2em;\n cursor: pointer;\n transition: background-color 0.3s ease;\n}\n\n.cell:hover {\n background-color: #e0e0e0;\n}\n\n.cell.X {\n color: blue;\n}\n\n.cell.O {\n color: red;\n}\n\nbutton {\n padding: 10px 20px;\n font-size: 1em;\n background-color: #4CAF50;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\nbutton:hover {\n background-color: #45a049;\n}"}
Tool Request: 896175581 - create_file
{"file_name":"script.js","content":"let board = ['', '', '', '', '', '', '', '', ''];\nlet currentPlayer = 'X';\nlet gameOver = false;\n\nfunction initBoard() {\n const boardElement = document.getElementById('board');\n boardElement.innerHTML = '';\n for (let i = 0; i < 9; i++) {\n const cell = document.createElement('div');\n cell.className = 'cell';\n cell.id = 'cell' + i;\n cell.addEventListener('click', () => cellClicked(i));\n boardElement.appendChild(cell);\n }\n}\n\nfunction cellClicked(index) {\n if (gameOver || board[index] !== '') return;\n board[index] = currentPlayer;\n const cell = document.getElementById('cell' + index);\n cell.innerHTML = currentPlayer;\n cell.classList.add(currentPlayer);\n if (checkWin()) {\n alert(currentPlayer + ' wins!');\n gameOver = true;\n } else if (checkDraw()) {\n alert('Draw!');\n gameOver = true;\n } else {\n currentPlayer = currentPlayer === 'X' ? 'O' : 'X';\n }\n}\n\nfunction checkWin() {\n const wins = [\n [0, 1, 2], [3, 4, 5], [6, 7, 8], // Rows\n [0, 3, 6], [1, 4, 7], [2, 5, 8], // Columns\n [0, 4, 8], [2, 4, 6] // Diagonals\n ];\n for (let i = 0; i < wins.length; i++) {\n const [a, b, c] = wins[i];\n if (board[a] && board[a] === board[b] && board[a] === board[c]) {\n return true;\n }\n }\n return false;\n}\n\nfunction checkDraw() {\n return board.every(cell => cell !== '');\n}\n\nfunction resetGame() {\n board = ['', '', '', '', '', '', '', '', ''];\n currentPlayer = 'X';\n gameOver = false;\n initBoard();\n}\n\nwindow.onload = initBoard;"}