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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? search.c

?? microwindows-0.90
?? C
字號:
/*
 *	SEARCH.C
 *	Tom Kerrigan's Simple Chess Program (TSCP)
 *
 *	Copyright 1997 Tom Kerrigan
 */


#include <stdio.h>
#include <string.h>
#include "defs.h"
#include "data.h"
#include "protos.h"


/* see the beginning of think() */
#include <setjmp.h>
jmp_buf env;
BOOL stop_search;


/* think() calls search() iteratively. Search statistics
   are printed depending on the value of output:
   0 = no output
   1 = normal output
   2 = xboard format output */

void think(int output)
{
	int i, j, x;

	/* some code that lets us longjmp back here and return
	   from think() when our time is up */
	stop_search = FALSE;
	setjmp(env);
	if (stop_search) {
		
		/* make sure to take back the line we were searching */
		while (ply)
			takeback();
		return;
	}

	start_time = get_ms();
	stop_time = start_time + max_time;

	ply = 0;
	nodes = 0;
	memset(pv, 0, sizeof(pv));
	memset(history, 0, sizeof(history));
	if (output == 1)
		printf("ply      nodes  score  pv\n");
	for (i = 1; i <= max_depth; ++i) {
		follow_pv = TRUE;
		x = search(-10000, 10000, i);
		if (output == 1)
			printf("%3d  %9d  %5d ", i, nodes, x);
		else if (output == 2)
			printf("%d %d %d %d",
					i, x, (get_ms() - start_time) / 10, nodes);
		if (output) {
			for (j = 0; j < pv_length[0]; ++j)
				printf(" %s", move_str(pv[0][j].b));
			printf("\n");
			fflush(stdout);
		}
		if (x > 9000 || x < -9000)
			break;
	}
}


/* search() does just that, in negamax fashion */

int search(int alpha, int beta, int depth)
{
	int i, j, x;
	BOOL c, f;

	/* we're as deep as we want to be; call quiesce() to get
	   a reasonable score and return it. */
	if (!depth)
		return quiesce(alpha,beta);
	++nodes;

	/* do some housekeeping every 1024 nodes */
	if ((nodes & 1023) == 0)
		checkup();

	pv_length[ply] = ply;

	/* if this isn't the root of the search tree (where we have
	   to pick a move and can't simply return 0) then check to
	   see if the position is a repeat. if so, we can assume that
	   this line is a draw and return 0. */
	if (ply && reps())
		return 0;

	/* are we too deep? */
	if (ply >= MAX_PLY - 1)
		return eval();
	if (hply >= HIST_STACK - 1)
		return eval();

	/* are we in check? if so, we want to search deeper */
	c = in_check(side);
	if (c)
		++depth;
	gen();
	if (follow_pv)  /* are we following the PV? */
		sort_pv();
	f = FALSE;

	/* loop through the moves */
	for (i = first_move[ply]; i < first_move[ply + 1]; ++i) {
		sort(i);
		if (!makemove(gen_dat[i].m.b))
			continue;
		f = TRUE;
		x = -search(-beta, -alpha, depth - 1);
		takeback();
		if (x > alpha) {

			/* this move caused a cutoff, so increase the history
			   value so it gets ordered high next time we can
			   search it */
			history[(int)gen_dat[i].m.b.from][(int)gen_dat[i].m.b.to] += depth;
			if (x >= beta)
				return beta;
			alpha = x;

			/* update the PV */
			pv[ply][ply] = gen_dat[i].m;
			for (j = ply + 1; j < pv_length[ply + 1]; ++j)
				pv[ply][j] = pv[ply + 1][j];
			pv_length[ply] = pv_length[ply + 1];
		}
	}

	/* no legal moves? then we're in checkmate or stalemate */
	if (!f) {
		if (c)
			return -10000 + ply;
		else
			return 0;
	}

	/* fifty move draw rule */
	if (fifty >= 100)
		return 0;
	return alpha;
}


/* quiesce() is a recursive minimax search function with
   alpha-beta cutoffs. In other words, negamax. It basically
   only searches capture sequences and allows the evaluation
   function to cut the search off (and set alpha). The idea
   is to find a position where there isn't a lot going on
   so the static evaluation function will work. */

int quiesce(int alpha,int beta)
{
	int i, j, x;

	++nodes;

	/* do some housekeeping every 1024 nodes */
	if ((nodes & 1023) == 0)
		checkup();

	pv_length[ply] = ply;

	/* are we too deep? */
	if (ply >= MAX_PLY - 1)
		return eval();
	if (hply >= HIST_STACK - 1)
		return eval();

	/* check with the evaluation function */
	x = eval();
	if (x >= beta)
		return beta;
	if (x > alpha)
		alpha = x;

	gen_caps();
	if (follow_pv)  /* are we following the PV? */
		sort_pv();

	/* loop through the moves */
	for (i = first_move[ply]; i < first_move[ply + 1]; ++i) {
		sort(i);
		if (!makemove(gen_dat[i].m.b))
			continue;
		x = -quiesce(-beta, -alpha);
		takeback();
		if (x > alpha) {
			if (x >= beta)
				return beta;
			alpha = x;

			/* update the PV */
			pv[ply][ply] = gen_dat[i].m;
			for (j = ply + 1; j < pv_length[ply + 1]; ++j)
				pv[ply][j] = pv[ply + 1][j];
			pv_length[ply] = pv_length[ply + 1];
		}
	}
	return alpha;
}


/* reps() returns the number of times that the current
   position has been repeated. Thanks to John Stanback
   for this clever algorithm. */

int reps()
{
	int i;
	int b[64];
	int c = 0;  /* count of squares that are different from
				   the current position */
	int r = 0;  /* number of repetitions */

	/* is a repetition impossible? */
	if (fifty <= 3)
		return 0;

	memset(b, 0, sizeof(b));

	/* loop through the reversible moves */
	for (i = hply - 1; i >= hply - fifty - 1; --i) {
		if (++b[(int)hist_dat[i].m.b.from] == 0)
			--c;
		else
			++c;
		if (--b[(int)hist_dat[i].m.b.to] == 0)
			--c;
		else
			++c;
		if (c == 0)
			++r;
	}

	return r;
}


/* sort_pv() is called when the search function is following
   the PV (Principal Variation). It looks through the current
   ply's move list to see if the PV move is there. If so,
   it adds 10,000,000 to the move's score so it's played first
   by the search function. If not, follow_pv remains FALSE and
   search() stops calling sort_pv(). */

void sort_pv()
{
	int i;

	follow_pv = FALSE;
	for(i = first_move[ply]; i < first_move[ply + 1]; ++i)
		if (gen_dat[i].m.u == pv[0][ply].u) {
			follow_pv = TRUE;
			gen_dat[i].score += 10000000;
			return;
		}
}


/* sort() searches the current ply's move list from 'from'
   to the end to find the move with the highest score. Then it
   swaps that move and the 'from' move so the move with the
   highest score gets searched next, and hopefully produces
   a cutoff. */

void sort(int from)
{
	int i;
	int bs;  /* best score */
	int bi;  /* best i */
	gen_t g;

	bs = -1;
	bi = from;
	for (i = from; i < first_move[ply + 1]; ++i)
		if (gen_dat[i].score > bs) {
			bs = gen_dat[i].score;
			bi = i;
		}
	g = gen_dat[from];
	gen_dat[from] = gen_dat[bi];
	gen_dat[bi] = g;
}


/* checkup() is called once in a while during the search. */

void checkup()
{
	/* is the engine's time up? if so, longjmp back to the
	   beginning of think() */
	if (get_ms() >= stop_time) {
		stop_search = TRUE;
		longjmp(env, 0);
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久不卡网国产精品二区| 日本道免费精品一区二区三区| 在线观看欧美精品| 久久精品综合网| 国产精品99久久不卡二区| 2020国产精品自拍| 国产不卡视频在线播放| 国产精品国产三级国产专播品爱网| 成人免费观看av| 亚洲免费在线观看视频| 欧美性猛片xxxx免费看久爱| 午夜精品成人在线| 日韩一区二区三区免费观看| 久久99热国产| 国产视频一区二区在线观看| 色综合久久综合中文综合网| 亚洲国产sm捆绑调教视频| 91麻豆精品国产91久久久久久| 久久99这里只有精品| 国产偷v国产偷v亚洲高清| a美女胸又www黄视频久久| 亚洲国产一区二区三区| 精品国产三级a在线观看| 成人免费不卡视频| 午夜精品123| 久久久www成人免费无遮挡大片| 91色九色蝌蚪| 久久精品久久精品| 亚洲美女免费在线| 精品国产成人在线影院| 色综合天天天天做夜夜夜夜做| 天天综合日日夜夜精品| 精品sm捆绑视频| 一本一道综合狠狠老| 日韩精品免费专区| 国产精品国产成人国产三级| 欧美日韩和欧美的一区二区| 国产真实乱子伦精品视频| 亚洲免费电影在线| 久久精品欧美日韩精品| 欧美精品久久久久久久久老牛影院| 极品少妇xxxx精品少妇偷拍| 亚洲三级免费观看| 国产婷婷精品av在线| 91.xcao| 97se亚洲国产综合自在线不卡| 久久精品国产一区二区三区免费看| 国产精品九色蝌蚪自拍| 日韩精品一区二区三区视频| 欧美日韩一级二级| 播五月开心婷婷综合| 久久成人免费电影| 日韩av不卡在线观看| 亚洲伦在线观看| 亚洲国产精品成人综合| 日韩午夜激情电影| 欧美日韩精品一区二区| 色综合久久久网| 成人黄色av电影| 国产精品自拍一区| 免费的成人av| 天堂av在线一区| 亚洲www啪成人一区二区麻豆| 亚洲视频在线一区观看| 国产欧美一区二区精品忘忧草 | 不卡高清视频专区| 黄色精品一二区| 蜜臀av性久久久久av蜜臀妖精| 一区二区三区四区蜜桃| 亚洲视频免费在线| 亚洲欧美韩国综合色| 亚洲欧美中日韩| 中文字幕视频一区二区三区久| 国产欧美日韩精品a在线观看| 精品久久久久久亚洲综合网 | 国产999精品久久久久久| 久久99精品久久久久久国产越南 | 国产精品毛片无遮挡高清| 久久嫩草精品久久久久| 欧美精品一区二区高清在线观看| 日韩三级视频中文字幕| 日韩女优电影在线观看| 精品少妇一区二区三区日产乱码 | 国产一区二区三区免费观看| 狠狠色综合色综合网络| 久久99国产精品尤物| 精品在线亚洲视频| 狠狠狠色丁香婷婷综合久久五月| 精品一区二区三区免费| 国产麻豆视频精品| 成人综合婷婷国产精品久久| 国产福利一区二区三区| 成人看片黄a免费看在线| 99精品国产99久久久久久白柏 | 国产成人啪免费观看软件| 国产91精品久久久久久久网曝门| 成人免费高清在线观看| 色94色欧美sute亚洲线路一ni | 成人黄色小视频在线观看| 99综合电影在线视频| 色激情天天射综合网| 欧美猛男超大videosgay| 日韩欧美亚洲一区二区| 久久久午夜电影| 亚洲色图视频免费播放| 亚洲a一区二区| 国内成人精品2018免费看| 成人精品高清在线| av动漫一区二区| 日本欧美在线观看| 日韩一区二区在线看片| 免费精品视频最新在线| 国产一区二区在线免费观看| 成人av电影在线观看| 欧美性videosxxxxx| 欧美一区二区三区日韩| 国产视频一区在线播放| 一区二区三区美女视频| 国内不卡的二区三区中文字幕 | 欧美日韩另类一区| 欧美一区二区三区在线电影| 久久久久久亚洲综合影院红桃| 亚洲色图在线看| 国产一区视频导航| 色哟哟一区二区三区| 精品剧情v国产在线观看在线| 亚洲美腿欧美偷拍| 国内精品国产成人国产三级粉色 | 国产一区二区免费视频| 91麻豆成人久久精品二区三区| 一区二区免费在线| 欧美午夜精品久久久久久超碰 | 日本精品裸体写真集在线观看| 国产欧美精品国产国产专区| 亚洲国产裸拍裸体视频在线观看乱了 | 中文子幕无线码一区tr| 国产69精品久久久久777| 日本视频中文字幕一区二区三区| 一色屋精品亚洲香蕉网站| 欧美成人午夜电影| 日韩精品影音先锋| 91精品国产综合久久久久| 一本高清dvd不卡在线观看| 风间由美一区二区三区在线观看 | 蜜臀久久久久久久| 欧美性猛片aaaaaaa做受| 三级影片在线观看欧美日韩一区二区 | 婷婷成人激情在线网| 色综合久久久久久久久久久| 卡一卡二国产精品 | 欧美色区777第一页| 日韩精品免费视频人成| 国产精品久久久久久一区二区三区 | 99re热视频精品| 1024亚洲合集| 风间由美中文字幕在线看视频国产欧美 | 91精品国产91热久久久做人人 | 亚洲激情一二三区| 91老师片黄在线观看| 亚洲曰韩产成在线| 久久欧美中文字幕| 91丨九色丨黑人外教| 国产精品网友自拍| 成人黄色小视频在线观看| 亚洲精品欧美激情| 91麻豆精品国产| 91色.com| 成人爽a毛片一区二区免费| 国产999精品久久久久久绿帽| 国产一区在线不卡| 成人精品视频一区二区三区尤物| 91美女视频网站| 日韩欧美国产综合一区| 国产女人18毛片水真多成人如厕| 中文字幕一区三区| 精品一区二区久久久| 91麻豆精东视频| 欧美激情一区二区三区四区| 亚洲综合图片区| 国产精品每日更新在线播放网址| 日韩美女主播在线视频一区二区三区| 欧美一区二区三区视频免费播放| 制服丝袜亚洲网站| 欧美在线不卡视频| 欧美日韩国产精选| 欧美成人三级在线| 一区在线播放视频| 亚洲一区视频在线| 久久91精品国产91久久小草| 亚洲精品少妇30p| 一区二区三区精品视频在线| 亚洲三级理论片| 亚洲在线中文字幕| 91官网在线观看| 99视频精品免费视频| 国产盗摄女厕一区二区三区| 免费观看30秒视频久久| 蜜桃一区二区三区在线观看| 99久久免费精品| 成人av网在线|