惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

秋記Autumn - HTML5源码

暂无文章

中国象棋 · 完美居中版- HTML5源码
秋記Autumn · 2026-03-31 · via 秋記Autumn - HTML5源码

<!DOCTYPE HTML>

<html>

<head>

<meta charset="UTF-8">

<title>中国象棋 1.5 倍版</title>

<meta name="viewport" content="width=device-width; initial-scale=1.0" />

<link href="css/chess.css" rel="stylesheet" type="text/css">

</head>

<body>

<div id="chessBox" class="chess_box">

    <canvas id="chess"></canvas>

    <div class="left-buttons">

        <button class="side-btn" id="indexDy">人机对弈</button>

        <button class="side-btn" id="indexQj">挑战棋局</button>

    </div>

    <div class="right-buttons">

        <button class="side-btn" id="restartBtn">重新开始</button>

        <button class="side-btn" id="regretBtn">悔棋</button>

    </div>

    <audio src="audio/click.wav" id="clickAudio" preload="auto"></audio>

    <audio src="audio/select.wav" id="selectAudio" preload="auto"></audio>

</div>

<div id="dyPopup" class="popup-menu">

    <div class="close-btn" id="closeDy"></div>

    <div class="menu-info">

        <label><input name="depth" type="radio" value="2"> 菜鸟水平</label>

        <label><input name="depth" type="radio" value="3" checked> 中级水平</label>

        <label><input name="depth" type="radio" value="4"> 高手水平</label>

    </div>

    <div class="menu-btn" id="playBtn">开始对弈</div>

</div>

<div id="qjPopup" class="popup-menu">

    <div class="close-btn" id="closeQj"></div>

    <div class="menu-info">

        <label><input name="clasli" type="radio" value="0" checked> 八卦阵法</label>

        <label><input name="clasli" type="radio" value="1"> 很二棋局</label>

        <label><input name="clasli" type="radio" value="2"> 七星会阵</label>

    </div>

    <div class="menu-btn" id="clasliBtn">开始挑战</div>

</div>

<script type="text/javascript" src="js/common.js"></script>

<script type="text/javascript" src="js/play.js"></script>

<script type="text/javascript" src="js/AI.js"></script>

<script type="text/javascript" src="js/gambit.js"></script>

<script type="text/javascript" src="js/clasli.js"></script>

<script>

// 确保所有按钮正常工作

(function() {

    // 等待所有脚本加载完成

    window.addEventListener('load', function() {

        console.log('页面加载完成,初始化按钮...');

        // 获取元素

        var chessBox = document.getElementById('chessBox');

        var dyPopup = document.getElementById('dyPopup');

        var qjPopup = document.getElementById('qjPopup');

        // 默认直接开始人机对弈(中级)

        setTimeout(function() {

            if (typeof play !== 'undefined' && play.init) {

                play.isPlay = true;

                play.init(3);

                chessBox.style.display = 'block';

            }

        }, 500);

        // 人机对弈按钮

        document.getElementById('indexDy').onclick = function(e) {

            e.stopPropagation();

            qjPopup.style.display = 'none';

            dyPopup.style.display = 'block';

        };

        // 挑战棋局按钮

        document.getElementById('indexQj').onclick = function(e) {

            e.stopPropagation();

            dyPopup.style.display = 'none';

            qjPopup.style.display = 'block';

        };

        // 关闭弹出菜单

        document.getElementById('closeDy').onclick = function() {

            dyPopup.style.display = 'none';

        };

        document.getElementById('closeQj').onclick = function() {

            qjPopup.style.display = 'none';

        };

        // 点击空白处关闭菜单

        window.onclick = function(e) {

            if (!e.target.closest('.popup-menu') &&

                !e.target.closest('#indexDy') &&

                !e.target.closest('#indexQj')) {

                dyPopup.style.display = 'none';

                qjPopup.style.display = 'none';

            }

        };

        // 开始对弈按钮

        document.getElementById('playBtn').onclick = function() {

            var depth = 3;

            var radios = document.getElementsByName('depth');

            for (var i = 0; i < radios.length; i++) {

                if (radios[i].checked) depth parseInt(radios[i].value, 10);

            }

            if (typeof play !== 'undefined' && play.init) {

                play.isPlay true;

                play.init(depth);

                chessBox.style.display 'block';

                dyPopup.style.display 'none';

            }

        };

        // 开始挑战按钮

        document.getElementById('clasliBtn').onclick function() {

            var clasli 0;

            var radios document.getElementsByName('clasli');

            for (var i 0; i < radios.length; i++) {

                if (radios[i].checked) clasli parseInt(radios[i].value, 10);

            }

            if (typeof play !== 'undefined' && play.init && typeof com.clasli !== 'undefined') {

                play.isPlay true;

                play.init(4, com.clasli[clasli].map);

                chessBox.style.display 'block';

                qjPopup.style.display 'none';

            }

        };

        // 重新开始

        document.getElementById('restartBtn').onclick function() {

            if (confirm('是否确定要重新开始?')) {

                if (typeof play !== 'undefined') {

                    play.isPlay true;

                    play.init(play.depth || 3, play.nowMap);

                }

            }

        };

        // 悔棋

        document.getElementById('regretBtn').onclick function() {

            if (typeof play !== 'undefined' && play.regret) {

                play.regret();

            }

        };

    });

})();

</script>

</body>

</html>