Skip to content

Commit

Permalink
Unified butterfly history (-24 tokens)
Browse files Browse the repository at this point in the history
10+0.01s
Score of Dev vs Main: 1213 - 1186 - 2101 [0.503]
...      Dev playing White: 655 - 554 - 1041  [0.522] 2250
...      Dev playing Black: 558 - 632 - 1060  [0.484] 2250
...      White vs Black: 1287 - 1112 - 2101  [0.519] 4500
Elo difference: 2.1 +/- 7.4, LOS: 70.9 %, DrawRatio: 46.7 %
  • Loading branch information
codedeliveryservice committed Sep 18, 2023
1 parent ecacbf2 commit 3c5ac96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Chess-Challenge/src/My Bot/MyBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private readonly
///
/// <para>Indexed by [<see cref="Move.MovePieceType"/>][<see cref="Move.TargetSquare"/>].</para>
/// </summary>
private readonly int[,,] historyTable = new int[2, 7, 64];
private readonly int[] historyTable = new int[4096];

/// <summary>
/// <see href="https://www.chessprogramming.org/Killer_Move">Killer Move Heuristic</see> for ordering quiet moves.
Expand Down Expand Up @@ -166,7 +166,7 @@ private int GetMoveScore(Move move, Move tableMove) =>
// 4. Killer heuristic for quiet moves
: killerMoves[board.PlyCount] == move ? 10000
// 5. History heuristic for quiet moves
: 100_000_000 - historyTable[board.PlyCount & 1, (int)move.MovePieceType, move.TargetSquare.Index];
: 100_000_000 - historyTable[move.RawValue & 4095];

/// <summary>
/// Performs an <see href="https://www.chessprogramming.org/Alpha-Beta">Alpha-Beta</see> search with
Expand Down Expand Up @@ -348,7 +348,7 @@ private int AlphaBeta(int depth, int alpha, int beta, bool nullMoveAllowed = tru

void UpdateHistory(Move move, int bonus)
{
ref int entry = ref historyTable[board.PlyCount & 1, (int)move.MovePieceType, move.TargetSquare.Index];
ref int entry = ref historyTable[move.RawValue & 4095];
entry += 32 * bonus * depth - entry * depth * depth / 512;
}
}
Expand Down

0 comments on commit 3c5ac96

Please sign in to comment.