好了,这个就是在上次五子棋平台上开发的引擎1.0.但是这个引擎的水平比较的低,选取的就是在danao9函数中的部分,其余是不变的,主要思想就是在 黑棋每次的落点的四周的8个点评分,然后选出合适的点,有趋近同类棋子的特性,也就是会选择白棋多的地方落子。大家多给改进的意见哈!
public void danao9(int x,int y)
{
int luozix=20;
int luoziy=20;
int weizix=0;
int weiziy=0;
int jishu=0;
int jishu1;
int jishu2;
int dingweixunhuanx;
int dingweixunhuany;
int pinfeng[]= {0,0,0,0,0,0,0,0};
int jishux=0;
int jishuy=0;
int chuanrux;
int chuanruy;
int dingweix[]={0,0,0,0,0,0,0,0};
int dingweiy[]={0,0,0,0,0,0,0,0};
chuanrux=x;
chuanruy=y;
int shuzux=chuanrux/20;
int shuzuy=chuanruy/20;
for(dingweixunhuanx=shuzux-1;dingweixunhuanx for(dingweixunhuany=shuzuy-1;dingweixunhuany {
jishux=dingweixunhuanx;
jishuy=dingweixunhuany;
if(dingweixunhuanx==shuzux&&dingweixunhuany==shuzuy)
{
dingweix[jishu]=1000;
dingweiy[jishu]=1000;
continue;
}
else
{
if(jishux<0||jishux>24||jishuy<0||jishuy>24)
{
dingweix[jishu]=1000;
dingweiy[jishu]=1000;
}
else
{
if(0==bodyArray[jishux][jishuy])
{
dingweix[jishu]=jishux;
dingweiy[jishu]=jishuy;
}
else
{
dingweix[jishu]=1000;
dingweiy[jishu]=1000;
jishu++;
continue;
}
}
}
jishu++;
}
jishux=0;
jishuy=0;
for(jishu=0;jishu<8;jishu++)
{
weizix=0;
weiziy=0;
if(dingweix[jishu]==1000||dingweiy[jishu]==1000)
{
pinfeng[jishu]=10000;
continue;
}
else
{
weizix=dingweix[jishu];
weiziy=dingweiy[jishu];
}
for(jishu1=weizix-1;jishu1 for(jishu2=weiziy-1;jishu2 {
if(jishu1<0||jishu1>24||jishu2<0||jishu2>24)
{
pinfeng[jishu]=10000;
continue;
}
else
{
pinfeng[jishu]+=bodyArray[jishu1][jishu2];
}
}
}
jishu=0;
int zuixiao=100;
for(jishu=0;jishu<8;jishu++)
{
if(pinfeng[jishu] {
zuixiao=pinfeng[jishu];
}
}
for(jishu=0;jishu<8;jishu++)
{
if(pinfeng[jishu]==zuixiao)
{
luozix=dingweix[jishu]*20;
luoziy=dingweiy[jishu]*20;
break;
}
else
{
continue;
}
}
setDown2(luozix,luoziy);
})
+2;jishu2++)
+2;jishu1++)
+2;dingweixunhuany++)
+2;dingweixunhuanx++)
文章评论(0条评论)
登录后参与讨论