⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1.htm

📁 中国象棋人工智能
💻 HTM
📖 第 1 页 / 共 5 页
字号:
   if(isEnemy(tempID)){
   //2,中间有且只有一个棋子
    if( ( (isX(x1,y1,x2,y2) ==false) && ( getQ_y(y1,y2,x1).length==2 || getQ_y(y1,y2,x1).length==3) )||( (isX(x1,y1,x2,y2) == true) && ( getQ_x(x1,x2,y1).length==2 || getQ_x(x1,x2,y1).length==3 ) ) ){
    rtn=true;
    }
   }
  }
 }
 return(rtn);
}
//兵的走法
function ruleBing(x1,y1,x2,y2){
 var rtn=false;  
 //1,不能后退
 if(y2-y1<=0){
  //2,只走一格
  if(isSingle(x1,y1,x2,y2)){
   //3,过河前竖走
   if(y1>=230 && (!isX(x1,y1,x2,y2))){
   rtn=true;
   }
    //4,过河后随便
   if(y1<230){
   rtn=true;
   }
  
  }
 }
 return(rtn);
}

//*********以下是行棋规则辅助函数部分***********

function getArea(x1,y1,x2,y2){
 //得到面积
 var rtn=0;
 rtn=Math.abs((x1-x2)*(y1-y2)); 
 return(rtn);
}
function isX(x1,y1,x2,y2){
//判断是否x方向比y方向长
 var rtn=false;
 if (Math.abs(y1-y2)<Math.abs(x1-x2)){
  rtn=true;
 }
 return(rtn);
}
function isSingle(x1,y1,x2,y2){
//是否某方向只动了一格
 var rtn=false;
   //1,面积是0
 var area=getArea(x1,y1,x2,y2); 
 if(area==0 ){
 //两面只能一格
  if ( ( (!isX(x1,y1,x2,y2))  && Math.abs(y1-y2)==50 ) || ( isX(x1,y1,x2,y2) && Math.abs(x1-x2)==50 )){
   rtn=true;
  }
 }
 return(rtn);
}
//*********以下是得到棋盘某点线状态部分************

function getQ_xy(x,y){
//得到某点棋子id
  var rtn="";
   for(j=1;j <= 32;j++){
   if (parseInt(document.getElementById("q" +j ).style.left)==x && parseInt(document.getElementById("q" +j ).style.top)==y){
    rtn="q" + j;    
   }
  } 
  //qqq.innerText=rtn ; 
  return(rtn.replace(/(^\s*)|(\s*$)/g,""));  
}

function getQ_x(x1,x2,y){
//得到x轴向两点的棋子id连接的字串
 var rtn="";  
 for(i=Math.min(x1,x2)+50;i<Math.max(x1,x2);i+=50){
  rtn+=getQ_xy(i,y);
 } 
 return(rtn.replace(/(^\s*)|(\s*$)/g,""));
}
function getQ_y(y1,y2,x){
//得到y轴向两点的棋子id连接的字串
 var rtn="";  
 for(i=Math.min(y1,y2)+50;i<Math.max(y1,y2);i+=50){
  rtn+=getQ_xy(x,i);
 }
 //qqq.innerText=rtn ;
 return(rtn.replace(/(^\s*)|(\s*$)/g,""));
}
//判断某点是否是敌人
function isEnemy(tempID){
 var rtn=false;  
 if (tempID!=""){
  if(document.getElementById(tempID).fillColor != myColor){
  rtn=true;
  }
 }
  
 return(rtn);
}
//判断某点是否是敌人老将
function isKing(tempID){
 var rtn=false;  
  if (isEnemy(tempID)){  
  var kingName=document.getElementById(tempID).innerText.replace(/(^\s*)|(\s*$)/g,"");  
  if( kingName=="将" || kingName=="帅" ){
   rtn=true;
   
  }
 }
  
 return(rtn);
}
    </script>

    <title>超级大笨狼象棋</title>
</head>
<body onselectstart="document.selection.clear();"   oncontextmenu="selectNull();return(false);">
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=&apos;" + gaJsHost + "google-analytics.com/ga.js&apos; type=&apos;text/javascript&apos;%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._initData();
pageTracker._trackPageview();
</script>
    <v:group style="top: 0; left: 0; width: 400px; height: 450px; position: relative;"
        coordorig="0,0" coordsize="400,450">
        <v:rect id="qiPan" style="position: relative; width: 460; height: 510px; top=-30;
            left=-30; z-index: 1;" fillcolor="#f0e68c" strokeweight="2">
            <v:textbox inset="80pt,180pt,1pt,1pt" style="z-index: 2; font-size=24; font-weight: bold;
                position: relative; letter-spacing: 2em; color=&apos;#cc9933&apos;; filter: glow(color=#ffffff,strength=1) alpha(opacity=90);
                cursor: default;"> 楚河汉界</v:textbox>
            <v:shadow on="Ture" type="single" color="#8b4513" offset="3px,3px" />
        </v:rect>
        <v:line from="0,0" to="400,0" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,50" to="400,50" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,100" to="400,100" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,150" to="400,150" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,200" to="400,200" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,250" to="400,250" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,300" to="400,300" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,350" to="400,350" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,400" to="400,400" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,450" to="400,450" style="z-index: 3; filter: " strokeweight="1pt">
        </v:line>
        <v:line from="0,0" to="0,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="400,0" to="400,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="0,0" to="0,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="50,0" to="50,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="100,0" to="100,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="150,0" to="150,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="200,0" to="200,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="250,0" to="250,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="300,0" to="300,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="350,0" to="350,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="400,0" to="400,200" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="0,250" to="0,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="50,250" to="50,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="100,250" to="100,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="150,250" to="150,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="200,250" to="200,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="250,250" to="250,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="300,250" to="300,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="350,250" to="350,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="400,250" to="400,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="150,0" to="250,100" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="250,0" to="150,100" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="150,350" to="250,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="250,350" to="150,450" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="55,105" to="55,110" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="55,105" to="60,105" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="55,95" to="55,90" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="55,95" to="60,95" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="45,105" to="45,110" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="45,105" to="40,105" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="45,95" to="45,90" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="45,95" to="40,95" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="355,105" to="355,110" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="355,105" to="360,105" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="355,95" to="355,90" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="355,95" to="360,95" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="345,105" to="345,110" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="345,105" to="340,105" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="345,95" to="345,90" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="345,95" to="340,95" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="55,355" to="55,360" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="55,355" to="60,355" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="55,345" to="55,340" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="55,345" to="60,345" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="45,355" to="45,360" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="45,355" to="40,355" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="45,345" to="45,340" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="45,345" to="40,345" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="355,355" to="355,360" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="355,355" to="360,355" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="355,345" to="355,340" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="355,345" to="360,345" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="345,355" to="345,360" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="345,355" to="340,355" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="345,345" to="345,340" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="345,345" to="340,345" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="105,155" to="105,160" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="105,155" to="110,155" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="105,145" to="105,140" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="105,145" to="110,145" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="95,155" to="95,160" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="95,155" to="90,155" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="95,145" to="95,140" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="95,145" to="90,145" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="205,155" to="205,160" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="205,155" to="210,155" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="205,145" to="205,140" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="205,145" to="210,145" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="195,155" to="195,160" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="195,155" to="190,155" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="195,145" to="195,140" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="195,145" to="190,145" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="305,155" to="305,160" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="305,155" to="310,155" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="305,145" to="305,140" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="305,145" to="310,145" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="295,155" to="295,160" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="295,155" to="290,155" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="295,145" to="295,140" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="295,145" to="290,145" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="105,305" to="105,310" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="105,305" to="110,305" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="105,295" to="105,290" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="105,295" to="110,295" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="95,305" to="95,310" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="95,305" to="90,305" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="95,295" to="95,290" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="95,295" to="90,295" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="205,305" to="205,310" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="205,305" to="210,305" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="205,295" to="205,290" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="205,295" to="210,295" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="195,305" to="195,310" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="195,305" to="190,305" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="195,295" to="195,290" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="195,295" to="190,295" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="305,305" to="305,310" style="z-index: 3;" strokeweight="1pt">
        </v:line>
        <v:line from="305,305" to="310,305" style="z-index: 3;" strokeweight="1pt">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -