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

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

?? search.c

?? 優秀的嵌入式linux系統GUI-Microwindow-0.89;可以用來開發嵌入式GUI
?? 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一区二区三区免费野_久草精品视频
日韩高清不卡在线| 日韩理论在线观看| 看电影不卡的网站| 日韩欧美不卡在线观看视频| 日韩成人精品视频| 精品国产一二三| 丰满放荡岳乱妇91ww| 国产精品毛片久久久久久久| 岛国av在线一区| 亚洲一区在线视频| 日韩一级片网址| 国产高清不卡一区二区| 18成人在线观看| 欧美日韩国产综合一区二区三区| 日本不卡123| 国产欧美一区二区三区网站| www.爱久久.com| 亚洲超碰97人人做人人爱| 精品国产伦一区二区三区观看体验| 国产**成人网毛片九色 | 精品日韩一区二区三区| 国产乱人伦精品一区二区在线观看| 国产欧美一二三区| 色妹子一区二区| 久久国产精品99久久人人澡| 国产精品女同一区二区三区| 欧美日本不卡视频| 国产福利精品导航| 亚洲国产日韩av| 久久久欧美精品sm网站| 欧美视频中文一区二区三区在线观看| 日韩av一级电影| 国产精品久久久久久久久晋中| 欧美日韩中文另类| 国产aⅴ精品一区二区三区色成熟| 亚洲精品videosex极品| 精品99一区二区| 欧美色图天堂网| 国产1区2区3区精品美女| 日一区二区三区| 国产精品久久精品日日| 日韩女优制服丝袜电影| 色哟哟欧美精品| 国产999精品久久| 日本不卡一区二区三区高清视频| 亚洲色大成网站www久久九九| 精品日韩成人av| 欧美午夜精品一区| 91免费看片在线观看| 国产乱码精品一区二区三区忘忧草 | 综合激情成人伊人| 欧美精品一区二区在线播放| 欧美日韩一区中文字幕| jvid福利写真一区二区三区| 狠狠色伊人亚洲综合成人| 亚洲18影院在线观看| 日韩理论片一区二区| 国产午夜一区二区三区| 日韩精品一区二区三区四区视频| 在线免费观看不卡av| voyeur盗摄精品| 国产乱妇无码大片在线观看| 视频精品一区二区| 亚洲国产精品一区二区久久 | 欧美一级夜夜爽| 欧美日韩国产综合视频在线观看 | 色婷婷久久久久swag精品| 国产99久久久国产精品潘金网站| 久久se这里有精品| 亚洲成av人综合在线观看| 亚洲最新视频在线观看| 曰韩精品一区二区| 亚洲精品欧美二区三区中文字幕| 久久久久久久精| 国产日本欧洲亚洲| 中文字幕欧美激情| 国产精品丝袜91| 中文字幕一区在线| 亚洲色图在线视频| 一区二区三区四区亚洲| 亚洲综合色婷婷| 亚洲欧美日韩成人高清在线一区| 亚洲视频中文字幕| 亚洲人成网站影音先锋播放| 一区二区三区在线视频播放| 一区二区三区四区乱视频| 亚洲最色的网站| 日韩电影在线观看一区| 久久99久久久久| 国产成人精品网址| 99久久久久免费精品国产 | 欧美tickling挠脚心丨vk| 日韩精品自拍偷拍| 日本一区二区三区国色天香| 国产精品传媒入口麻豆| 一区二区视频在线| 日日摸夜夜添夜夜添亚洲女人| 日本中文在线一区| 国产福利精品一区二区| a4yy欧美一区二区三区| 91国偷自产一区二区开放时间| 欧美日韩高清一区二区三区| 欧美不卡一区二区三区| 国产日韩三级在线| 亚洲乱码国产乱码精品精的特点| 亚洲午夜电影在线观看| 免费三级欧美电影| 国产精品一区二区x88av| 97精品视频在线观看自产线路二| 欧美手机在线视频| 久久蜜桃一区二区| 亚洲黄色片在线观看| 伦理电影国产精品| 色综合天天综合网天天看片| 欧美肥妇bbw| 国产女主播视频一区二区| 一区二区三区免费| 韩日av一区二区| 欧洲一区二区三区在线| 欧美精品一区视频| 亚洲国产精品一区二区www在线| 麻豆91在线看| 在线日韩av片| 国产三级精品在线| 日本中文字幕一区二区有限公司| 不卡av免费在线观看| 日韩一区二区三区高清免费看看| 中文字幕中文乱码欧美一区二区 | 国产视频一区二区三区在线观看| 亚洲小少妇裸体bbw| 成人性视频网站| 欧美一卡二卡在线| 亚洲一区在线播放| 成人免费毛片嘿嘿连载视频| 日韩欧美在线1卡| 亚洲综合色噜噜狠狠| 国产91露脸合集magnet| 日韩天堂在线观看| 亚洲一区二区三区在线看| 国产成a人亚洲精| 日韩女优av电影| 亚洲国产另类av| 色婷婷一区二区| 中文字幕一区在线观看| 国产精品一区二区三区乱码| 欧美一区二区免费视频| 亚洲一区二区成人在线观看| 成人国产精品免费| 日本一区二区三区四区| 国产乱子轮精品视频| 制服丝袜亚洲色图| 亚洲国产日韩精品| 91久久人澡人人添人人爽欧美| 日本一区二区久久| 国产精品99久久不卡二区| 精品国产亚洲在线| 美女精品一区二区| 日韩三级视频中文字幕| 视频一区欧美日韩| 欧美精品欧美精品系列| 亚洲一区二区三区四区的| 在线观看一区二区精品视频| 亚洲免费观看高清完整版在线| a美女胸又www黄视频久久| 中文字幕精品综合| 丁香啪啪综合成人亚洲小说| 欧美激情综合五月色丁香| 国产不卡一区视频| 国产精品三级电影| av欧美精品.com| 亚洲欧美视频一区| 91国内精品野花午夜精品| 亚洲国产三级在线| 在线播放91灌醉迷j高跟美女| 亚洲国产精品久久不卡毛片| 欧美日韩一级二级| 亚洲成人黄色小说| 91精品国产91热久久久做人人| 免费在线观看视频一区| 亚洲精品一区二区三区蜜桃下载| 国产精品一线二线三线| 国产精品丝袜一区| 色乱码一区二区三区88| 性久久久久久久久久久久| 欧美一二三区在线观看| 精品在线观看免费| 国产精品伦一区二区三级视频| 91丨九色丨国产丨porny| 亚洲成年人影院| 精品免费日韩av| 成a人片国产精品| 亚洲在线视频网站| 精品免费日韩av| av亚洲精华国产精华精华| 亚洲一区影音先锋| 精品国精品自拍自在线| 成人av网在线| 日韩精品久久久久久| 欧美激情一区二区三区不卡| 色婷婷国产精品|