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

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

?? ics 180, april 24, 1997.htm

?? 這是博弈論算法全集第二部分:輔助搜索,其它算法將陸續推出.以便與大家共享
?? HTM
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0049)http://www.ics.uci.edu/~eppstein/180a/970424.html -->
<HTML><HEAD><TITLE>ICS 180, April 24, 1997</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META name=Owner value="eppstein">
<META name=Reply-To value="eppstein@ics.uci.edu">
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY><IMG alt="" height=72 src="ICS 180, April 24, 1997.files/icslogo2.gif" 
width=472>
<P><A href="http://www.ics.uci.edu/~eppstein/180a/index.html">
<H1>ICS 180A, Spring 1997:<BR>Strategy and board game programming</H1></A>
<H2>Lecture notes for April 24, 1997<BR>Hashing and Move Ordering</H2>
<P>I didn't really finish describing alpha-beta -- my pseudocode included a 
mysterious "sort list of moves" step that I didn't explain. I'll continue to 
leave that dangling while I talk about hashing; we'll connect it up in a little 
while. 
<P>The idea of hashing is very simple. Many games allow <I>transpositions</I> of 
moves, meaning different sequences of moves that end up leading to the same 
position. For instance, in chess, the opening moves 1. d4 Nf6 2. c4 and 1. c4 
Nf6 2. d4 both give the same position (known as an Indian defense). White's two 
pawn moves could be made in either order without changing the result. As an 
example of a more complicated transposition, the moves 1. e4 c6 2. d4 d5 3. ed 
Qxd5 4. Nc3 Qd6 (Caro-Kann defense), 1. e4 d5 2. ed Qxd5 3. Nc3 Qd6 4. d4 c6 
(Scandinavian opening), and 1. e4 Nf6 2. e5 Ng8 3. d4 d6 4. ed Qxd6 5. Nc3 c6 
(Alekhine defense) all lead to the same position, after different numbers of 
moves. 
<P>Because of transpositions, the same positions can show up many places in the 
alpha-beta search tree. If we store a data structure that remembers what the 
results of searching each position were, we can look it up rather than searching 
it again. But...we don't have enough memory to store all the positions we 
search. And, lookups must be very fast to make it save time over just searching. 
Fortunately, we have one advantage: it's ok if we sometimes don't find the 
results from a position we already searched, and search the same position again, 
as long as it doesn't happen too often. 
<P>The answer: hash tables. Make a big array: as large as possible without 
blowing out your physical memory (you don't want to eat into virtual memory, it 
will be slow.) <PRE>struct {
    long checksum;	// or long long might be even better
    int depth;
    enum { exact, lower_bound, upper_bound } entry_type;
    double eval;
} hashtable[HASH_TABLE_SIZE];
</PRE>For each position you search, compute a "hash value" x indexing into the 
hash table and another "hash value" y for checking whether you've found the 
right position. 
<P>Before searching a position, lookup hashtable[x]. If hashtable[x].checksum == 
y, hashtable.entry_type == exact, and hashtable[x].depth is at least the depth 
you are currently searching, return the eval stored there. 
<P>After searching the position, store y, the current depth, and the eval you 
just computed, into hashtable[x]. 
<H3>How to compute hash values?</H3>Zobrist hashing technique (already mentioned 
before re repetition detection): Before playing the game (maybe hardcode this in 
your source code) make an array Z[square,piecetype] of random numbers. 
Hash(board) is then just sum(Z[s,p]) summed over the pieces currently on the 
board combined with any extra information you might have such as castling 
ability. Often the sum is replaced by a bitwise exclusive or (uparrow in C) 
which is a little faster and easier to work with, but arithmetic addition would 
probably work just as well. When you move to a new position, you don't have to 
recompute the hash from scratch; instead you can update the hash really quickly 
by subtracting the old piece square value from where the moved piece was and and 
adding the new value for its new location. Use this technique (with different 
random numbers) both for the hash value x and for the checksum y. 
<P>Some further tips for using hashing effectively: 
<UL>
  <LI>Don't clean out the array after making a move, it only wastes time and 
  some hashed positions might actually still be useful after the move. 
  <LI>If the same position occurs at different levels in the tree (as in the 
  second transposition example we listed above) this can actually give you 
  deeper searches than you originally asked for; that's ok. 
  <LI>Don't hash the positions very near the leaves of the search tree, there 
  are too many of them (they'll take away hash table space from more valuable 
  positions) and you're not saving much time by avoiding searching them. 
</LI></UL>
<H3>How does hashing interact with alpha-beta?</H3>
<P>A large fraction of chess program bugs are related to hashing. Partly, 
because it interacts in confusing ways with alpha-beta search. But, you can't 
avoid dealing with the issue, because you need both hashing and alpha-beta to 
have an efficient searcher. Recall that, when we call 
alphabeta(depth,alpha,beta) on a position, one of three things can happen: a 
fail high, in which we know the eval is at least beta but not exactly what it 
is; a fail low, in which we know the eval is at most alpha but not exactly what 
it is; and an exact result, alpha&nbsp;&lt;&nbsp;eva&nbsp;&lt;&nbsp;beta. We can 
only store an exact result in the hash table if we know the exact result. But a 
fail high or fail low result could still help us prune later. So, along with 
exact evals, store two other kinds of eval in hash table: a lower bound stating 
that the eval is at least beta, and an upper bound stating that the eval is at 
most alpha. We use the entry_type field of the hash table entry to specify what 
kind of eval is being stored. If the hash lookup comes back with one of these, 
we need to see whether it's useful enough to prune immediately without searching 
the node. If so, we return it, and otherwise search the node again. Here's some 
pseudocode for alpha-beta search with hashing. We maintain the hashtable index x 
and checksum y in global variables, that are updated as part of the process of 
making and unmaking moves. <PRE>double alphabeta(int depth, double alpha, double beta)
{
    if (depth &lt;= 0 || game is over) return evaluation();
    if (hashtable[x].checksum == y &amp;&amp; hashtable[x].depth &gt;= depth)
        switch (hashtable[x].entry_type) {
            case exact: return hashtable[x].eval;
            case lower_bound:
                if (hashtable[x].eval &gt;= beta)
                    return (hashtable[x].eval);
                else break;
            case upper_bound:
                if (hashtable[x].eval &lt;= alpha)
                    return (hashtable[x].eval);
                else break;
        }

    int eval_is_exact = 0;
    generate and sort list of moves available in the position
    for (each move m) {
        make move m;
        double val = -alphabeta(depth - 1, -beta, -alpha);
        unmake move m;
        if (val &gt;= beta) {
            hashtable[x].checksum = y;
            hashtable[x].depth = depth;
            hashtable[x].entry_type = lower_bound;
            hashtable[x].eval = val;
            return val;
        }
        if (val &gt; alpha) {
            alpha = val;
            eval_is_exact = 1;
        }
    }

    hashtable[x].checksum = y;
    hashtable[x].depth = depth;
    if (eval_is_exact) hashtable[x].entry_type = exact;
    else hashtable[x].entry_type = upper_bound;
    hashtable[x].eval = alpha;
    return alpha;
}
</PRE>
<H3>Alpha-beta and move ordering</H3>
<P>I said we'd return to alpha-beta; here it is. We did an optimistic analysis 
last time of alpha-beta, showing that it can double your search depth if it 
prunes whenever it can. The condition that "it prunes whenever it can" can be 
expressed more simply: good moves are searched before bad ones. The moves don't 
have to be completely sorted, but the best one should be first or at least one 
of the best should be one of the first. What happens if not? Then we don't do 
any pruning and we don't search very deeply. 
<P>If we classify nodes into type A (all children get searched) and type B (we 
prune after finding a good child) then move ordering is important in both cases: 
in type B, you want to start with a child that will let you prune the rest. In 
type A, you want to choose a first child that is good enough to let all the 
other children be type B. 
<P>Of course, finding good moves is hard: it's the whole reason we're doing the 
search in the first place. But we have some clues: (1) we may have hashtable 
entries from previous iterations of iterated deepening that give approximations 
to search values (same positions searched less deeply). (2) we may have some 
game-specific information, e.g. in chess captures are often good moves, try them 
first. (3) the killer heuristic: if move m was best in a sibling, and is valid 
here too, try it. 
<P>So, before searching children, add a step: sort them by expected quality. 
Then do the search in the sorted order. (Sometimes you can modify the move 
generator to output moves in roughly-sorted order e.g. captures first, and save 
doing an explicit sort.) 
<P>One additional trick: if you think you're going to prune, you don't need to 
sort everything, you just need to output the first few items in sorted order. So 
you may want to use a sort that you can take items one by one from and stop 
early, e.g. selection sort or heapsort. 
<P>
<HR>
<A href="http://www.ics.uci.edu/~eppstein/">David Eppstein, <A 
href="http://www.ics.uci.edu/">Dept. Information &amp; Computer Science</A>, <A 
href="http://www.uci.edu/">UC Irvine</A>, Wednesday, 07-May-1997 14:58:31 PDT. 
</BODY></HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久综合色一本| 亚洲婷婷综合色高清在线| 国产精品久久精品日日| 亚洲一区二区在线免费观看视频| 国产精品网站一区| 性久久久久久久| 99国内精品久久| 国产亚洲一二三区| 全部av―极品视觉盛宴亚洲| 不卡的av在线播放| 久久久久综合网| 一区二区三区**美女毛片| 国产精品456露脸| 欧美一级片免费看| 午夜精品福利视频网站| 91丨porny丨首页| 中文字幕不卡在线观看| 国产精品一区二区黑丝| 国产精品久久久久久久裸模| 另类调教123区 | 精品国产123| 亚洲精品国产a| 91网上在线视频| 国产精品久久综合| 国产v综合v亚洲欧| 日韩精品在线看片z| 亚洲二区视频在线| 欧美男男青年gay1069videost| 欧美三级午夜理伦三级中视频| 91久久精品一区二区二区| 欧美国产综合色视频| 国产999精品久久| 国产情人综合久久777777| 国产一区二区三区综合| 精品捆绑美女sm三区| 美脚の诱脚舐め脚责91| 欧美成人一级视频| 国产精品亚洲一区二区三区妖精 | 欧美亚洲尤物久久| 国产精品成人一区二区艾草 | 欧美精品第1页| 亚洲妇熟xx妇色黄| 欧美精品视频www在线观看| 亚洲成人手机在线| 欧美一区二区精品| 国产一区视频网站| 国产精品国产三级国产普通话三级 | 国产精品久久久久三级| 成人精品一区二区三区中文字幕| 欧美性受极品xxxx喷水| 亚洲大型综合色站| 日韩欧美成人激情| 国产在线乱码一区二区三区| 久久久久国产精品免费免费搜索| 亚洲成人综合在线| 日韩视频免费观看高清在线视频| 国产精品网站在线| 欧美性大战久久久| 美女视频黄免费的久久| 国产精品理论在线观看| 欧美日韩高清一区| 国产综合久久久久影院| 国产精品日日摸夜夜摸av| 欧美三日本三级三级在线播放| 国产欧美视频一区二区| 一本一本久久a久久精品综合麻豆| 日韩精品专区在线影院重磅| 成人午夜av电影| 卡一卡二国产精品| 欧美激情资源网| 色噜噜狠狠色综合中国| 麻豆精品一区二区综合av| 国产精品网站在线| 欧美一区二区视频免费观看| 国产激情偷乱视频一区二区三区| 91蝌蚪porny九色| 精品一区免费av| 日韩二区三区四区| 色综合天天性综合| 精品久久免费看| 久久超碰97中文字幕| 亚洲欧美日韩一区二区三区在线观看| 日韩成人dvd| 国产精品美女久久久久久久久| 日本不卡中文字幕| 国产精品毛片a∨一区二区三区| 另类中文字幕网| 亚洲一区二区欧美| 亚洲欧洲国产专区| 久久色成人在线| 欧美一区二区在线看| a4yy欧美一区二区三区| 国产毛片精品视频| 免费久久99精品国产| 五月综合激情网| 亚洲欧美偷拍另类a∨色屁股| 91蜜桃婷婷狠狠久久综合9色| 久久久国产综合精品女国产盗摄| 韩国一区二区视频| 亚洲成人一区在线| 国产欧美一区二区三区沐欲| 日日夜夜免费精品| 在线精品观看国产| av亚洲产国偷v产偷v自拍| 美腿丝袜亚洲综合| 亚洲电影激情视频网站| 一区二区三区在线观看视频| 国产精品人成在线观看免费| 国产色综合一区| 久久久三级国产网站| 精品乱人伦一区二区三区| 日韩欧美卡一卡二| 日韩一区二区电影网| 欧美一区二区三区喷汁尤物| 欧美区一区二区三区| 欧美日韩一级片在线观看| 日本福利一区二区| 欧美性大战久久久久久久蜜臀| 丝袜诱惑制服诱惑色一区在线观看| 欧美日韩国产美| 欧美日韩国产成人在线91| 欧美日韩一区二区在线观看视频 | 波多野结衣一区二区三区 | 日韩成人免费电影| 亚洲欧洲精品成人久久奇米网| 欧美日韩在线精品一区二区三区激情| 日韩精品电影在线| 蜜桃传媒麻豆第一区在线观看| 欧美韩国日本综合| 日韩美女精品在线| 亚洲综合成人在线| 午夜视频一区在线观看| 蜜臀国产一区二区三区在线播放 | 最新久久zyz资源站| 亚洲婷婷在线视频| 亚洲国产va精品久久久不卡综合| 精品国产一区二区三区久久影院| av亚洲精华国产精华| 色偷偷88欧美精品久久久| 日本电影欧美片| 在线电影院国产精品| 精品国产一区二区三区四区四| 成人黄色av网站在线| 日本乱人伦一区| 日本aⅴ免费视频一区二区三区| 在线观看91精品国产入口| 欧美视频在线一区| 91精品国产入口在线| 国产亚洲精品aa| 亚洲自拍与偷拍| 激情综合亚洲精品| 一本一道久久a久久精品综合蜜臀 一本一道综合狠狠老 | 欧美日韩综合一区| 日韩三级在线免费观看| 国产精品欧美一区喷水| 午夜精品久久久久久| 国产精品一区二区视频| 一本久久综合亚洲鲁鲁五月天| 国产一区 二区 三区一级| 色视频成人在线观看免| 日韩欧美中文字幕公布| 亚洲人成在线播放网站岛国| 麻豆久久一区二区| 色呦呦日韩精品| 2欧美一区二区三区在线观看视频| 欧美日韩一级片在线观看| 精品处破学生在线二十三| 曰韩精品一区二区| av在线这里只有精品| 日韩欧美一级二级三级久久久| 69av一区二区三区| 亚洲欧美综合在线精品| 久久91精品国产91久久小草| 欧美视频一区二区三区在线观看| 99精品欧美一区二区三区小说| 国产一区在线观看视频| 欧美在线观看视频一区二区| 日韩天堂在线观看| 亚洲免费看黄网站| 亚洲人成在线播放网站岛国| 国内精品不卡在线| 日韩欧美一区二区久久婷婷| 亚洲国产精品久久艾草纯爱| a亚洲天堂av| 久久久精品欧美丰满| 免费的成人av| 日韩一区二区不卡| 五月天激情综合| 在线免费观看成人短视频| 日韩理论电影院| 99在线精品视频| 国产精品白丝在线| 不卡av免费在线观看| 亚洲国产高清不卡| 成人v精品蜜桃久久一区| 欧美极品美女视频| 亚洲一区在线观看网站| 欧美日韩中文另类| 亚洲国产精品一区二区久久恐怖片| 亚洲伊人伊色伊影伊综合网|