410 likes | 581 Views
The Shape of a Game Tree Fragment. Standard - is an algorithm which performs the same computation as minimax for a given tree - avoiding generating useless parts of that tree.
E N D
The Shape of a Game Tree Fragment • Standard - is an algorithm which performs the same computation as minimax for a given tree - avoiding generating useless parts of that tree. • Quiescence Search can be seen as a method for defining the shape of a tree by means other than truncating it at a fixed depth. • Quiescence Search can be used as an evaluation function at the leaves of an - search (or any other for that matter, even itself: Second Order Quiescence). • It allows further search to be used as if it were a static evaluation function. • Null-Move Quiescence Search generates at least a fringe of null-moves one ply beyond the normal fixed depth of the tree (though null moves are very cheap) http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Null Move Quiescence as an Evaluation Function NMQuiesce (real lower, real upper) /* initially -, + */ {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Animation of Null-Move Quiescence Search • Nodes in search tree generally have six attributes: • After consideration of a node is complete, collapse it to: • Integers, not reals, will be used for simplicity. http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
What is the value of the position? NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Generate null move NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Generate null move and evaluate it NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Use that evaluation NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Since 0 < +, generate 1st real move K-h3 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Start with null move K-h3 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Statically evaluate K-h3 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Use that evaluation K-h3 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Since “best 0” >= “upper 0”, K-h3 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Since “best 0” >= “upper 0”, immediately return 0 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
“best=0” < “upper=+”, so generate next move available NxP NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Obtain null-move evaluation NxP NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Since “upper=0” > “best=-1”, try 1st move NxP K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Obtain null-move evaluation NxP K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Now “best=+1” >= “upper=+1”, NxP K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Now “best=+1” >= “upper=+1”, so return value +1 NxP K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Best:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Best>=upper then Return Best; makemove(M); Temp:= - NMQuiesce( - upper, - Best); unmakemove(); Best:=Max(Best,Temp)} Return Best} http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Try another move NxP BxN http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Null move evaluation NxP BxN http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
“best=-2” < “upper=+1”, so off again … NxP BxN http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Try a move NxP BxN K-h3 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Use null move evaluation, test, return NxP BxN K-h3 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Try another move NxP BxN P-f4 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Try all moves in turn NxP BxN K-g1 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Eventually settling on a value NxP BxN K-g1 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
.. Which is returned NxP BxN K-g1 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
.. Which is returned, compared NxP BxN K-g1 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
.. Which is returned, compared, found to be better NxP BxN K-g1 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Other black moves need not be considered NxP B-a3 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
A value exceeding “upper” has been found NxP B-a3 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Demonstrating that that capture is not good http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Other moves are considered (null again not shown) N-c3 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Eventually determining a value for the initial position N-c3 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Null-Move values as bounds • The value determined for every node arises originally as the result of an evaluation of a null move. • These evaluations - assuming the position is not zugzwang - are properly thought of as providing (lower) bounds on the value of a position. (Not to be confused with alpha and beta - achievable and hope - which are bounds on the range of values one is interested in exploring.) • “The value of this position is at least N” is more reliable than • “The value of this position is N” The value of the topmost node arises not from one evaluation providing one bound, but from two or more opposing evaluations providing touching bounds. http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Touching bounds • The smallest possible tree for null-move quiescence: +4 -4 -4 +4 http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Quiescence as Evaluation • The sort of evaluation performed by QUIESCE is to be performed at every leaf node of a MINIMAX (or AlphaBeta) search. http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Second Order Quiescence • Since Quiescence Search can be regarded as an evaluation function, it can be used as such within another quiescence search: wherever the main quiescence search generates and evaluates a null move, that evaluation is performed using quiescence search with the real evaluation function. http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Evaluations that produce bounds on values • Null moves may be regarded as producing a lower bound on a position’s value. • A quiescence search that is terminated early - for example, by being restricted in terms of the depth of tree it may build or the number of nodes it may generate - may produce a “fat value” - a combination of • A reliable lower bound (assuming no zugzwang) • A reliable upper bound (assuming no zugzwang) • Possibly, an unreliable value in between • Fat values may also be produced by other means, for instance a pairing of a pessimistic evaluation function and an optimistic one. • Some search algorithms, eg Berliner’s B* algorithm, work with value ranges rather than point values. More on B* another day … http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles
Bounds on values of interest to a search • The AlphaBeta tree search algorithm uses its parameters (achievable) and (hope) to cut off search of parts of the game tree which cannot affect the minimaxed value ultimately found at the root. Once it is determined that a subtree’s value falls outside certain bounds, it can be abandoned. • Conventionally, AlphaBeta is started off (at a root node) in an agnostic manner: =- and =+ corresponds to having no idea what the value of the position is. • Some interesting algorithms use an AlphaBeta search with different and : using a narrower search window in the expectation of getting more cutoffs. • Aspiration Search • NegaScout & PVS (Principal Variation Search) • Scout • MTD(f) http://csiweb.ucd.ie/Staff/acater/comp30260.htmlArtificial Intelligence for Games and Puzzles