在线五子棋试玩地址:http://keleyi.com/game/12/

以下是完整代码,保存到html文件打开也可以玩:

 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <title>在线五子棋-柯乐义</title><base target="_blank" />
 5         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 6         <meta name="viewport" content="width=device-width, initial-scale=1.0"/>  
 7         <link rel="stylesheet" type="text/css" href="http://keleyi.com/game/12/main.css" />
 8         <script type="text/javascript" src="http://keleyi.com/keleyi/pmedia/jquery/jquery-1.10.2.min.js"></script>
 9         <script type="text/javascript" src="http://keleyi.com/game/12/locale.js"></script>
10         <script type="text/javascript" src="http://keleyi.com/game/12/gomoku.js"></script>
11         <script type="text/javascript">
12             var turn = 1, role = ['AI', 'human'];
13             $(function () {
14                 var gomoku = new Gomoku();
15                 gomoku.init(role[turn]);
16                 //turn = turn === 0 ? 1 : 0;
17                 $('#restart').click(function () {
18                     gomoku.restart.call(gomoku, role[turn]);
19                     // turn = turn === 0 ? 1 : 0;
20                 });
21                 $('#regret').click(function () {
22                     gomoku.regret.call(gomoku);
23                 });
24             });
25         </script>
26     </head>
27     <body>
28         <div id="toolbar">
29             <div class="top">
30                 <span class="switch-lang">
31                     <a href="javascript:;" id="zh-cn">简体中文</a>
32                     <a href="javascript:;" id="en">English</a>
33                 </span>
34                 <span class="copy">
35                   &copy;<a href="http://keleyi.com/">柯乐义</a>
36                 </span>
37             </div>
38             You: Black, AI: White, Round: <span  id="round">0</span>
39             <button id="restart">Restart</button>
40             <button id="regret">Regret</button>
41         </div>
42         <div id="output"></div>
43         <div id="main" ></div>
44         <div style="width:736px;margin:10px auto;clear:both;position:absolute;top:560px;left:0px;right:0px;"><a href="http://keleyi.com/game/">更多游戏</a></div>
45     </body>
46 </html>

更多游戏:http://keleyi.com/game/

web前端:http://www.cnblogs.com/jihua/p/webfront.html

原文:http://keleyi.com/a/bjad/j2a309yk.htm

posted on 2014-01-03 00:09  计划  阅读(2539)  评论(2编辑  收藏  举报