<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Formal language and reasoning for playing Go</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Arturo Yee Rendón</string-name>
          <email>ayee@computacion.cs.cinvestav.mx</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Matías Alvarado</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computing, Center of Research and Advanced Studies</institution>
          ,
          <country>Mexico D.F</country>
        </aff>
      </contrib-group>
      <fpage>125</fpage>
      <lpage>132</lpage>
      <abstract>
        <p>In this paper, we introduce a formal grammar for playing Go that fundaments an automated Go-player. Go-tactics such as eyes, ladders, mutual life and nets are properly modeled and tested. As well as Go-strategies to offensive or defensive purpose are introduced and their performance is tested throughout Go matches against humans or previous well-known automated Goplayers like GNUGo. Results and a comparison analysis are reported and discussed on the perspective of current state of the art on Go automation.</p>
      </abstract>
      <kwd-group>
        <kwd>Game Theory</kwd>
        <kwd>Go finite state machine</kwd>
        <kwd>strategic reasoning</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Originated more than 2,000 years ago, Go is a two-person perfect information game,
and is one of the most complex board games. Writing computer programs to play Go
is one of the grand challenges of Computational Intelligence nowadays. Each player’s
goal of the game is to control a larger area than the opponent’s one on the board; the
challenge for Go game automation is due to the simplicity of the pieces and rules to
play it, hence the way to achieve the most board area control is a very open
procedure, and the combinations for doing it have an exponential growth. Actually,
the Go’s search space of solutions is huger –very much– than the one of Chess [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>
        The Go game is played on a board shaped with 19 horizontal and vertical lines
commonly, see Figure 1, where alternating, each player places a stone of his own
color on an empty intersection on the board, with black playing first [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]; black player
takes the white stones and conversely. By following the each player’s goal to control
a larger board area than the opponent, one of the difficulties for both human and
computer Go players is to determine when a group of adversarial stones is possible to
capture, even the opponent makes any movement to save them. This situation is called
unconditional life, and its determination is crucial for intelligent play 1.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] the authors focus on evaluating non-final positions. In particular they deal
with the task of estimating potential territory in non-final positions, which is much
more difficult than determining territory in final positions. Prospective methods of
programming the Go game will probably are of interest in other domains as well [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ],
which goal is to present the links between existing studies on Computer Go and AI
related domains: evaluation function, heuristic search, machine learning, automatic
knowledge generation, mathematical morphology and cognitive science.
      </p>
      <p>
        Bounzy [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] build a cognitive model of human Go player called INDIGO, which
aims to play full Go games as well as possible. It reads low level concepts: ladders,
eyes and nets, see Figure 1. INDIGO recognizes territories as well as human players
do, with mathematical morphology tools.
      </p>
      <p>
        GNUGo is a free Go program that is able to play the Go games from board sizes of
5x5 to 19x19 [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. GNUGo is deterministic. In our study, we developed a
communication interface to test GNUGo with our simulator. The Smart Game File
(SGF) was proposed in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. This format is simple tree which it represents the plays of
player. SGF was originally designed for the exchange of Go records between humans
and not for spreading computer oriented expert knowledge. Our simulator saves a
game history of plays in SGF.
      </p>
      <p>Description of the paper, it begins with a brief introduction to the formal rules of
Go, in Section 2; we make a description of Go game simulator, in Section 3; the
experimental stage, in Section 4 and conclusion; Ending with a discussion about
future work.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Go game Description</title>
      <p>
        A Go game can be represented as a tree, with each node corresponding to a particular
board position. The root node is the position at the beginning of the game. The
children of each node are the positions reachable in one move. A strategy for a player
indicates how the player responds to any board position. A complete strategy for Go,
even on the 9x9 board, would be astronomically large. The disarming simplicity of
the rules of Go, however, conceals a formidable combinatorial complexity [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. On a
19 x 19 board, there is approximately 319 x 19 = 10172.24 possible board configuration
and, on average, on the order of 200 - 300 possible moves at each step of the game,
compared with chess, chess has a much smaller branching factor, on the order of 35 –
40.
      </p>
      <p>The player with the black stones is allowed to play first. It is only allowed to play
one stone at the time, which is placed on one of the empty intersections. A stone, once
played, is not to be moved unless if it is captured. If a stone or multiple stones of the
same color are surrounded by the other color, such that no direct adjacent intersection
is empty, and then the stone(s) is (are) captured. Adjacent empty intersections are also
referred to as liberties. A liberty is an empty point adjacent to a group of stone. Any
group that has no liberties is said to be dead and they have to be removed from board.
From the capturing rule for multiple stones it can be seen that stones are connected
which are positioned on directly neighboring intersections. Diagonal neighboring
intersections are not connected as there is no direct line between them. Stones which
are connected are also called a chain –a single stone is also a chain. The goal of the
game is to control as much territory as possible. The player who has the largest
territory at the end of the game is the winner.</p>
      <p>
        The tactics in Go game are local conditions to deal with immediate fighting
between stones [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], some tactics are describing next:
• An Atari is simple move to reduce the number of liberties.
• A ladder is a sequence of Atari to force the opponent into zigzag pattern and
eventually the stones of enemy could be captured.
• A net is sequence moves that loosely surround some stones, preventing their
escape in all directions, taking their liberties of enemy stones directly capture
more easily on successive plays.
      </p>
      <p>
        The strategies deal with global influence [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], calculating on the overall
composition of the board and division of territory, and taking into account the
influence of the stones on each intersection and given a tactical priority. Some
strategies are listing.
• Mutual life happens when no player can play to a particular point without allowing
the other player to play at another point to capture.
• Death is when stone(s) lacks living shape, meaning less than two eyes, and will
eventually be removed from the board as captured.
• Invasion occurs when put a new living group inside an area where the opponent
has greater influence.
• Reduction occurs when a player put a stone far enough into the opponent's area of
influence to reduce the amount of territory.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Go Formal Modeling</title>
      <p>In the next diagram and table, we show how the simulator works. In Figure 2
describes the process flow in the algorithm and in Table 1 the algorithm steps.
1. Initializes the board
2. Player makes a move
3. If the move is possible go to step 5, otherwise go to step 4
4. Pass go to step 7
5. Put stone
6. Change turn go to step 2
7. If both players pass go to step 8
8. Calculate the scores and end game</p>
      <p>Go Formal grammar. For the Go game, we proposed a simple formal grammar to
help us to develop a Go game simulator and it is the following:
• V is the alphabet (terminals and non-terminals symbols).
• ∑ ⊆ V is the set of terminals.
• B ∈V - ∑ is the initial symbol.
• V - ∑, the set of non-terminal elements.
• R ⊆ (V - ∑) × V* is the set of rules.</p>
      <sec id="sec-3-1">
        <title>Terminal symbols:</title>
        <p>∑ = {play (player, x, y, t)}, where
• player є {black, white}, x є {0… 18}, y є {0…18}
• t is the tactics/strategies to apply.
• end is the end of game.</p>
        <p>Non-terminal symbols:
• G is the initial symbol.
• J is the play.
• T is the position played.
• Pass-black is when a player black pass.
• Pass-white is when a player white pass.</p>
      </sec>
      <sec id="sec-3-2">
        <title>The set of rules:</title>
        <p>• G → J.
• J → T | Pass-black Pass-white end | Pass-white Pass-black end | Pass-black T |</p>
        <p>Pass-white T.
• T → play (player, x, y, t).</p>
        <p>The Go game simulator is in Java and uses a graphic interfaces human – computer.
Simulator is a heuristic method based on a formal grammar having a degree of
variability by execution, sometimes giving an optimal result.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Experimental Results</title>
      <p>In this section, we present some experiments of simulator, when each player plays
with others; the experiments are the following: 1) random player (RP) vs. RP, 2) RP
vs. smart player (SP), 3) RP vs. GnuGo player (GP), 4) SP vs. SP and 5) SP vs. GP.
Nowadays thirty tests per experiment were made hence certain confidence was
got. Additional more exhaustive tests will be made.</p>
      <p>This paper has explored the diversity of tactics and strategies in the game of Go.
We developed a simulator which is capable of playing competitive with the most
traditional and powerful simulator of Go. From results is showed that when RP played
with RP, both won at the same percentage, see Table 2; when RP played with SP,
there was a clearly advantage to favor of SP, see Table 3; when RP played with GP,
the first won more times than GP, see Table 4; when SP played with SP, both won at
the same percentage, see Table 5; when SP played with GP, the SP won more times
than GP did, see Table 6. We tested our simulator with GP and obtained a huge
advantage to our simulator.</p>
      <p>Random (black) Random (white)
1
2
3
28
29
30</p>
      <p>Random
player
(black)
55
46
48</p>
      <p>Random (black) Smart (white)
Random (black) Gnu-go (white)</p>
      <p>Smart (black) Smart (white)
1
2
3</p>
      <p>Smart (black) Gnu-go (white)</p>
      <p>Conclusion: A formal grammar for modeling the Go game is introduced; the flow
diagram and context-free grammar fundament the automated Go player algorithms.
The deployed Go player mostly beat the well-known GnuGo, as well as to humans Go
medium level of expertise or other automated Go players. The reason of the
advantage is due to the application of offensive, territorial and defensive strategies
introduced. The algorithmic implementation of these strategies, it supports the agile
response by our automated Go player during the matches. Further test are required to
assess the automated Go player performance.</p>
      <p>Ongoing work: The introduction of artificial neural network (NN) for patterns
recognition allow acquire more information about the state of board game and what
the enemy is doing. By segmenting the board game into 3 x 3 and 5 x 5 windows
allows detect eyes, ladders, and net patterns. NN usage improves offensive/defensive
tactics and strategies application for playing Go game. Moreover, for learning on the
usage of tactics and strategies, given specific game circumstances. Formal grammar
models the moves of the player and whole Go game, but still lacking for represent
specific tactics and strategies, what we are working on.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>D. B.</given-names>
            <surname>Benson</surname>
          </string-name>
          .:
          <article-title>Life in the game of Go</article-title>
          .:
          <source>J. Information Sciences</source>
          ,
          <volume>10</volume>
          (
          <issue>2</issue>
          ),
          <fpage>17</fpage>
          -
          <lpage>29</lpage>
          , (
          <year>1976</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>K.</given-names>
            <surname>Chen</surname>
          </string-name>
          and
          <string-name>
            <given-names>Z.</given-names>
            <surname>Chen</surname>
          </string-name>
          .:
          <article-title>Static analysis of life and death in the game of Go</article-title>
          .
          <source>J. Information Sciences</source>
          ,
          <volume>121</volume>
          (
          <issue>1-2</issue>
          ),
          <fpage>133</fpage>
          -
          <lpage>134</lpage>
          , (
          <year>1999</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>M.</given-names>
            <surname>Muller</surname>
          </string-name>
          .: Computer Go.
          <source>J. Artificial Intelligence</source>
          ,
          <volume>134</volume>
          (
          <issue>1-2</issue>
          ),
          <fpage>145</fpage>
          -
          <lpage>179</lpage>
          , (
          <year>2002</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. E.
          <string-name>
            <surname>C.D van der Werf</surname>
          </string-name>
          , H.J. van den Herik and Uiterwijk.:
          <article-title>Learning to estimate potential territory in the game of</article-title>
          <source>Go. Lecture Note in Computer Science</source>
          ,
          <volume>3846</volume>
          ,
          <fpage>81</fpage>
          -
          <lpage>96</lpage>
          , (
          <year>2006</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>B.</given-names>
            <surname>Bouzy</surname>
          </string-name>
          and
          <string-name>
            <given-names>T.</given-names>
            <surname>Cazenave</surname>
          </string-name>
          .:
          <article-title>Computer go: An AI oriented survey</article-title>
          .
          <source>J. Artificial Intelligence</source>
          ,
          <volume>132</volume>
          (
          <issue>1</issue>
          ),
          <fpage>39</fpage>
          -
          <lpage>103</lpage>
          , (
          <year>2001</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>6. GnuGo. http://www.gnu.org/software/gnugo/gnugo_toc.html</mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>E.</given-names>
            <surname>Berlekamp</surname>
          </string-name>
          and
          <string-name>
            <given-names>D.</given-names>
            <surname>Wolfe</surname>
          </string-name>
          .:
          <article-title>Mathematical Go-Chilling gets the last point</article-title>
          . Wellesley, MA: A
          <string-name>
            <surname>K Peters</surname>
          </string-name>
          , (
          <year>1994</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>B.</given-names>
            <surname>Bouzy</surname>
          </string-name>
          .:
          <article-title>The INDIGO program</article-title>
          .
          <source>Proc. Of the 2nd Programming Workshop in Japan</source>
          ,
          <volume>192</volume>
          -
          <fpage>200</fpage>
          , (
          <year>1995</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>Y.</given-names>
            <surname>Nagahara</surname>
          </string-name>
          .: Strategic Concepts of Go, Ishi Press, (
          <year>1972</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>