diff options
Diffstat (limited to 'doc/tex/implementation.tex')
-rw-r--r-- | doc/tex/implementation.tex | 181 |
1 files changed, 119 insertions, 62 deletions
diff --git a/doc/tex/implementation.tex b/doc/tex/implementation.tex index 9e42313..d46e805 100644 --- a/doc/tex/implementation.tex +++ b/doc/tex/implementation.tex @@ -1,64 +1,121 @@ \section{Implementation} -\subsection{Engine} - -An engine implementing GTP.\@ It is designed to be used by a software controller -but can also be directly run, mostly for debugging purposes. Its design is shown -in \fref{fig:engine} - -\begin{figure}[h] - \begin{center} - \includegraphics[width=\textwidth]{diagrams/gtpEngine.png} - \caption{Design of the GTP engine.}\label{fig:engine} - \end{center} -\end{figure} - -\subsection{Modules} - -One module to store the state of the game and the game tree. One module to parse -moves. One module to read and write SGF files. Modules are shown in -\fref{fig:modules}. - -\begin{figure}[h] - \begin{center} - \includegraphics[width=\textwidth]{diagrams/modules.png} - \caption{Modules.}\label{fig:modules} - \end{center} -\end{figure} - -\subsection{Representation of a match} - -Strictly said, a match is composed of a series of moves. But since game review -and variants exploration is an important part of Go learing, \program{} allows -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 state of the game must also be present so -liberties, captures and legality of moves can be addressed, so it is represented -with its own class, which holds a reference both to the game tree and the -current move. This classes and their relationship can be seen in -\fref{fig:gameRepresentation}. - -\begin{figure}[h] - \begin{center} - \includegraphics[width=0.7\textwidth]{diagrams/gameRepresentation.png} - \caption{A game is represented as a tree of moves.}\label{fig:gameRepresentation} - \end{center} -\end{figure} - -\subsection{SGF} - -To parse 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 GameTree. This is -done for the root node, since from the 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 komi. These components are -shown in \fref{fig:sgfModule}. - -\begin{figure}[h] - \begin{center} - \includegraphics[width=\textwidth]{diagrams/sgfModule.png} - \caption{Components of the SGF file parsing module.}\label{fig:sgfModule} - \end{center} -\end{figure} +\subsection{Development Hardware} + +The development and evaluation machine is a Satellite L50-C laptop. Its +specifications are shown as a list for readability. + +\begin{itemize} + \item \textbf{CPU}: Intel i5-6200U, 2.800GHz + \item \textbf{Integrated GPU}: Intel Skylake GT2 + \item \textbf{Dedicated GPU}: Nvidia Geforce 930M + \item \textbf{RAM}: 8 GiB +\end{itemize} + +\subsection{Development Software} + +The tools selected for the development of the project and the documentation are +listed and explained on this section. All the tools used are either +free\cite{fsf_free} or open source software. The development machine runs 64 +bits Arch Linux as its operating system. + +\subsubsection{Language} + +The programming language of choice is Python\cite{python}. The rationale behind +this decision has been stated on Section \ref{sec:programmingLanguage}. It also +allows easy use of the Keras library for implementing neural networks. + +Various python libraries have been used to easy the development process or +assist in the analysis of results. These are: + +\paragraph{Keras/Tensorflow\cite{keras}} + +Tensorflow is a platform for machine learning which provides a diverse range of +tools, one of which is a python library for machine learning. + +Keras is a high-level API for Tensorflow allowing for the easy definition of +neural networks. It permits easily testing and comparing different network +layouts. + +\paragraph{NumPy\cite{numpy}} + +A scientific package for python providing a lot of mathematical tools. The most +interesting for this project are its capabilities to create and transform +matrices. + +\paragraph{Matplotlib\cite{matplotlib}} + +A python library for creating graphs and other visualizations. It is used to +show the likelihood of moves the neural networks of the project create from a +board configuration. + +\paragraph{PLY\cite{ply}} + +A tool for generating compilers in Python. It is an implementation of the lex +and yacc utilities, allowing to create lexers and parsers. It is used in the +project to create the SGF parser which transform SGF files to internal +representations of Go matches. + +\paragraph{Other utility libraries} + +These are some utility libraries commonly used for frequent programming tasks: + +\begin{itemize} + \item \textbf{sys}: to stop the execution of the program or access system info such + as primitives maximum values. + \item \textbf{os}: to interact with files. + \item \textbf{re}: to check strings with regular expressions. + \item \textbf{random}: to get random values, for example to obtain a random + item from a list. + \item \textbf{copy}: to obtain deep copies of multidimensional arrays. +\end{itemize} + +\subsubsection{Development Tools} + +\paragraph{Neovim\cite{neovim}} + +A text editor based on Vim\cite{vim}, providing its same functionality with +useful additions and defaults for modern computers and terminal emulators. With +some extensions and configuration it can become a powerful development +environment with a very fluid usage experience. That, and the fact that the +developer considers Vim's modal editing the best writing experience possible on +a computer, have made Neovim the editor of choice. + +%TODO: Write about neovim extensions +%\begin{itemize} +% \item FZF +% \item Extensions +% +%\end{itemize} + +\subsubsection{Documentation Tools} + +\paragraph{\LaTeX\cite{latex}} + +A typesetting system widely used in the investigation field, among others. It +allows for documentation like this text to be written in plain text and then +compiled to PDF or other formats, which permits keeping the source files of the +documentation small and organized plus other benefits of plain text such as +being able to use version control. + +\paragraph{PlantUML\cite{puml}} + +A program which creates diagrams from plain text files. PlantUML supports syntax +for many different sorts of diagrams, mainly but not only UML. It has been used +to generate the diagrams used in this text. + +\paragraph{Make} + +A tool for specifying and handling dependencies on a build system. It reads a +file, typically named ``Makefile'', containing which files are needed and on +which other files each of them depends, and then generates those files or +updates them if they already exist but their source files are newer than them. + +It has been used to generate this text from \LaTeX{} and PlantUML source files. +The contents of the Makefile with which this document has been compiled are +shown in \flist{code:makefile}. + +\begin{listing}[h] + \inputminted{make}{Makefile} + \caption{Documentation Makefile}\label{code:makefile} +\end{listing} |