From 2d895e4abb26eccefe6b4bc201fd60eb79600e3e Mon Sep 17 00:00:00 2001
From: InigoGutierrez <inigogf.95@gmail.com>
Date: Sat, 13 May 2023 19:44:54 +0200
Subject: Added visualization of SGF example.

---
 doc/tex/systemDesign.tex | 88 ++++++++++++++++++++++++++----------------------
 1 file changed, 48 insertions(+), 40 deletions(-)

(limited to 'doc/tex/systemDesign.tex')

diff --git a/doc/tex/systemDesign.tex b/doc/tex/systemDesign.tex
index f0762e8..7a5db7b 100644
--- a/doc/tex/systemDesign.tex
+++ b/doc/tex/systemDesign.tex
@@ -34,20 +34,20 @@ variants exploration is an important part of Go learning, \program{} and most
 playing and analysis existing programs allow for navigation back and forth
 through the board states of a match and for new variants to be created from each
 of these board states. Therefore, a match is represented as a tree of moves. The
-GameMove class has the information about a specific move and also a reference to
+\texttt{GameMove} class has the information about a specific move and also a reference to
 the previous move and to a list of following moves, implementing this tree
 structure and allowing for navigating both forward and backwards in the move
 history.
 
 The state of the board at any given move must be stored so liberties, captures
 count and legality of moves can be addressed, so it is represented with the
-GameState class, which holds a reference to the current move.
+\texttt{GameState} class, which holds a reference to the current move.
 
 Moves depend on a representation of the game board to have access to its current
 layout and count of captured stones. There are also many logic operations needed
 to be performed on the board, such as getting the stones in a group, counting
 their liberties or checking if a move is playable. The layout of the board and
-these operations are implemented as the GameBoard class.
+these operations are implemented as the \texttt{GameBoard} class.
 
 A game can be started by the executable \texttt{go.py}.
 
@@ -74,24 +74,26 @@ three components, each with a separate responsibility:
 		applications and offers the text interface. It reads and processes input
 		and calls corresponding commands from the core of the engine.
 
-	\item The GameEngine contains the logic of the commands available from the
-		IO component. It uses a GameState to keep a record of the game and uses
-		a DecisionAlgorithm to generate moves.
+	\item The \texttt{GameEngine} contains the logic of the commands available
+		from the IO component. It uses a \texttt{GameState} to keep a record of
+		the game and uses a \texttt{DecisionAlgorithm} to generate moves.
 
-	\item The DecisionAlgorithm component is responsible of analyzing the match
-		and generate moves. The engine core uses it when a decision has to be
-		made by the AI, such as when a move needs to be generated by the engine.
+	\item The \texttt{DecisionAlgorithm} component is responsible of analyzing
+		the match and generate moves. The engine core uses it when a decision
+		has to be made by the AI, such as when a move needs to be generated by
+		the engine.
 
 \end{itemize}
 
-Two implementations of DecisionAlgorithm have been made: one for the Monte
-Carlo Tree Search algorithm (on the MCTS class) and the other for neural
-networks (on the Keras class).
+Two implementations of \texttt{DecisionAlgorithm} have been made: one for the
+Monte Carlo Tree Search algorithm (on the \texttt{MCTS} class) and the other for
+neural networks (on the \texttt{Keras} class).
 
-The Keras class also makes use of the NeuralNetwork class, which offers
-functions for creating, training, saving and using neural network models. The
-designs of the network are implemented in the subclasses DenseNeuralNetwork and
-ConvNeuralNetwork as examples of dense and convolutional networks, respectively.
+The \texttt{Keras} class also makes use of the \texttt{NeuralNetwork} class,
+which offers functions for creating, training, saving and using neural network
+models. The designs of the network are implemented in the subclasses
+\texttt{DenseNeuralNetwork} and \texttt{ConvNeuralNetwork} as examples of dense
+and convolutional networks, respectively.
 
 The engine can be started with the executable \texttt{imagocli.py}.
 
@@ -128,9 +130,9 @@ The exploration of the tree has 4 steps:
 The suggested move is the children of the current move with the best score from
 the perspective of the player which has to make the move.
 
-The implementation of the algorithm will use the existing GameMove class from
-the Game System to access the game logic it needs, such as to get the possible
-children from a node or to simulate random games.
+The implementation of the algorithm will use the existing \texttt{GameMove}
+class from the Game System to access the game logic it needs, such as to get the
+possible children from a node or to simulate random games.
 
 \subsubsection{Neural Networks Explained}
 
@@ -182,8 +184,8 @@ Then, a network with convolutional and max pooling layers to compare the
 approach used on image processing to the more general one and studying its
 utility on the analysis of the Go board.
 
-These networks have been implemented on the DenseNeuralNetwork and
-ConvNeuralNetwork classes, respectively.
+These networks have been implemented on the \texttt{DenseNeuralNetwork} and \\
+\texttt{ConvNeuralNetwork} classes, respectively.
 
 The networks have been designed to process boards of size 9x9, which is the
 introductory size to the game. It is the easiest both for the hardware to handle
@@ -273,13 +275,14 @@ store Go games: \acrshort{sgf}. If the system is able to process \acrshort{sgf}
 the games stored on them to the neural networks for training. And so the need
 for an \acrshort{sgf} parser arises.
 
-To parse \acrshort{sgf} files a lexer and parser have been implemented using PLY.\@ The
-result of the parsing is an AST (Annotated Syntax Tree) reflecting the contents
-of the text input, each node with zero or more properties, and with the ability
-to convert themselves and their corresponding subtree into a GameMove tree. This
-is done for the root node, since from the \acrshort{sgf} specification there are some
-properties only usable in the root node, like those which specify general game
-information and properties such as rank of players or \gls{komi}.
+To parse \acrshort{sgf} files a lexer and parser have been implemented using
+PLY.\@ The result of the parsing is an AST (Annotated Syntax Tree) reflecting
+the contents of the text input, each node with zero or more properties, and with
+the ability to convert themselves and their corresponding subtree into a
+\texttt{GameMove} tree. This is done for the root node, since from the
+\acrshort{sgf} specification there are some properties only usable in the root
+node, like those which specify general game information and properties such as
+rank of players or \gls{komi}.
 
 Here follows an explanation of the role and motivation before each component of
 the Training module to show how these previous concerns have been addressed and
@@ -288,23 +291,24 @@ solved. These components are shown in \fref{fig:trainingModule}.
 \begin{itemize}
 
 	\item \textbf{\acrshort{sgf}}: Provides a high-level method to convert a path to a \acrshort{sgf}
-		file to a GameMove tree.
+		file to a \texttt{GameMove} tree.
 
 	\item \textbf{sgfyacc}: The implementation of a \acrshort{sgf} parser using PLY. Takes
-		the tokens generated by \textbf{sgflex} and creates an ASTNode tree from
-		them.
+		the tokens generated by \textbf{sgflex} and creates an \texttt{ASTNode}
+		tree from them.
 
-	\item \textbf{sgflex}: The implementation of a \acrshort{sgf} lexer using PLY.\@ Takes
-		text input and generates the tokens of the \acrshort{sgf} language from them.
+	\item \textbf{sgflex}: The implementation of a \acrshort{sgf} lexer using
+		PLY.\@ Takes text input and generates the tokens of the \acrshort{sgf}
+		language from them.
 
-	\item \textbf{ASTNode}: The AST resulting from the parsing of a \acrshort{sgf} file.
-		Has a method to convert it to a tree of GameMove and so obtain the
-		contents of the \acrshort{sgf} in the internal representation used by the project's
-		systems.
+	\item \textbf{ASTNode}: The AST resulting from the parsing of a
+		\acrshort{sgf} file. Has a method to convert it to a tree of
+		\texttt{GameMove} and so obtain the contents of the \acrshort{sgf} in
+		the internal representation used by the project's systems.
 
-	\item \textbf{Property}: The representation of a property of an ASTNode
-		tree. Each property is made of a name and one or more values and this
-		class helps handling this specific situation.
+	\item \textbf{Property}: The representation of a property of an
+		\texttt{ASTNode} tree. Each property is made of a name and one or more
+		values and this class helps handling this specific situation.
 
 The training can be started with the executable \texttt{train.py}.
 
@@ -322,3 +326,7 @@ The training can be started with the executable \texttt{train.py}.
 %		\caption{Modules.}\label{fig:modules}
 %	\end{center}
 %\end{figure}
+
+%\subsection{Technical Testing Plan Specification}
+
+%TODO
-- 
cgit v1.2.1

