{"id":2475,"date":"2026-04-27T03:23:02","date_gmt":"2026-04-27T03:23:02","guid":{"rendered":"https:\/\/c113134246.gowp.space\/team5\/?p=2475"},"modified":"2026-04-27T03:23:06","modified_gmt":"2026-04-27T03:23:06","slug":"%e5%b0%8f%e9%81%8a%e6%88%b2%e6%b8%ac%e8%a9%a6","status":"publish","type":"post","link":"https:\/\/c113134246.gowp.space\/team5\/%e5%b0%8f%e9%81%8a%e6%88%b2%e6%b8%ac%e8%a9%a6\/","title":{"rendered":"\u5c0f\u904a\u6232(\u6e2c\u8a66)"},"content":{"rendered":"\n<div id=\"tictactoe-app\">\n    <div class=\"game-wrapper\">\n        <h2 class=\"game-title\">\u4e95\u5b57\u68cb\u5927\u5c0d\u6297<\/h2>\n        <div id=\"game-status\">\u8f2a\u5230 \u73a9\u5bb6 X<\/div>\n        \n        <div class=\"game-board\" id=\"game-board\">\n            <div class=\"game-cell\" data-index=\"0\"><\/div>\n            <div class=\"game-cell\" data-index=\"1\"><\/div>\n            <div class=\"game-cell\" data-index=\"2\"><\/div>\n            <div class=\"game-cell\" data-index=\"3\"><\/div>\n            <div class=\"game-cell\" data-index=\"4\"><\/div>\n            <div class=\"game-cell\" data-index=\"5\"><\/div>\n            <div class=\"game-cell\" data-index=\"6\"><\/div>\n            <div class=\"game-cell\" data-index=\"7\"><\/div>\n            <div class=\"game-cell\" data-index=\"8\"><\/div>\n        <\/div>\n        \n        <button id=\"game-reset-btn\">\u91cd\u65b0\u958b\u59cb\u904a\u6232<\/button>\n    <\/div>\n\n    <style>\n        \/* \u4f7f\u7528\u5c08\u5c6c ID \u524d\u7db4\uff0c\u907f\u514d\u5e72\u64fe WordPress \u539f\u6709\u6a23\u5f0f *\/\n        #tictactoe-app {\n            font-family: 'PingFang TC', 'Microsoft JhengHei', sans-serif;\n            display: flex;\n            justify-content: center;\n            padding: 20px;\n            background: #f9f9f9;\n            border-radius: 15px;\n            margin: 20px 0;\n        }\n        .game-wrapper { text-align: center; }\n        .game-title { margin-top: 0; color: #333; }\n        #game-status { \n            margin-bottom: 15px; \n            font-size: 1.1rem; \n            padding: 8px;\n            background: #eee;\n            border-radius: 5px;\n        }\n        .game-board { \n            display: grid; \n            grid-template-columns: repeat(3, 80px); \n            grid-gap: 8px; \n            justify-content: center;\n        }\n        .game-cell { \n            width: 80px; \n            height: 80px; \n            background: #fff; \n            border: 2px solid #ddd; \n            font-size: 2rem; \n            display: flex; \n            align-items: center; \n            justify-content: center; \n            cursor: pointer; \n            border-radius: 10px;\n            transition: all 0.2s;\n        }\n        .game-cell:hover { background: #f0f0f0; border-color: #bbb; }\n        .game-cell.taken { cursor: not-allowed; }\n        #game-reset-btn { \n            margin-top: 25px; \n            padding: 10px 25px; \n            font-size: 1rem; \n            cursor: pointer; \n            background: #4CAF50; \n            color: white; \n            border: none; \n            border-radius: 50px;\n            box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n        }\n        #game-reset-btn:hover { background: #45a049; }\n    <\/style>\n\n    <script>\n        (function() {\n            const board = document.getElementById('game-board');\n            const cells = board.querySelectorAll('.game-cell');\n            const statusLabel = document.getElementById('game-status');\n            const resetBtn = document.getElementById('game-reset-btn');\n\n            let currentPlayer = 'X';\n            let gameState = [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"];\n            let isGameActive = true;\n\n            const winPatterns = [\n                [0,1,2], [3,4,5], [6,7,8], [0,3,6], \n                [1,4,7], [2,5,8], [0,4,8], [2,4,6]\n            ];\n\n            function handleCellClick(e) {\n                const idx = parseInt(e.target.getAttribute('data-index'));\n                if (gameState[idx] !== \"\" || !isGameActive) return;\n\n                gameState[idx] = currentPlayer;\n                e.target.innerText = currentPlayer;\n                e.target.classList.add('taken');\n                \n                checkWinner();\n            }\n\n            function checkWinner() {\n                let won = false;\n                for (let pattern of winPatterns) {\n                    const [a, b, c] = pattern;\n                    if (gameState[a] && gameState[a] === gameState[b] && gameState[a] === gameState[c]) {\n                        won = true;\n                        break;\n                    }\n                }\n\n                if (won) {\n                    statusLabel.innerText = `\ud83c\udf89 \u73a9\u5bb6 ${currentPlayer} \u7372\u52dd\uff01`;\n                    statusLabel.style.background = \"#d4edda\";\n                    isGameActive = false;\n                    return;\n                }\n\n                if (!gameState.includes(\"\")) {\n                    statusLabel.innerText = \"\ud83e\udd1d \u5e73\u624b\uff01\u518d\u8a66\u4e00\u6b21\uff1f\";\n                    isGameActive = false;\n                    return;\n                }\n\n                currentPlayer = currentPlayer === \"X\" ? \"O\" : \"X\";\n                statusLabel.innerText = `\u8f2a\u5230 \u73a9\u5bb6 ${currentPlayer}`;\n            }\n\n            function restart() {\n                currentPlayer = 'X';\n                gameState = [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"];\n                isGameActive = true;\n                statusLabel.innerText = `\u8f2a\u5230 \u73a9\u5bb6 X`;\n                statusLabel.style.background = \"#eee\";\n                cells.forEach(c => {\n                    c.innerText = \"\";\n                    c.classList.remove('taken');\n                });\n            }\n\n            cells.forEach(c => c.addEventListener('click', handleCellClick));\n            resetBtn.addEventListener('click', restart);\n        })();\n    <\/script>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e95\u5b57\u68cb\u5927\u5c0d\u6297 \u8f2a\u5230 \u73a9\u5bb6 X \u91cd\u65b0\u958b\u59cb\u904a\u6232<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[51],"tags":[],"class_list":["post-2475","post","type-post","status-publish","format-standard","hentry","category-51"],"jetpack_featured_media_url":"","uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/c113134246.gowp.space\/team5\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"\u4e95\u5b57\u68cb\u5927\u5c0d\u6297 \u8f2a\u5230 \u73a9\u5bb6 X \u91cd\u65b0\u958b\u59cb\u904a\u6232","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/posts\/2475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/comments?post=2475"}],"version-history":[{"count":1,"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/posts\/2475\/revisions"}],"predecessor-version":[{"id":2476,"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/posts\/2475\/revisions\/2476"}],"wp:attachment":[{"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/media?parent=2475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/categories?post=2475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c113134246.gowp.space\/team5\/wp-json\/wp\/v2\/tags?post=2475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}