File: killer.c

package info (click to toggle)
crafty 23.4-9
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid, trixie
  • size: 3,292 kB
  • sloc: ansic: 30,650; cpp: 5,829; makefile: 890; sh: 178; perl: 30
file content (38 lines) | stat: -rw-r--r-- 1,742 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "chess.h"
#include "data.h"
/* last modified 01/14/09 */
/*
 *******************************************************************************
 *                                                                             *
 *   Killer() is used to maintain the two killer moves for each ply.  the most *
 *   recently used killer is always first in the list.                         *
 *                                                                             *
 *******************************************************************************
 */
void Killer(TREE * RESTRICT tree, int ply, int move) {
/*
 ************************************************************
 *                                                          *
 *   If the best move so far is a capture or a promotion,   *
 *   return, since we try good captures and promotions      *
 *   before searching killer heuristic moves anyway.        *
 *                                                          *
 ************************************************************
 */
  if (CaptureOrPromote(move))
    return;
/*
 ************************************************************
 *                                                          *
 *   Now, add this move to the current killer moves if it   *
 *   is not already there.  If the move is already first in *
 *   the list, leave it there, otherwise move the first one *
 *   down to slot two and insert this move into slot one.   *
 *                                                          *
 ************************************************************
 */
  if (tree->killers[ply].move1 != move) {
    tree->killers[ply].move2 = tree->killers[ply].move1;
    tree->killers[ply].move1 = move;
  }
}