Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
89 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 The Dilemma
 Forward Pruning
 Generating All
 Moves Up-Front

 One Move
 At A Time

 Ordering Moves
 My Choice

 Printable version

 


  The Series

 Getting Started
 Data Structures
 Move Generation
 Basic Search
 Advanced Search
 Evaluation
 Functions


 

Ordering Moves To Speed Up Search

As we will see next time, search efficiency depends on the order in which moves are searched.  The gains and losses related to good or poor move ordering are not trivial: a good ordering, defined as one which will cause a large number of cutoffs, will result in a search tree about the square root of the size of the tree associated with the worst possible ordering!

Unfortunately, it turns out that the best possible ordering is simply defined by trying the best move first.  And of course, if you knew which moves are best, you wouldn't be searching in the first place.  Still, there are ways to "guess" which moves are more likely to be good than others.  For example, you might start with captures, pawn promotions (which dramatically change material balance on the board), or checks (which often allow few legal responses); follow with moves which caused recent cutoffs at the same depth in the tree (so-called "killer moves"), and then look at the rest.  This is the justification for iterative deepening alphabeta, which we will discuss in detail next month, as well as the history table we talked about last time.  Note that these techniques do not constitute forward pruning: all moves will be examined eventually; those which appear bad are only delayed, not eliminated from consideration.

A final note: in chess, some moves may be illegal because they leave the King in check.  However, such an occurrence is quite rare, and it turns out that validating moves during generation would cost a tremendous amount of effort.  It is more efficient to delay the check until the move is actually searched: for example, if capturing the King would be a valid reply to Move X, then Move X is illegal and search should be terminated.  Of course, if search is cutoff before the move has to be examined, validation never has to take place.


Next : My Choice