diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2021-06-12 10:58:21 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2021-06-12 10:58:21 +0200 |
commit | 4a39a8fd07e49db5feb0c403b784423f0b673f97 (patch) | |
tree | ad53281fbd275b278445f0d28195040102943d39 /doc | |
parent | e8a3007e25c32ed8014b5e524849dfb38e9bef13 (diff) | |
download | imago-4a39a8fd07e49db5feb0c403b784423f0b673f97.tar.gz imago-4a39a8fd07e49db5feb0c403b784423f0b673f97.zip |
First MonteCarlo match simulations.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/diagrams/GameBoard.pumlc | 28 | ||||
-rw-r--r-- | doc/diagrams/GameMove.pumlc | 20 | ||||
-rw-r--r-- | doc/diagrams/GameState.pumlc | 16 | ||||
-rw-r--r-- | doc/diagrams/GameTree.pumlc | 4 | ||||
-rw-r--r-- | doc/diagrams/gameRepresentation.puml | 9 | ||||
-rw-r--r-- | doc/diagrams/gtpEngine.puml | 15 | ||||
-rw-r--r-- | doc/tex/implementation.tex | 34 | ||||
-rw-r--r-- | doc/tex/previousWorks.tex | 15 | ||||
-rw-r--r-- | doc/tex/tfg.tex | 4 |
9 files changed, 107 insertions, 38 deletions
diff --git a/doc/diagrams/GameBoard.pumlc b/doc/diagrams/GameBoard.pumlc new file mode 100644 index 0000000..7a57b2d --- /dev/null +++ b/doc/diagrams/GameBoard.pumlc @@ -0,0 +1,28 @@ +@startuml + +class GameBoard { + int[][] board + int capturesBlack + int capturesWhite + + getBoard(self) + getBoardHeight(self) + getBoardWidth(self) + getDeepCopy(self) + getGroupLiberties(self, row, col) + getGroupLibertiesCount(self, row, col) + getGroupCells(self, row, col) + getGroupCellsCount(self, row, col) + moveAndCapture(self, row, col, player) + isMoveInBoardBounds(self, row, col) + isCellEmpty(self, row, col) + isCellEye(self, row, col) + isMoveSuicidal(self, row, col, player) + isMoveKoIllegal(self, row, col, player, prevBoards) + isPlayable(self, row, col, player, prevBoards) + score(self) + equals(self, otherBoard) + printBoard(self) +} + +@enduml diff --git a/doc/diagrams/GameMove.pumlc b/doc/diagrams/GameMove.pumlc index 7dcb5e3..0f75edd 100644 --- a/doc/diagrams/GameMove.pumlc +++ b/doc/diagrams/GameMove.pumlc @@ -1,13 +1,23 @@ @startuml class GameMove { - int player - int row - int col - int[2] makesKo - int[] board + GameBoard board GameMove[] nextMoves GameMove previousMove + boolean isPass + int[2] coords + + getRow(self) + getCol(self) + getPlayer(self) + getNextPlayer(self) + getGameLength(self) + getThisAndPrevBoards(self) + getPlayableVertices(self) + addMove(self, row, col) + addMoveForPlayer(self, row, col, player) + addPass(self) + printBoard(self) } @enduml diff --git a/doc/diagrams/GameState.pumlc b/doc/diagrams/GameState.pumlc index db39d8f..38e1397 100644 --- a/doc/diagrams/GameState.pumlc +++ b/doc/diagrams/GameState.pumlc @@ -1,14 +1,18 @@ @startuml class GameState { - int player - int capturesBlack - int capturesWhite - List board - List prevBoards # for ko + int size GameTree gameTree GameMove lastMove - GameData gameData + 'GameData gameData + + getCurrentPlayer(self) + getPlayerCode(self) + getBoard(self) + playMove(self, row, col) + playMoveForPlayer(self, row, col, player) + playPass(self) + undo(self) } @enduml diff --git a/doc/diagrams/GameTree.pumlc b/doc/diagrams/GameTree.pumlc index 85859d8..10b9251 100644 --- a/doc/diagrams/GameTree.pumlc +++ b/doc/diagrams/GameTree.pumlc @@ -1,8 +1,8 @@ @startuml class GameTree { - GameNode[] firstMoves - GameData gameData + GameMove[] firstMoves + 'GameData gameData } @enduml diff --git a/doc/diagrams/gameRepresentation.puml b/doc/diagrams/gameRepresentation.puml index 9a869f1..db5d5a5 100644 --- a/doc/diagrams/gameRepresentation.puml +++ b/doc/diagrams/gameRepresentation.puml @@ -5,10 +5,13 @@ !include GameState.pumlc !include GameTree.pumlc !include GameMove.pumlc +!include GameBoard.pumlc -GameState --> GameTree -GameState --> GameMove: Current move +GameState -> GameTree +GameState --> GameMove: Last move GameTree *--> GameMove -GameMove -> GameMove +GameMove --> GameMove: Previous move +GameMove *--> GameMove: Next moves +GameBoard <- GameMove @enduml diff --git a/doc/diagrams/gtpEngine.puml b/doc/diagrams/gtpEngine.puml index c4caf32..5b098da 100644 --- a/doc/diagrams/gtpEngine.puml +++ b/doc/diagrams/gtpEngine.puml @@ -2,13 +2,20 @@ !include skinparams.puml -class EngineCore { -} - class IO { processComand() } +class EngineCore { + setBoardsize() + clearBoard() + setKomi() + setFixedHandicap() + play() + genmove() + undo() +} + !include GameState.pumlc 'class EngineBoard { @@ -22,7 +29,7 @@ class EngineAI { genmove(board) } -EngineCore --> IO +IO --> EngineCore EngineCore --> GameState EngineCore --> EngineAI diff --git a/doc/tex/implementation.tex b/doc/tex/implementation.tex index 9e42313..28fd0ec 100644 --- a/doc/tex/implementation.tex +++ b/doc/tex/implementation.tex @@ -2,9 +2,23 @@ \subsection{Engine} -An engine implementing GTP.\@ It is designed to be used by a software controller +An implementation of GTP, that is, the piece of software which offers the GTP +interface to other applications.\@ 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} +in \fref{fig:engine}. The core of the engine is related with three components, +each with a separate responsibility: + +\begin{itemize} + \item The IO component is the one called from other applications and offers + the text interface. It reads and processes input and calls corresponding + commands from the core of the engine. + \item The EngineBoard component stores the state of the match, recording + information such as the history of boards positions and whose turn goes + next. The engine core uses it for these state-storing purposes. + \item The EngineAI 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} \begin{figure}[h] \begin{center} @@ -28,14 +42,16 @@ moves. One module to read and write SGF files. Modules are shown in \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 +A regular Go match is composed of a list of moves. But since game review and +variants exploration is an important part of Go learning, \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 +represented as a tree of moves. The state of the board at any given move must +also be stored so liberties, captures count 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. Moves depend on a representation of the +game board to have access to its current layout and count of captured stones. +These classes and their relationships can be seen in \fref{fig:gameRepresentation}. \begin{figure}[h] diff --git a/doc/tex/previousWorks.tex b/doc/tex/previousWorks.tex index 6ba5dce..6e503a3 100644 --- a/doc/tex/previousWorks.tex +++ b/doc/tex/previousWorks.tex @@ -2,12 +2,13 @@ \subsection{SGF} -SGF (\textit{Smart Go Format} or \textit{Smart Game Format}) is a text file -format specification for records of games or even collections of them. It was -devised for Go but it supports other games with similar turns structure. It -supports move variations, annotations, setups and game metadata. By supporting -SGF, our application can be used to analyse existing games registered by other -applications, such as those played on online Go servers. +SGF (\textit{Smart Go Format} or, in a more general context, \textit{Smart Game +Format}) is a text file format specification for records of games or collections +of them. It was devised for Go but it supports other games with similar +turn-based structure. It supports move variations, annotations, setups and game +metadata. By supporting SGF our application can be used to analyse existing +games registered by other applications, such as those played on online Go +servers. The SGF specification can be found at \url{https://www.red-bean.com/sgf/user_guide/index.html} @@ -17,5 +18,5 @@ The SGF specification can be found at GTP (\textit{Go Text Protocol}) is a text based protocol for communication with computer go programs. [ref https://www.lysator.liu.se/~gunnar/gtp/] It is the protocol used by GNU Go and the more modern and powerful KataGo. By supporting -GTP, our application can be used with existing GUIs and other programs, making +GTP our application can be used with existing GUIs and other programs, making it easier to use it with the tools users are already familiar with. diff --git a/doc/tex/tfg.tex b/doc/tex/tfg.tex index 9248748..a14708d 100644 --- a/doc/tex/tfg.tex +++ b/doc/tex/tfg.tex @@ -23,7 +23,7 @@ %\renewcommand{\contentsname}{Contenidos} %\renewcommand{\figurename}{Figura} -\newcommand{\program}{Go-AI} +\newcommand{\program}{Imago} \newcommand{\inputtex}[1]{\input{tex/#1}} \newcommand{\fref}[1]{Fig.~\ref{#1}} @@ -33,7 +33,7 @@ \frenchspacing -\title{\program} +\title{\program: An AI capable of playing the game of Go} \author{Íñigo Gutiérrez Fernández} |