Javascript版五子棋,无禁手。欢迎提出算法的改进意见。
2. [代码]HTML
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" type="text/css" href="./main.css?v=12" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="./locale.js"></script>
<script type="text/javascript" src="./gomoku.js?v=2.2"></script>
<script type="text/javascript">
var turn = 1, role = ['AI', 'human'];
$(function() {
var gomoku = new Gomoku();
gomoku.init(role[turn]);
//turn = turn === 0 ? 1 : 0;
$('#restart').click(function() {
gomoku.restart.call(gomoku, role[turn]);
// turn = turn === 0 ? 1 : 0;
});
$('#regret').click(function() {
gomoku.regret.call(gomoku);
});
});
</script>
</head>
<body>
<div , tahoma, verdana, helvetica; color: rgba(0, 0, 0, 1); text-transform: none; text-indent: 0; letter-spacing: normal; word-spacing: 0; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px'>};
相关文章:
