Subversion Repositories Games.Chess Giants

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include "chess.h"
  2. #include "data.h"
  3. /* last modified 01/14/09 */
  4. /*
  5.  *******************************************************************************
  6.  *                                                                             *
  7.  *   Killer() is used to maintain the two killer moves for each ply.  the most *
  8.  *   recently used killer is always first in the list.                         *
  9.  *                                                                             *
  10.  *******************************************************************************
  11.  */
  12. void Killer(TREE * RESTRICT tree, int ply, int move) {
  13. /*
  14.  ************************************************************
  15.  *                                                          *
  16.  *  If the best move so far is a capture or a promotion,    *
  17.  *  return, since we try good captures and promotions       *
  18.  *  before searching killer heuristic moves anyway.         *
  19.  *                                                          *
  20.  ************************************************************
  21.  */
  22.   if (CaptureOrPromote(move))
  23.     return;
  24. /*
  25.  ************************************************************
  26.  *                                                          *
  27.  *  Now, add this move to the current killer moves if it is *
  28.  *  not already there.  If the move is already first in the *
  29.  *  list, leave it there, otherwise move the first one down *
  30.  *  to slot two and insert this move into slot one.         *
  31.  *                                                          *
  32.  ************************************************************
  33.  */
  34.   if (tree->killers[ply].move1 != move) {
  35.     tree->killers[ply].move2 = tree->killers[ply].move1;
  36.     tree->killers[ply].move1 = move;
  37.   }
  38. }
  39.