首页>代码>java swing五子棋人机版客户端游戏>/五子棋/src/五子棋人机版/compulterpeople.java
package 五子棋人机版;

public class compulterpeople {
public static point getPoint(double[][] num,double numcomputer[][],boolean b[][],boolean h[][]) {
	boolean havefour=assume.checkfour(b, h);
	point p=assume.p;
	boolean havefourcom=assume.checkfour(h, b);//人机
	point pcom=assume.p;
	double middle=num[0][0];
	double middlec=numcomputer[0][0];
	int x=0,y=0;
	int xc=0,yc=0;
for (int i = 0; i < num.length; i++) {
	for (int j = 0; j < num.length; j++) {
		if (middle<num[i][j]) {
			x=i;
			y=j;
			middle=num[i][j];
		}
		if (middlec<numcomputer[i][j]) {
			xc=i;
			yc=j;
			middlec=numcomputer[i][j];
		}
		
	}
	
}	//找到防守要点(x,y)
if (x==0&&y==0) {//人机如果先走
	return new point(10,10);
	
}
if (middlec>=4.0) {
	
}
else {
	if (havefourcom&&(pcom.getX()!=0||pcom.getY()!=0)) {//优先使用AI进行假三真四攻击
	return pcom;
	
	
}
}

if (middlec>=4.0) {//适当攻击
	return new point(xc,yc);
}
else {
	if (middle>=4.0) {//如果4.0已经存在再次判断一定出错
		
	}
	else {
		if (havefour) {//假三真四问题---人
		return p;
	}
	}
	
	if (middle<4.0&&middle>=3.0) {
//待优化		
}
if(middle<3.0) {
	if (middlec>=3.0) {
		return new point(xc,yc);
		
	}
}
if ((int)middle==(int)middlec) {
	return new point(xc,yc);
	
}
	
}


	
	return new point(x,y);
}
}
最近下载更多
2485243744  LV1 2023年10月25日
2385649653  LV7 2023年6月26日
hhhhhh724  LV1 2023年5月31日
Swjyykx  LV1 2023年4月27日
上邪(ye)  LV6 2023年4月23日
段朝洪  LV15 2023年3月7日
songguo520  LV1 2023年1月13日
刘鹏yyds  LV10 2022年12月21日
simsom  LV1 2022年12月13日
三路失散  LV1 2022年10月29日
最近浏览更多
Huangjy2157  LV2 1月4日
张晨荣  LV1 2023年12月19日
2485243744  LV1 2023年10月25日
tdfgjbi0de  LV6 2023年10月13日
wangjialiang1  LV17 2023年8月20日
2385649653  LV7 2023年6月25日
陈小灏  LV14 2023年6月5日
lclclclccc 2023年6月2日
暂无贡献等级
hhhhhh724  LV1 2023年5月31日
Swjyykx  LV1 2023年4月27日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友