原创 五子引擎1.1.3

2012-2-20 22:10 1031 17 17 分类: 消费电子

这是再次改进后的引擎代码,现在可以识别一些简单的布局陷阱,但是还有不足,等以后添加上检测活三的模块后,可以变得更强!期待中,有改进意见只管说出来,大家一起交流!

public void danao9(int x,int y)
{
  int luozix=0;
 int luoziy=0;
 int jishu1=0;
 int jishu2=0;
 int hei*****shu=4;
 int bai*****shu=-1;
 int counter1=0;
 int counter2=0;
 int xunhuanx=0;
 int xunhuany=0;
 int chuanrux=0;
 int chuanruy=0;
 int locationx=0;
 int locationy=0;
 int weizix=0;
 int weiziy=0;
 chuanrux=x/20;
 chuanruy=y/20;
 int jifen[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 int dingweix[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 int dingweiy[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 int dingwei[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 for(xunhuanx=chuanrux-2;xunhuanx<chuanrux+3;xunhuanx++)
    for(xunhuany=chuanruy-2;xunhuany<chuanruy+3;xunhuany++)
    {
     if(xunhuanx==chuanrux&&xunhuany==chuanruy)
     {
      dingwei[jishu1]=1000;
     }
     else
     {
      if(xunhuanx<0||xunhuanx>24||xunhuany<0||xunhuany>24)
      {
       dingwei[jishu1]=1000;
      }
      else
      {
       dingweix[jishu1]=xunhuanx;
       dingweiy[jishu1]=xunhuany;
      }
     
     }
     jishu1++;
    }
 for(jishu2=0;jishu2<25;jishu2++)
 {
  weizix=dingweix[jishu2];
  weiziy=dingweiy[jishu2];
  if(dingwei[jishu2]==1000)
  {
   continue;
  }
  else
  {
   if((bodyArray[weizix][weiziy]==1)||(bodyArray[weizix][weiziy]==-1))
        {
         jifen[jishu2]+=-100;
        }
   else
   {
    
    
   }
  }
 }
 
 
 for(jishu2=0;jishu2<25;jishu2++)
 {
  weizix=dingweix[jishu2];
  weiziy=dingweiy[jishu2];
  if(jishu2!=13)
  {
   if(chuanrux==weizix||chuanruy==weiziy)
   {
    jifen[jishu2]+=hei*****shu;
   }
   else
   {
    if((chuanrux-weizix)==(chuanruy-weiziy))
    {
     jifen[jishu2]+=hei*****shu;
    }
    else
    {
     
    }
   }
  }
  if(dingwei[jishu2]==1000)
  {
   continue;
  }
  else
  {
   for(counter1=0;counter1<25;counter1++)
   {
    locationx=dingweix[counter1];
    locationy=dingweiy[counter1];
    if(locationx==weizix&&locationy==weiziy)
    {
     continue;
    }
    else
    {
     if(locationx==weizix||locationy==weiziy)
     {
      if(bodyArray[locationx][locationy]==1)
      {
       jifen[jishu2]+=hei*****shu;
      }
      else
      {
       if(bodyArray[locationx][locationy]==-1)
       {
        jifen[jishu2]+=bai*****shu;
       }
       else
       {
        
       }
      } 
     }
     else
     {
      if((locationx-weizix)==(locationy-weiziy))
      {
       if(bodyArray[locationx][locationy]==1)
        jifen[jishu2]+=hei*****shu;
       else
       {
        if(bodyArray[locationx][locationy]==-1)
        {
         jifen[jishu2]+=bai*****shu;
        }
        else
        {
         
        }
       } 
      }
      else
      {
       
      }
     }
    }
   }
  }
 }
 int zuida=0;
 for(counter2=0;counter2<25;counter2++)
 {
  if(jifen[counter2]>zuida)
  {
   zuida=jifen[counter2];
  }
  else
  {
   continue;
  }
 }
 
 for(counter2=0;counter2<25;counter2++)
 {
  if(jifen[counter2]==zuida)
  {
   luozix=dingweix[counter2]*20;
   luoziy=dingweiy[counter2]*20;
  }
  else
  {
   
  }
 } 
 
  setDown2(luozix,luoziy);
}

文章评论0条评论)

登录后参与讨论
我要评论
0
17
关闭 站长推荐上一条 /2 下一条