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

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

?? search.c

?? microwindow 源代碼,嵌入式linux 的圖形系統
?? 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一区二区三区免费野_久草精品视频
欧美日韩亚洲综合在线| 久久久欧美精品sm网站| 欧美体内she精视频| 91视频观看免费| 一本久久a久久精品亚洲| 91丨porny丨国产| 欧美在线短视频| 欧美区一区二区三区| 欧美日韩国产天堂| 7777精品伊人久久久大香线蕉经典版下载 | 日本不卡不码高清免费观看| 偷拍一区二区三区| 美女久久久精品| 国产一区二区91| 成人一级片在线观看| 99re热视频这里只精品| 一本一道综合狠狠老| 欧美日韩国产综合草草| 91精品国产全国免费观看| 日韩欧美国产1| 久久久精品黄色| 欧美国产精品一区二区三区| 自拍偷在线精品自拍偷无码专区| 亚洲免费观看高清完整版在线观看| 一区二区三区不卡在线观看| 午夜精品福利一区二区三区av| 麻豆成人在线观看| 国产传媒久久文化传媒| 色国产精品一区在线观看| 欧美日韩在线不卡| 26uuu久久综合| 亚洲精品欧美激情| 日韩精品欧美精品| 高清成人在线观看| 在线观看亚洲a| 欧美电影免费观看完整版| 欧美韩日一区二区三区四区| 亚洲精品成人悠悠色影视| 日韩精品电影在线观看| 国产成+人+日韩+欧美+亚洲| 91福利精品第一导航| 精品国一区二区三区| 亚洲色图第一区| 久久电影网站中文字幕| 99精品欧美一区二区三区小说 | 91欧美激情一区二区三区成人| 欧美综合视频在线观看| 精品国精品国产| ...中文天堂在线一区| 日韩中文字幕麻豆| 暴力调教一区二区三区| 日韩亚洲欧美高清| 国产成人精品1024| 欧美喷潮久久久xxxxx| 久久精品在线免费观看| 偷窥国产亚洲免费视频| 成人午夜免费av| 欧美一级一级性生活免费录像| 国产精品久久精品日日| 青娱乐精品在线视频| 色综合久久中文字幕| 久久这里只有精品视频网| 亚洲尤物在线视频观看| 国产乱码字幕精品高清av | 91精品国产91久久久久久最新毛片 | 日韩免费一区二区三区在线播放| 中文字幕亚洲在| 国内欧美视频一区二区| 欧美日韩电影一区| 国产精品成人免费| 国产精品夜夜嗨| 欧美一区二区成人6969| 亚洲国产日日夜夜| www.日本不卡| 国产女人18毛片水真多成人如厕| 免费观看久久久4p| 欧美精品日韩精品| 亚洲一区在线观看网站| 91色porny蝌蚪| 国产精品久久久久久久浪潮网站 | 久久99精品久久久| 欧美蜜桃一区二区三区| 亚洲女同一区二区| 成人av资源在线观看| 久久久噜噜噜久噜久久综合| 免费在线看一区| 欧美日韩午夜在线视频| 亚洲精品伦理在线| 91美女蜜桃在线| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 国产剧情在线观看一区二区| 日韩精品一区在线| 美国十次了思思久久精品导航| 欧美日韩电影在线| 日韩激情视频在线观看| 精品视频色一区| 亚洲高清不卡在线| 717成人午夜免费福利电影| 亚洲午夜视频在线观看| 91久久免费观看| 一区二区三区在线影院| 色综合色狠狠综合色| 亚洲久本草在线中文字幕| 一本一本大道香蕉久在线精品| 亚洲色图一区二区| 91国偷自产一区二区开放时间 | 亚洲自拍偷拍麻豆| 欧美日韩一区二区欧美激情| 性感美女久久精品| 欧美日韩免费高清一区色橹橹| 亚洲国产视频一区二区| 欧美日韩的一区二区| 蜜桃av一区二区| 久久久久久久久岛国免费| 国产 日韩 欧美大片| 国产精品不卡在线观看| 色八戒一区二区三区| 亚洲第一成人在线| 日韩一区二区三区四区| 国产一区二区三区久久久| 中文在线资源观看网站视频免费不卡| 99久久伊人久久99| 亚洲成a人片综合在线| 91精品国产色综合久久| 韩国女主播成人在线观看| 欧美极品少妇xxxxⅹ高跟鞋| 成人app下载| 亚洲五码中文字幕| 日韩欧美一区在线| 福利视频网站一区二区三区| 亚洲三级理论片| 欧美一区二区私人影院日本| 韩国欧美国产1区| **欧美大码日韩| 欧美日韩不卡在线| 国产老肥熟一区二区三区| 亚洲日本成人在线观看| 在线电影一区二区三区| 国产精品中文字幕日韩精品| 亚洲精品久久久久久国产精华液| 欧美精品xxxxbbbb| 国产成人精品网址| 亚洲国产一区视频| 久久精品视频免费| 欧美视频日韩视频在线观看| 国内外成人在线| 一二三区精品福利视频| 欧美成人免费网站| 91亚洲精华国产精华精华液| 日韩精品一级中文字幕精品视频免费观看 | 久久只精品国产| 在线亚洲欧美专区二区| 国产一区二区三区在线看麻豆| 亚洲三级电影网站| 精品日韩av一区二区| 91丨九色丨国产丨porny| 久久精品国产免费看久久精品| 亚洲少妇屁股交4| 久久人人97超碰com| 欧美久久一二区| proumb性欧美在线观看| 久久99精品一区二区三区| 亚洲资源中文字幕| 欧美国产欧美综合| 日韩精品一区二区三区三区免费| 91视频免费播放| 精品福利一区二区三区免费视频| 成人动漫一区二区| 久久99久国产精品黄毛片色诱| 亚洲精品视频观看| 国产欧美精品一区| 91麻豆精品国产91久久久久久| www.久久精品| 国产精华液一区二区三区| 日韩中文字幕区一区有砖一区 | 亚洲福利视频导航| 国产精品久久综合| 久久精品日产第一区二区三区高清版 | 91麻豆精品在线观看| 国产91精品精华液一区二区三区 | 最新国产成人在线观看| 久久欧美中文字幕| 日韩丝袜情趣美女图片| 欧美图区在线视频| 色婷婷综合久久久中文一区二区| 国产成人免费网站| 韩国一区二区三区| 男人操女人的视频在线观看欧美| 亚洲激情av在线| 成人免费小视频| 亚洲国产精品ⅴa在线观看| 精品国产第一区二区三区观看体验| 欧美日韩日本视频| 91精彩视频在线观看| 91美女蜜桃在线| 91丨九色丨蝌蚪富婆spa| 99国产精品一区| 99视频精品全部免费在线| av在线一区二区| av色综合久久天堂av综合|