public void Reset() { for (var depth = 0; depth < _killerMoves.Length; depth++) { var killerMoves = _killerMoves[depth]; killerMoves[0] = new KillerMove(Piece.None, Square.Illegal); killerMoves[1] = new KillerMove(Piece.None, Square.Illegal); } }
public int GetValue(int depth, ulong move) { var killerMove = KillerMove.Parse(move); if (killerMove == _killerMoves[depth][0]) { return(2); } return(killerMove == _killerMoves[depth][1] ? 1 : 0); }
public void Update(int depth, ulong move) { var killerMove = KillerMove.Parse(move); if (killerMove == _killerMoves[depth][0]) { return; // Move already is the best killer move. } // Shift and update killer move. _killerMoves[depth][1] = _killerMoves[depth][0]; _killerMoves[depth][0] = killerMove; }
public void Shift(int depth) { // Shift killer moves closer to root position. var lastDepth = _killerMoves.Length - depth - 1; for (var depthIndex = 0; depthIndex <= lastDepth; depthIndex++) { _killerMoves[depthIndex][0] = _killerMoves[depthIndex + depth][0]; _killerMoves[depthIndex][1] = _killerMoves[depthIndex + depth][1]; } // Reset killer moves far from root position. for (var depthIndex = lastDepth + 1; depthIndex < _killerMoves.Length; depthIndex++) { _killerMoves[depthIndex][0] = new KillerMove(Piece.None, Square.Illegal); _killerMoves[depthIndex][1] = new KillerMove(Piece.None, Square.Illegal); } }
// ReSharper disable once MemberCanBePrivate.Global public bool Equals(KillerMove otherKillerMove) => (_piece == otherKillerMove._piece) && (_toSquare == otherKillerMove._toSquare);