亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? chess.cpp

?? 包括用VC開(kāi)發(fā)的五子棋程序 以及VRML語(yǔ)言寫(xiě)的虛擬地理環(huán)境程序
?? CPP
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
#include "Chess.h"
#include <iostream.h>
#include <afxtempl.h>

Chess::Chess()
{
	for( int i=0;i<15;i++ )
		for( int j=0;j<15;j++ )
			FiveArray[i][j]=0;
	StepList.RemoveAll();
}

Chess::~Chess()
{
	
}

int Chess::UpDown(int i, int j, int side)					//查詢出從上到下相同的棋子數(shù)
{
	int tempi,count;
	count=1;

	tempi=i;
	while( --tempi>=0 && FiveArray[tempi][j]==side )
	{
		count++;
	}

	tempi=i;
	while( ++tempi<15 && FiveArray[tempi][j]==side )
	{
		count++;
	}

	return count;
}

int Chess::LeftRight(int i, int j, int side)					//查詢出從左到右相同的棋子數(shù)
{
	int tempj,count;
	count=1;

	tempj=j;
	while( --tempj>=0 && FiveArray[i][tempj]==side )
	{
		count++;
	}

	tempj=j;
	while( ++tempj<15 && FiveArray[i][tempj]==side )
	{
		count++;
	}
	
	return count;
}

int Chess::LUptoDown(int i, int j, int side)					//查詢出從左上到右下相同的棋子數(shù)
{
	int tempi,tempj,count;
	count=1;

	tempi=i;
	tempj=j;
	while( --tempi>=0 && --tempj>=0 && FiveArray[tempi][tempj]==side )
	{
		count++;
	}

	tempi=i;
	tempj=j;
	while( ++tempi<15 && ++tempj<15 && FiveArray[tempi][tempj]==side )
	{
		count++;
	}

	return count;
}

int Chess::RUptoDown(int i, int j, int side)					//查詢出從右上到左下相同的棋子數(shù)
{
	int tempi,tempj,count;
	count=1;

	tempi=i;
	tempj=j;
	while( --tempi>=0 && ++tempj<15 && FiveArray[tempi][tempj]==side )
	{
		count++;
	}

	tempi=i;
	tempj=j;
	while( ++tempi<15 && --tempj>=0 && FiveArray[tempi][tempj]==side )
	{
		count++;
	}

	return count;
}

int Chess::LeftToRight_Status(int i, int j, int array[][15])		//查詢當(dāng)前所走步的棋盤(pán)狀態(tài)
{
	int tempj,count;
	bool aliveone=false;
	bool alivetwo=false;
	bool beyond=false;
	int side=array[i][j];
	count=1;
	tempj=j;
	while( --tempj>=0 && array[i][tempj]==side )
		count++;
	if( tempj>=0 && array[i][tempj]==0 )
		aliveone=true;
	else if( tempj>=0 && array[i][tempj]==1 )
		beyond=true;

	tempj=j;
	while( ++tempj<15 && array[i][tempj]==side )
		count++;
	if( tempj<15 && array[i][tempj]==0 )
		alivetwo=true;
	else if( tempj<15 && array[i][tempj]==1 )
		beyond=true;

	if( count>=5 )
		return 8;
	if( count==1 && aliveone==true && alivetwo==true )
		return 0;
	if( count==1 && beyond==true )
		return 1;
	if( count>1 && aliveone==true && alivetwo==true )
		return count+3;
	if( count>1 && (aliveone==true || alivetwo==true) )
		return count;

	return 0;
}

int Chess::UpToDown_Status(int i, int j, int array[][15])
{
	int tempi,count;
	bool aliveone=false;
	bool alivetwo=false;
	bool beyond=false;
	int side=array[i][j];
	count=1;

	tempi=i;
	while( --tempi>=0 && array[tempi][j]==side )
		count++;
	if( tempi>=0 && array[tempi][j]==0 )
		aliveone=true;
	else if( tempi>=0 && array[tempi][j]==1 )
		beyond=true;

	tempi=i;
	while( ++tempi<15 && array[tempi][j]==side )
		count++;
	if( tempi<15 && array[tempi][j]==0 )
		alivetwo=true;
	else if( tempi<15 && array[tempi][j]==1 )
		beyond=true;

	if( count>=5 )
		return 8;
	if( count==1 && aliveone==true && alivetwo==true )
		return 0;
	if( count==1 && beyond==true )
		return 1;
	if( count>1 && aliveone==true &&alivetwo==true )
		return count+3;
	if( count>1 && (aliveone==true || alivetwo==true) )
		return count;

	return 0;
}

int Chess::LeftUpToRightDown_Status(int i, int j, int array[][15])
{
	int tempi,tempj,count;
	bool aliveone=false;
	bool alivetwo=false;
	bool beyond=false;
	int side=array[i][j];
	count=1;
	
	tempi=i;
	tempj=j;
	while( --tempi>=0 && --tempj>=0 && array[tempi][tempj]==side )
		count++;
	if( tempi>=0 && tempj>=0 && array[tempi][tempj]==0 )
		aliveone=true;
	else if( tempi>=0 && tempj>=0 && array[tempi][tempj]==1 )
		beyond=true;

	tempi=i;
	tempj=j;
	while( ++tempi<15 && ++tempj<15 && array[tempi][tempj]==side)
		count++;
	if( tempi<15 && tempj<15 && array[tempi][tempj]==0 )
		alivetwo=true;
	else if( tempi<15 && tempj<15 && array[tempi][tempj]==1 )
		beyond=true;

	if( count>=5 )
		return 8;
	if( count==1 && aliveone==true && alivetwo==true )
		return 0;
	if(  count==1 && beyond==true)
		return 1;
	if( count>1 && aliveone==true && alivetwo==true )
		return count+3;
	if( count>1 && (aliveone==true || alivetwo==true) )
		return count;

	return 0;
}

int Chess::LeftDownToRightUp_Status(int i, int j, int array[][15])
{
	int tempi,tempj,count;
	bool aliveone=false;
	bool alivetwo=false;
	bool beyond=false;
	int side=array[i][j];
	count=1;

	tempi=i;
	tempj=j;
	while( ++tempi<15 && --tempj>=0 && array[tempi][tempj]==side )
		count++;
	if( tempi<15 && tempj>=0 && array[tempi][tempj]==0 )
		aliveone=true;
	else if( tempi<15 && tempj>=0 && array[tempi][tempj]==1 )
		beyond=true;

	tempi=i;
	tempj=j;
	while( --tempi>=0 && ++tempj<15 && array[tempi][tempj]==side )
		count++;
	if( tempi>0 && tempj<14 && array[tempi][tempj]==0 )
		alivetwo=true;
	else if( tempi>=0 && tempj<15 && array[tempi][tempj]==1 )
		beyond=true;

	if( count>=5 )
		return 8;
	if( count==1 &&aliveone==true && alivetwo==true )
		return 0;
	if( count==1 && beyond ==true )
		return 1;
	if( count>1 && aliveone==true && alivetwo==true)
		return count+3;
	if( count>1 && (aliveone==true || alivetwo==true) )
		return count;

	return 0;
}

int Chess::SearchValue(int array[][15], Step &st, bool machine)
{
	int max_score = 0;
	int score = 0;

	GameStatus temp;
	temp.is_machine = machine;
	temp.deep = 0;
	for (int i=0 ; i<15 ;i++)
		for (int jj=0 ; jj<15;jj++)
			temp.fivearray[i][jj] = array[i][jj];
	

	for ( i =0; i <15;i++)
		for(int j=0;j<15;j++)
		{
			if ( array[i][j] == 0)
			{
				temp.st.x = i;
				temp.st.y = j;
				score = 0;
				
				if ( machine)
				{
					temp.fivearray[i][j] = 3;
					temp.st.side = 3;
					temp.is_machine = true; 
					temp.score = 0;
					GetCurrentScore(temp);
					score=temp.score;
				}
				else
				{
					temp.fivearray[i][j] =1;
					temp.st.side =1;
					temp.is_machine =false ;
					temp.score =0;
					GetCurrentScore(temp);
					score=score-temp.score ;
				}
				if ( score==100000 )
				{
					st.x = i;
					st.y = j;
					return  score;
				}
				if ( score>max_score )
				{
					max_score=score;
					st.x=i;
					st.y=j;
				}
				temp.fivearray[i][j] =0;
			}
		}
		return max_score ;
}

	//狀態(tài)
	//返回8 成5:five
	//返回7 活4:alivefour
	//返回6 活3:alivethree
	//返回5 活2:alivetwo
	//返回4 死4:deadfour
	//返回3 死3:deadthree
	//返回2 死2:deadtwo
	//返回0
void Chess::GetCurrentScore(GameStatus &board_situation)
{
	int i=board_situation.st.x;
	int j=board_situation.st.y;
	board_situation.score=0;

	//搜索出左到右的狀態(tài)
	int lr=LeftToRight_Status(i,j,board_situation.fivearray);
	if( lr==8 )
	{
		if( board_situation.is_machine )
			board_situation.score=100000;
		else
			board_situation.score=-100000;
		return;
	}

	//搜索出上到下的狀態(tài)
	int ud=UpToDown_Status(i,j,board_situation.fivearray);
	if( ud==8 )
	{
		if(board_situation.is_machine)
			board_situation.score=100000;
		else
			board_situation.score=-100000;
	return;
	}
	

	//搜索出左上到右下的狀態(tài)
	int lutrd=LeftUpToRightDown_Status(i,j,board_situation.fivearray);
	if( lutrd==8 )
	{
		if( board_situation.is_machine )
			board_situation.score=100000;
		else
			board_situation.score=-100000;
	return;
	}
	

	//搜索從左下到右上
	int ldtru=LeftDownToRightUp_Status(i,j,board_situation.fivearray);
	if( ldtru==8 )
	{
		if( board_situation.is_machine )
			board_situation.score=100000;
		else
			board_situation.score=-100000;
		return;
	}

	//是否活4
	if( lr==7 || ud==7 || lutrd==7 || ldtru==7 )
	{
		if( board_situation.is_machine )
			board_situation.score=10000;
		else
			board_situation.score=-10000;
		return;
	}
	
	//雙死4
	if( 
		( lr==4 && (ud==4 || lutrd==4 || ldtru==4) )
		|| ( ud==4 && ( lutrd==4 || ldtru==4 ) )
		|| ( lutrd==4 && ldtru==4 )
	  )
	{
		if( board_situation.is_machine )
			board_situation.score=10000;
		else
			board_situation.score=-10000;
		return;
	}

	//死4活3
	if(  
		( lr==4 && ( ud==6 || lutrd==6 || ldtru==6 ) )
		||( ud==4 && (lr==6 || lutrd==6 || ldtru==6) )
		||( lutrd==4 && (lr==6 || ud==6 || ldtru==6) )
		||( ldtru==4 && (lr==6 || ud==6 || lutrd==6) )
	  )
	{
		if( board_situation.is_machine )
			board_situation.score=10000;
		else
			board_situation.score=-10000;
		return;
	}

	//雙活3
	if(
		( lr==6 && (ud==6 || lutrd==6 || ldtru==6) )
		|| ( ud==6 && (lutrd==6 || ldtru==6) )
		|| ( lutrd==6 && ldtru==6 )
		)
	{
		if( board_situation.is_machine )
			board_situation.score=5000;
		else
			board_situation.score=-5000;
		return;
	}

	//活3雙活2
	if( 
		( lr==6 || ud==6 || lutrd==6 || ldtru==6 ) &&
			( (lr==5 && (ud==5 || lutrd==5 || ldtru==5)) 
			|| (ud==5 && (lutrd==5 || ldtru==5))
			|| (lutrd==5 && ldtru==5) )
		)
	{
		if( board_situation.is_machine )
			board_situation.score=5000;
		else
			board_situation.score=-5000;
		return;
	}

	//活3死3
	if(
		( lr==3 && (ud==6 || lutrd==6 || ldtru==6) )
		|| ( ud==3 && (lr==6 || lutrd==6 || ldtru==6) )
		|| ( lutrd==3 && (lr==6 || ud==6 || ldtru==6) )
		|| ( ldtru==3 && (lr==6 || ud==6 || lutrd==6) )
		)
	{
		if( board_situation.is_machine )
			board_situation.score=1000;
		else
			board_situation.score=-1000;
		return;
	}

	//死4
	if( lr==4 || ud==4 || lutrd==4 || ldtru==4 )
	{
		if( board_situation.is_machine )
			board_situation.score=500;
		else
			board_situation.score=-500;
		return;
	}

	//單活3
	if( lr==6 || ud==6 || lutrd==6 || ldtru==6 )
	{
		if( board_situation.is_machine )
			board_situation.score=200;
		else
			board_situation.score=-200;
		return;
	}

	//雙活2
	if(
		( lr==5 && (ud==5 || lutrd==5 || ldtru==5) )
		|| (ud==5 && (lutrd==5 || ldtru==5))
		|| (lutrd==5 && ldtru==5)
		)
	{

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩激情视频网站| 欧美国产激情二区三区| 亚洲一区二区三区中文字幕| av色综合久久天堂av综合| 日本一区免费视频| caoporn国产一区二区| 亚洲精品精品亚洲| 欧美主播一区二区三区美女| 午夜久久久久久电影| 日韩欧美一区二区久久婷婷| 国产精品伊人色| 亚洲欧洲美洲综合色网| 欧美私模裸体表演在线观看| 午夜电影一区二区三区| 欧美精品一区在线观看| 丁香六月综合激情| 又紧又大又爽精品一区二区| 欧美片网站yy| 国产福利91精品一区二区三区| 国产精品久久一卡二卡| 在线看不卡av| 美腿丝袜亚洲三区| 亚洲欧洲日韩av| 日韩欧美国产1| 成人激情小说乱人伦| 亚洲福利视频三区| 国产日韩欧美综合一区| 在线观看一区二区视频| 国精产品一区一区三区mba视频| 国产精品毛片无遮挡高清| 欧美美女喷水视频| 国产宾馆实践打屁股91| 香蕉久久夜色精品国产使用方法| 精品对白一区国产伦| 在线视频亚洲一区| 国产高清久久久久| 天堂蜜桃一区二区三区 | 亚洲色欲色欲www在线观看| 欧美亚洲高清一区| 成人小视频免费在线观看| 婷婷丁香久久五月婷婷| 中文字幕一区二区视频| 精品欧美一区二区在线观看| 色婷婷av一区二区三区大白胸 | 丁香一区二区三区| 午夜免费久久看| 亚洲欧美综合网| 欧美本精品男人aⅴ天堂| 一本久久a久久精品亚洲| 国产精品99久| 美女被吸乳得到大胸91| 亚洲二区在线视频| 亚洲女同女同女同女同女同69| 久久综合色之久久综合| 4438x亚洲最大成人网| 92国产精品观看| 成人一级黄色片| 国产永久精品大片wwwapp | 精品成人免费观看| 欧美一级xxx| 欧美精品日韩综合在线| 色哟哟一区二区在线观看| 成人一二三区视频| 福利视频网站一区二区三区| 国产一区二区网址| 激情综合五月天| 免费在线观看一区二区三区| 亚洲bt欧美bt精品777| 亚洲男人电影天堂| 亚洲精品水蜜桃| 亚洲欧美日韩系列| 最新日韩av在线| 一区二区在线观看视频在线观看| 亚洲色图欧洲色图婷婷| 国产精品国产自产拍高清av王其| 日本一区二区三区四区| 国产欧美精品一区二区色综合朱莉 | 国产高清精品在线| 国产美女视频91| 久久精品av麻豆的观看方式| 久久99精品久久久久久国产越南 | 亚洲图片激情小说| 最新久久zyz资源站| 国产精品毛片久久久久久久| 国产精品免费久久久久| 国产精品久久久久四虎| **欧美大码日韩| 一区二区三区精密机械公司| 亚洲综合自拍偷拍| 五月天丁香久久| 日本aⅴ亚洲精品中文乱码| 免费xxxx性欧美18vr| 精品在线播放免费| 国产成人小视频| 99精品热视频| 欧美日韩一本到| 精品久久久久久久人人人人传媒| ww亚洲ww在线观看国产| 国产精品美女久久久久久2018 | 成人在线视频一区二区| 一本到不卡精品视频在线观看| 在线日韩国产精品| 日韩欧美一二三区| 国产欧美一区二区在线| 亚洲男同性视频| 偷窥少妇高潮呻吟av久久免费| 久久精品久久精品| 国产福利一区在线| 欧美性生活影院| 亚洲激情第一区| 蜜臀av一区二区在线免费观看| 国产一区二区在线看| 91色porny在线视频| 日一区二区三区| 国产精品 日产精品 欧美精品| 成人av先锋影音| 欧美日韩久久久一区| 欧美精品一区二区三区视频| 国产精品免费观看视频| 欧美日韩高清一区二区不卡| 91精品国产综合久久久蜜臀图片 | 亚洲精品国产a| 99久久久精品| 中文一区二区在线观看| 国产乱色国产精品免费视频| 日韩午夜精品电影| 天堂成人免费av电影一区| 欧美视频你懂的| 亚洲女爱视频在线| 色综合久久综合| 自拍视频在线观看一区二区| 成人18视频在线播放| 中文字幕欧美区| 国产成人aaaa| 中文字幕第一页久久| 国产精品一二三四五| 亚洲精品一区二区精华| 国产一区二区三区最好精华液| 精品日韩99亚洲| 狠狠色2019综合网| 欧美精品一区在线观看| 国产99久久久国产精品免费看 | 91免费看`日韩一区二区| 中文字幕乱码日本亚洲一区二区 | 精品女同一区二区| 久久国产精品色婷婷| 精品少妇一区二区三区在线播放| 青青草原综合久久大伊人精品| 4438成人网| 国内外成人在线| 久久蜜桃av一区精品变态类天堂| 国产一区二区网址| 国产精品欧美一区喷水| 91麻豆国产在线观看| 亚洲大片在线观看| 91精品欧美久久久久久动漫| 日本不卡视频在线| 2021中文字幕一区亚洲| 国产成人av一区二区三区在线| 国产精品久久久久久一区二区三区 | 免费成人美女在线观看.| 精品国产一区久久| 丁香天五香天堂综合| 最新久久zyz资源站| 欧美性生交片4| 另类小说色综合网站| 欧美经典三级视频一区二区三区| av在线不卡免费看| 亚洲国产精品一区二区久久| 日韩精品中文字幕在线一区| 国产九色sp调教91| 亚洲日本青草视频在线怡红院| 欧美亚洲愉拍一区二区| 免费成人美女在线观看| 国产精品私人影院| 欧美日韩精品欧美日韩精品一 | 日本欧洲一区二区| 久久久国产精品麻豆| 色乱码一区二区三区88| 蜜臀av性久久久久蜜臀av麻豆| 国产欧美一区二区三区鸳鸯浴 | 欧美一区二区成人6969| 国产成人鲁色资源国产91色综| 亚洲精品国产精品乱码不99| 3atv在线一区二区三区| 成人小视频在线观看| 丝袜诱惑亚洲看片| 中文字幕av一区 二区| 欧美日韩成人一区| 国产+成+人+亚洲欧洲自线| 香蕉影视欧美成人| 亚洲天堂福利av| 精品国产污网站| 欧美性做爰猛烈叫床潮| 成人免费高清在线| 免费在线看一区| 亚洲一区二区三区四区五区黄| 国产亚洲欧美色| 欧美日韩高清一区二区不卡| 成人免费视频视频|