Alpha-Beta搜索算法

int CBoard::AlphaBetaSearch(int depth, int alpha, int beta){
	int value;
	STRUCT_MOVEMENT MoveArray[128];
	STRUCT_MOVEMENT mv;
	int i;

	if(depth ==0)
		return Eval();

	int num = GenAllMove(MoveArray);
	for(i = 0 ; i<num; i++){
		mv = MoveArray[i];
		MakeMove(mv);
		value = -AlphaBetaSearch(depth -1, -beta, -alpha);
		UnMakeMove();
		if(value >= beta)
			return beta;
		if(value > alpha){
			alpha = value;
			if(depth == MaxDepth)
				BestMove = mv;
		}
	}
	return alpha;
}