Skip to content

Commit dc567a0

Browse files
committed
added more cites and revision
1 parent 033c29b commit dc567a0

File tree

10 files changed

+137
-85
lines changed

10 files changed

+137
-85
lines changed

docs/AlphaDeepChess/Capitulos/AnalysisOfImprovements.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ \subsection*{Profiler}
3131

3232
\noindent Our profiling goal is to identify which parts of the code consume the most execution time. We run the engine under \texttt{perf} using the following commands:
3333

34-
\begin{lstlisting}[language=bash, caption={Profiling AlphaDeepChess with perf}, frame=single, breaklines=true]
34+
\begin{lstlisting}[language=bash, caption={Profiling \textit{AlphaDeepChess} with perf}, frame=single, breaklines=true]
3535
# Record performance data with function stack traces
3636
sudo perf record -g ./build/release/AlphaDeepChess
3737

@@ -54,7 +54,7 @@ \subsection*{Profiler}
5454

5555
All of these improvements have been compared with each other using \textit{CuteChess}, and the best version was also evaluated against \textit{Stockfish}. These comparisons were conducted on machines provided by GitHub Actions.
5656

57-
\subsection*{Cutechess}
57+
\subsection*{\textit{Cutechess}}
5858

5959
\noindent After considering different options, \textit{Cutechess} proved to be the best fit for our needs.
6060

@@ -68,7 +68,7 @@ \subsection*{Cutechess}
6868

6969
\vspace{1em}
7070

71-
\noindent Mainly, this tool is responsible for sending commands to both selected engines. For example, when both Stockfish and our engine implement UCI, \textit{Cutechess} knows in advance the commands to send, as well as parameters such as the search time and depth for each engine, the number of games to play, the time control, or even specific openings to use. Providing specific openings introduces randomization between games, which is beneficial for later evaluation.
71+
\noindent Mainly, this tool is responsible for sending commands to both selected engines. For example, when both \textit{Stockfish} and our engine implement UCI, \textit{Cutechess} knows in advance the commands to send, as well as parameters such as the search time and depth for each engine, the number of games to play, the time control, or even specific openings to use. Providing specific openings introduces randomization between games, which is beneficial for later evaluation.
7272

7373
\vspace{1em}
7474

@@ -133,7 +133,7 @@ \subsection*{Cutechess}
133133
\begin{figure}
134134
\centering
135135
\includegraphics[width=1.0\textwidth]{Imagenes/gui.png}
136-
\caption{AlphaDeepChess GUI}\label{fig:gui}
136+
\caption{\textit{AlphaDeepChess}'s GUI}\label{fig:gui}
137137
\end{figure}
138138

139139
\noindent In~\cref{fig:gui}, the engine evaluation is enabled and displays the current evaluation value, the best move found, and the calculated search depth. In this way, we also ensure a more user-friendly experience.
@@ -277,22 +277,22 @@ \subsection*{Analysis}
277277

278278
\newpage
279279

280-
\section{Evaluation versus stockfish}
280+
\section{Evaluation versus \textit{Stockfish}}
281281

282282
\begin{center}
283283
\ResultBar{15cm}{0.5cm}{0}{0}{100}
284284
\medskip
285285
\end{center}
286286

287-
\noindent AlphaDeepChess lost all games against Stockfish. This outcome was expected, as Stockfish has an estimated Elo rating of around 3644~\cite{StockfishElo}, making it orders of magnitude stronger than the best human players. In contrast, as we will show in the next section, AlphaDeepChess plays at a level comparable to a strong human player.
287+
\noindent \textit{AlphaDeepChess} lost all games against \textit{Stockfish}. This outcome was expected, as \textit{Stockfish} has an estimated Elo rating of around 3644~\cite{StockfishElo}, making it orders of magnitude stronger than the best human players. In contrast, as we will show in the next section, \textit{AlphaDeepChess} plays at a level comparable to a strong human player.
288288

289289
\section{Engine final evaluation}
290290

291291
\noindent Figure~\cref{fig:eloDistribution} shows the Elo rating distribution of players on Lichess, where the median rating is approximately 1500.
292292

293293
\vspace{1em}
294294

295-
\noindent AlphaDeepChess has achieved a rating of 1900 on Lichess~\cite{AlphaDeepChessElo}, placing it well above the median and within the top percentiles of the player base. For comparison, the highest-rated human player on the platform has reached 3000 Elo in 2025~\cite{LichessBestPlayer}.
295+
\noindent \textit{AlphaDeepChess} has achieved a rating of 1900 on Lichess~\cite{AlphaDeepChessElo}, placing it well above the median and within the top percentiles of the player base. For comparison, the highest-rated human player on the platform has reached 3000 Elo in 2025~\cite{LichessBestPlayer}.
296296

297297
\begin{figure}
298298
\centering

docs/AlphaDeepChess/Capitulos/ContribucionesPersonales.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
\chapter{Personal contributions}\label{cap:contribucionesPersonales}
22

3-
The following section details the individual contributions made by each team member, Juan and Yi, throughout the development of the AlphaDeepChess project. Each contribution is listed to provide transparency regarding the division of work, highlight specific areas of responsibility, and acknowledge the expertise and effort invested by each author.
3+
The following section details the individual contributions made by each team member, Juan and Yi, throughout the development of the \textit{AlphaDeepChess} project. Each contribution is listed to provide transparency regarding the division of work, highlight specific areas of responsibility, and acknowledge the expertise and effort invested by each author.
44

55
\section*{Juan Girón Herranz}
66

docs/AlphaDeepChess/Capitulos/DescripcionTrabajo.tex

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ \section{Chessboard representation: bitboards}
2929

3030
\noindent A list of twelve bitboards is used, one for each type of chess piece.~\cref{fig:bitboardPositionExample} illustrates this concept with a chess position example.
3131

32+
\vspace{1em}
33+
3234
\begin{figure}
3335
\centering
3436
\newchessgame
@@ -87,7 +89,7 @@ \subsection*{Game state}
8789

8890
\begin{enumerate}
8991
\item Total number of moves played in the game (bit 0-19).
90-
\item En passant target square (if applicable) (bits 20-26).
92+
\item \textit{En passant} target square (if applicable) (bits 20-26).
9193
\item Black's queenside castling availability (bit 27).
9294
\item Black's kingside castling availability (bit 28).
9395
\item White's queenside castling availability (bit 29).
@@ -113,11 +115,11 @@ \section{Search algorithm}
113115
\noindent The following events happen at each node of the tree:
114116

115117
\begin{enumerate}
116-
\item Terminal node verification: Check for game termination conditions including checkmate, threefold repetition, the fifty-move rule, or reaching maximum search depth.
117-
\item Position evaluation: A positive value indicates White's advantage, while a negative value favors Black. We establish 3,200,000 as the mate-in-one threshold value.
118-
\item Legal move generation: create a list of every possible legal move in the position.
119-
\item Move ordering: Sort moves by estimated quality (best to worst). The sooner we explore the best move, the more branches of the tree will be pruned.
120-
\item Move exploration: Iterate through each of the legal moves from the position in order, update the position evaluation, the value of alpha and beta, and performing pruning when possible.
118+
\item \textit{Terminal node verification}: Check for game termination conditions including checkmate, threefold repetition, the fifty-move rule, or reaching maximum search depth.
119+
\item \text{Position evaluation}: A positive value indicates white's advantage, while a negative value favors black. We establish $3,200,000$ as the mate-in-one threshold value. The value is $3,200,000$ because it is much larger than any possible material or positional evaluation, ensuring that a checkmate is always prioritized over any other advantage.
120+
\item \textit{Legal move generation}: create a list of every possible legal move in the position.
121+
\item \textit{Move ordering}: Sort moves by estimated quality (best to worst). The sooner we explore the best move, the more branches of the tree will be pruned.
122+
\item \textit{Move exploration}: Iterate through each of the legal moves from the position in order, update the position evaluation, the value of alpha and beta, and performing pruning when possible.
121123
\end{enumerate}
122124

123125
\subsection*{Iterative deepening}\label{sec:iterativeDeepening}
@@ -469,7 +471,7 @@ \subsection*{Bitboard of danger squares}
469471

470472
\vspace{1em}
471473

472-
\noindent However, sliding pieces as rooks, bishops, and queens require additional handling. Their attacks depend on the presence of blockers in their movement paths.~\cref{fig:blockerExample} shows an example where the attacks of sliding pieces are limited due to blocking pawns.
474+
\noindent However, sliding pieces as rooks, bishops, and queens require additional handling. Their attacks depend on the presence of blockers in their movement paths.~\cref{fig:blockerExample} shows an example where the attacks of sliding pieces are limited due to blocking pawns. In this case, the rook sliding attack is being blocked by the pawns.
473475

474476
\vspace{1em}
475477

@@ -491,10 +493,6 @@ \subsection*{Bitboard of danger squares}
491493

492494
\end{figure}
493495

494-
\noindent In~\cref{fig:blockerExample}, the rook sliding attack is being blocked by the pawns.
495-
496-
\vspace{1em}
497-
498496
\noindent Currently, calculating legal attacks for sliding pieces involves iterating along orthogonal and diagonal directions until a blocking piece is encountered. This approach is relatively inefficient. In subsequent sections, we present optimization techniques that address this issue.
499497

500498
\subsection*{Bitboard of pinned pieces}
@@ -564,7 +562,7 @@ \subsection*{Legal move computation}
564562
\begin{itemize}[itemsep=1pt]
565563
\item \textit{Double check}: If there are two or more checkers, the only legal option is to move the king to a square that is not under attack, outside the danger bitboard. No other piece can legally move in this case.
566564
\item \textit{No check}: In the absence of any checks, we iterate through all the pieces belonging to the side to move and generate their legal moves. If a piece is pinned (inside pinned piece bitboard), its movement is constrained to the direction of the pin.
567-
\item \textit{Single check}: If exactly one checker is present, we again iterate over all pieces, but the only moves available are to capture the checker (captures inside the capture mask) or to block the check (moves inside the push mask).
565+
\item \textit{Single check}: If exactly one checker is present, we again iterate over all pieces. The moves available are to capture the checker (captures inside the capture mask), to block the check (moves inside the push mask), or to move the king to a legal square.
568566
\end{itemize}
569567

570568
\noindent Finally, the special moves of castling and \textit{en passant} are handled explicitly by looking for the castling rights and the \textit{en passant} target square in the game state.
@@ -575,11 +573,11 @@ \subsection*{Testing the move generator: perft test}
575573

576574
\vspace{1em}
577575

578-
\noindent Perft is a debugging function in which we generate the entire game tree for a specific position up to a given depth and count all the resulting nodes. We can then compare our results with those of other engines, such as Stockfish. Since Stockfish is widely regarded as highly accurate, it serves as a reliable reference for validating move generation.
576+
\noindent Perft is a debugging function in which we generate the entire game tree for a specific position up to a given depth and count all the resulting nodes. We can then compare our results with those of other engines, such as \textit{Stockfish}. Since \textit{Stockfish} is widely regarded as highly accurate, it serves as a reliable reference for validating move generation.
579577

580578
\vspace{1em}
581579

582-
\noindent In~\cref{tab:perftResults}, we present our Perft results alongside those of Stockfish for seven well-known test positions at depth 6. The identical node counts in all cases confirm the correctness of our move generator.
580+
\noindent In~\cref{tab:perftResults}, we present our Perft results alongside those of \textit{Stockfish} for seven well-known test positions at depth 6. The identical node counts in all cases confirm the correctness of our move generator.
583581

584582
\begin{table}
585583
\centering
@@ -596,7 +594,7 @@ \subsection*{Testing the move generator: perft test}
596594
\texttt{FEN START POS} & 119060324 & 119060324 \\
597595
\hline
598596
\end{tabular}
599-
\caption{Perft results at depth 6: comparison between Stockfish and AlphaDeepChess~\cite{PerftResults}.}\label{tab:perftResults}
597+
\caption{Perft results at depth 6: comparison between \textit{Stockfish} and \textit{AlphaDeepChess}~\cite{PerftResults}.}\label{tab:perftResults}
600598
\end{table}
601599

602600
\section{Move ordering}
@@ -613,26 +611,30 @@ \section{Move ordering}
613611

614612
\subsection*{Most valuable victim - least valuable aggressor}
615613

616-
The heuristic we implemented is the Most Valuable Victim - Least Valuable Aggressor (MVV-LVA). In this approach, a move receives a high score if it captures a valuable piece using a less valuable one. For example, capturing a queen with a pawn is considered a very strong move~\cite{MVVLVA}.
614+
The heuristic we implemented is the \textit{Most Valuable Victim - Least Valuable Aggressor (MVV-LVA)}. In this approach, a move receives a high score if it captures a valuable piece using a less valuable one. For example, capturing a queen with a pawn is considered a very strong move~\cite{MVVLVA}.
617615

618616
\vspace{1em}
619617

620618
\noindent We implemented this heuristic using a look-up table indexed by the moving piece and the captured piece, as shown in~\cref{tab:mvv-lva-table}. Capturing a queen with a pawn receives a score of 55, while doing the opposite receives 11 points.
621619

622620
\begin{table}
623621
\centering
624-
\begin{tabular}{|c|r|r|r|r|r|r|r|}
625-
\hline
626-
\textit{Victim $\backslash$ Attacker} & \textit{P} & \textit{N} & \textit{B} & \textit{R} & \textit{Q} & \textit{K} & \textit{EMPTY} \\
627-
\hline
628-
\textit{P} & 15 & 14 & 13 & 12 & 11 & 10 & 0 \\
629-
\textit{N} & 25 & 24 & 23 & 22 & 21 & 20 & 0 \\
630-
\textit{B} & 35 & 34 & 33 & 32 & 31 & 30 & 0 \\
631-
\textit{R} & 45 & 44 & 43 & 42 & 41 & 40 & 0 \\
632-
\textit{Q} & 55 & 54 & 53 & 52 & 51 & 50 & 0 \\
633-
\textit{K} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
634-
\textit{EMPTY} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
635-
\hline
622+
\begin{tabular}{|c|r|r|r|r|r|r|}
623+
\hline
624+
\textit{Victim $\backslash$ Attacker} & \textit{P} & \textit{N} & \textit{B} & \textit{R} & \textit{Q} & \textit{K} \\
625+
\hline
626+
\textit{P} & 15 & 14 & 13 & 12 & 11 & 10 \\
627+
\hline
628+
\textit{N} & 25 & 24 & 23 & 22 & 21 & 20 \\
629+
\hline
630+
\textit{B} & 35 & 34 & 33 & 32 & 31 & 30 \\
631+
\hline
632+
\textit{R} & 45 & 44 & 43 & 42 & 41 & 40 \\
633+
\hline
634+
\textit{Q} & 55 & 54 & 53 & 52 & 51 & 50 \\
635+
\hline
636+
\textit{K} & 0 & 0 & 0 & 0 & 0 & 0 \\
637+
\hline
636638
\end{tabular}
637639
\caption{MVV-LVA heuristic table: Rows = Victims, Columns = Attackers.}\label{tab:mvv-lva-table}
638640
\end{table}
@@ -668,8 +670,10 @@ \subsection*{Killer moves}
668670

669671
\noindent In~\cref{fig:killer_move_example}, the queen moves to h5, threatening checkmate on f7. This quiet move prunes all other moves that do not respond to the threat.
670672

673+
\vspace{1em}
674+
671675
\noindent These moves are remembered and prioritized during move ordering, as they have proven effective in position at the same depth in the search tree. We implemented a table where we store two moves that causes a cutoff per search depth. There could be more than two killer moves, our replacement policy is to always maintain the older killer move found in one slot, and in the other slot store the least recently found.
672676

673677
\vspace{1em}
674678

675-
\noindent If a quiet move being evaluated matches one of the killer moves stored at the current search depth, we increase its score by 70 points.
679+
\noindent If a quiet move being evaluated matches one of the killer moves stored at the current search depth, we increase its score by 70 points. The value 70 is chosen empirically to ensure that killer moves are prioritized above most quiet moves, but still allow the most valuable captures (according to the MVV-LVA heuristic) to take precedence when appropriate. This balance helps improve pruning efficiency without overlooking critical tactical opportunities.

0 commit comments

Comments
 (0)