js 钻石棋网页游戏代码
钻石棋游戏
body{text-align:center; font-size:12px;}
td{font-size:12px;text-align:center}
table .qz{ border:1px solid #ccc; padding:0px; margin:0px;}
.ayc{ background:#fff; background-image:none}
table td{width:60px; height:60px;}
table td input,.axs{ height:60px; width:60px; border:0px; background:url(/upload/2010-3/20100303233932866.gif) no-repeat center center; color:#ccc; font-size:12px}
#zhuangtai{ font-size:16px;}
.axz{height:60px; width:60px; border:0px; background:url(/upload/2010-3/20100303233933912.gif) no-repeat center center; }
.zhuangt{ height:30px; line-height:30px; font-size:12px;}
.zhuangt span{ color:red; font-weight:bold;}
独立钻石棋
剩余32 个棋子、共走0步
var x,y,x1,y1,a1,a2,an=0,qzs=0,str="",bs=0;
var xy =new Array() ;
xy[0]=new Array();
xy[1]=new Array();
xy[2]=new Array();
xy[3]=new Array();
xy[4]=new Array();
xy[5]=new Array();
xy[6]=new Array();
function xz(x,y)
{
var a1=document.getElementById("n"+x+y);
//alert(x+"-"+y+"-"+x1+"-"+y1+"-"+xy[x,y]);
if(an==0 && xy[x][y]==1){
a1.className="axz";
a2=a1;
an=1;
x1=x;
y1=y;
}
else if(an==1)
{
if(ks2(x,y,x1,y1)==1){
xy[x1][y1]=0;
a1.className="axs";
xy[x][y]=1;
a2.className="ayc";
qzs=qzs-1;
bs=bs+1;
document.getElementById("zhuangtai").innerHTML=qzs;
document.getElementById("bushu").innerHTML=bs;
}else
{
a2.className="axs";
}
an=0;
}
}
//检测棋子
function ks(x,y)
{
if(x=5 || x>=5 && y=5 && y>=5 || x==3 && y==3){
xs=0;
}
else
{
xs=1;
}
return xs;
}
function ks2(x,y,x1,y1)
{
xs=0;
if(x==x1 && (y-2==y1 || y+2==y1) && xy[x][y]==0)
{
if(y-2==y1 && xy[x][y-1]==1){
xs=1;
yincang(x,y-1);
}else if(y+2==y1 && xy[x][y+1]==1){
xs=1;
yincang(x,y+1);
}
}else if(y==y1 && (x-2==x1 || x+2==x1) && xy[x][y]==0)
{
if(x-2==x1 && xy[x-1][y]==1){
xs=1;
yincang(x-1,y);
}else if(x+2==x1 && xy[x+1][y]==1){
xs=1;
yincang(x+1,y);
}
}
return xs;
}
function yincang(x,y)
{
xy[x][y]=0;
document.getElementById("n"+x+y).className="ayc";
}
function zb(x,y)
{
for (x=0;x");
for (x=0;x");
for (y=0;y";
//alert(x+"-"+y+"-"+x1+"-"+y1+"+xy[x][y]+");
document.write("
");
}
else{
document.write("
");
}
}
document.write("
");
}
document.write("
");
document.getElementById("n33").className="ayc";
qzs=32;
xy[3][3]=0;
//document.write(str);
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]