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

public class assume {//假设人下的下一步并从预知的下一步中找到最优解
	static point p;
	public static boolean checkfour(boolean[][] b,boolean[][] h) {
		//创建操作副本防止影响数据源
		boolean b1[][]=new boolean[b.length][h.length];
		boolean h1[][]=new boolean[b.length][h.length];
		for (int i = 0; i < b.length; i++) {
			for (int j = 0; j < h.length; j++) {
				b1[i][j]=b[i][j];
				h1[i][j]=h[i][j];
				
			}
			
		}
		
		
		for (int i = 0; i < b.length; i++) {
			for (int j = 0; j < h.length; j++) {
				if (b1[i][j]||h1[i][j]) {
					
				}
				else {
					h1[i][j]=true;//假定该点为真
					double numd[][]=statenum.getstatenum(h1,b1);//计算当前非人机的权值
					for (int i1 = 0; i1 < b.length; i1++) {
						for (int j1 = 0; j1 < h.length; j1++) {
							if (numd[i1][j1]>=1.0) {
								System.out.println("如果"+i+","+j+"为真则"+i1+","+j1+"权重为"+numd[i1][j1]);
							}
							
							if (numd[i1][j1]>=4.0) {
								System.err.println("出现必争点"+i+"\t"+j);
								p=new point(i,j);
						    return true;
							}
							
						}
					
						
					}h1[i][j]=false;
				}
				
			}
			
		}
		
		return false;
	}

}
最近下载更多
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日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友