Department of Electronic Engineering Bachelor of Engineering (Honours) in Information Engineering

advertisement
Department of Electronic Engineering
FINAL YEAR PROJECT REPORT
BEIE-2004/05-CS/HWC-08
< Ladder-Breaker and New Territory Formation in Computer
Go Game >
Student Name: LEUNG Man Wah
Student ID: 50400359
Supervisor: Dr. Hon Wai CHUN
Assessor: Dr. Lai Man PO
Bachelor of Engineering (Honours) in
Information Engineering
1
Student Final Year Project Declaration
I have read the student handbook and I understand the meaning of academic dishonesty, in
particular plagiarism and collusion. I declare that the work submitted for the final year project
does not involve academic dishonesty. I give permission for my final year project work to be
electronically scanned and if found to involve academic dishonesty, I am aware of the
consequences as stated in the Student Handbook.
Project Title : Ladder-Breaker
New Territory
Computer Go Game
and
Formation in
Student Name : LEUNG Man Wah
Student ID: 50400359
Signature
Date : 20-4-2005
Table of Content
2
Abstract ………………………………………………………………………….. 3
Acknowledgment ………………………………………………..………………... 4
Introduction ……………………………………………………….……………… 6
Objective ………………………………………………………………………… 8
Scope of the project ……………………………………………………….... 8
Critique of the background literature ………………………………………………. 9
Ladder ………………………………………………………….…………… 9
Ladder breaker …………………………………………………………….. 11
Test on downloaded soft wares …………………………………………….. 13
Influence function ……………………………………………………..…………..15
Consideration of problems in Go Game …………………………………………...19
The connectivity problem ……………………………………………………19
The “cross” problem ………………………………………………………...21
The definition problem ……………………………………………………. ..22
The handicapped problem …………………………………………………. 23
The research area ……………………………………………………………….. 24
The ladder cases ………………………………………………………...…24
New territory cases ……………………………………………………...... 26
Result calculation …………………………………………………………………27
Value alternation ………………………………………………………………….29
Algorithm …………………………………………………………………………34
System design …………………………………………………………………….35
User interface ………………………………………………………………...…..38
File format and style …………………………………………………………..…41
Result comparison and analysis …………………………………………………..43
The data set ………………………………………………………….…...44
3
Simulation cases ……………………………………………………..……45
Conclusion on simulation …………………………………………………. 47
Comparison with downloaded software ……………………………………54
Discussion ……………………………………………………………….……....56
Project experience …………………………………………………….…………57
Project extension …………………………………………………….…………..59
Resource ……………………………………………………………………….. 60
Abstract
4
The traditional AI search method is not suitable for Computer "Go". It is because the possibility
of each step of each side of the game is too large. The lack of memory space for storing the
possibility of each step becomes a huge problem for AI algorithm of Computer Go. As a result,
there still doesn't have a complete algorithm for Computer Go.
There is a heuristic method called "influence function" which is used for calculating the
influence of the unit (stones in Computer "Go") so that the temporary influence ability of the
unit can be referenced. This method is constantly adopted in Computer Go for getting the
influence ability of each step.
In this project, "influence function" will be used for finding the result for solving the problem
"ladder" which is an attack method for capturing opponent stones in Computer Go. It is
because for solving the ladder, there are simply two methods, namely, "ladder breaker" or
simply giving up the enclosed stones. The simulation is to find out which method is best for
solving ladder and when is the best time to perform it.
Acknowledgment
5
I would like to thank you my supervisor, Dr. Andy Chun. At the beginning of the
project, I totally lost my way and did nothing on this final year project. With the fully
support and suggestion on the FYP from Dr. Chun, I can deal with and solve all the
problems faced during completing the FYP.
Moreover, I would like to send my fully thanks to Julian Wong, who was the FYP student
under Dr. Andy Chun in 2004. He gave me many friendly advices on my project and where I
can find the useful information and how to manage the information got from others. And he
shared his own experience on his FYP, which gave me much confidence on finishing my final
year project.
Lastly, I would like to thank you for the help of my classmates and friends. Furthermore, I
thank you my parents a lot for giving me a plenty of support and love. They all support me a
lot when I face problems on the project and I feel upset.
Introduction:
Influence function is technique to estimate the influence values of the stones of the
own sides and at the same time compared to the opponent side. It is because influence
6
function can show the actual values of a stone with its neighbor stones so that the
player can easily understand the influence of the stones already in the board and
therefore, he can consider next steps more accurately. The reason why choosing ladder
is that the ladder is always commonly found in the game “Go” and is easily found in
the early stage of the game. Ladder is the repeated structure for capture opponent’s
stone. If the player continues to escape from the ladder by just placing the stones in the
ladder, the player’s stones will finally completely captured and lose a plenty of
territory. Enabling to handle ladder will affect deeply result of the game. [2]
At the beginning of the game, there are plenty of blank territories for the players to
compete. Therefore, when the player is under the ladder situation, the player can have
a choice to give up the stones in the ladder and perform a new territory. The research
will focus mainly on the beginning of the game (there is no other stones in the game
except the ladder). The results will be enclosed for ladder-breakers and new territory
problem. It makes the results more clear and direct.
The board size focused is 13 x 13. It is because the board size should not be too small;
otherwise, the influence values of the stones in the new territory will be affecting the
ladder. The result should have a clear separation so that the results from simulation
will be more accurate.
Moreover, by using the program, the performance and results after starting the new
territory will be recorded. When the ladder breaker is performed, the stones in the
ladder would be saved and the game would become much more complicated. By
comparing the results of gain in starting new territory and the loss in ladder is the best
7
technique to understand the relationship between ladder-breaker and starting new
territory.
Objective:
To find out when facing a ladder, perform a ladder-breaker to save back the own
stones or just give up stones and start for competing other territory.
8
Scope of the project:
The main scope of the project is to find the most suitable algorithm to simulate
whether starting the new territory or performing the ladder breaker. And also, finding
out different cases for starting new territory as much as possible is also important for
the project. It will make the project more accurate.
The three main points of the scopes are the following:
(1)
To write a program as a platform to test the case
(2)
To find out the cases for simulation
(3)
To find out the result whether ladder-breaker or new territory is better.
Critique of the background literature:
Here will introduce some of the important Go Game turns, which is used for
enhancing the understanding of the project and get more concrete idea about the Go
Game.
9
“Ladder”
The ladder is kind of situation that the whole group of the stones have only one liberty
(the diagram below); as a result the white stones have to escape from the attack from
the opponent. [4]
The white stone is surrounded and is going to be captured by the black stones. (Fig. 1)
In this situation, as long as white stones would like to save it, putting the stones near
the white stone is the only solution.
Fig. 1
However, it is just a temporary escape. It is because the black stones will increase the
pressure by decreasing the liberty of the white stones back to one. As a result, the
situation will be repeated to the side of the game board (Fig. 2)
10
Fig. 2
The white stones will eventually captured by black stones.
“Ladder breaker”
“Ladder breaker” is the technique which is used for preventing the ladder from
forming. As mentioned above, once the stones are under the ladder, it is impossible for
those stones to escape from being captured. The only method is to prevent the ladder
11
from forming. Fig. 3 shows that position “c” is one of the positions of ladder breaker
when it is under the one-stone ladder. When there is a white stone on position “c”, the
ladder will be broken. The white stones would be saved if the white stones are put
appropriately.
Fig. 3
Ladder breaker is not just a position on the game board. Position “c” in Fig.3 is just
one example of ladder breaker in that situation. In fact, ladder breaker is a big area in
which all positions are unoccupied on the game board. Fig. 4 shows another example
for the one-stone ladder. As shown in the Fig. 4, the red positions are the position of
ladder breaker. Once there is a black stone on any one of the red positions. The ladder
is unable to form.
Fig. 4
12
However, position “a”, “b” and “c” are not the positions of ladder breaker. The black
stone with the red circle in Fig. 5 is the position “a” in Fig. 4. It obviously shows that
the black stone with the red circle can’t save its black stones below and all black
stones would eventually be captured as long as the white stone is put on position “d”.
Fig. 5
Test on downloaded soft wares:
Ladder is a common case in the Go game. It is important to understand that the
computer go game soft wares would perform the ladder breaker or starting the new
territory when facing the ladder cases.
In the web, there are many Go playing program is free for downloading. However, the
programs downloaded trends to perform the ladder-breakers to save back its stones
rather than open a new territory.
13
One of the simulated results by using GNU Go:
Fig. 6
Another simulated result by using WinHonte [6]
Fig. 7
14
Under the simply simulation, the above 2 figures shows that the saving the stones form
being captured is more important than starting the new territory. It can appeal that
ladder breaker is worth performing, rather than starting the new territory.
However, it should not be the conclusion on this situation of starting new territory or
performing the ladder breaker. As a result, I would like to find out the solution about it.
Influence function:
In different cases, there are different methods to set up the influence functions of the
stones. The influence functions should be set in different form of heuristic algorithm
which is suitable for the whole program of the Computer Go.
There are two influence functions are found for calculating the estimated territory
values.
The first influence function [1], [3] which used to calculate the influence values is
shown below.
The influence of the stone (st) to a point (pt) is:
Inf(st,pt) = m * f (d(st,pt) -1)
15
Where
m, the maximum value = 64,
f , the decay factor = 0.5,
d , the difference between st and pt in unoccupied points
inf < 1 was ignored (i.e. d(st,pt) > 7 was ignored).
The second one is found from the GNU Go documentation (9), the influence function
for calculating the influence values is like that:
XXXXXXXO
X.OOOOXO
X.0oo000
------------
With the help of diagram, the influence value is:
The ‘0’ string would thus have effective size 6 (number of stones) + 2 (interior eye) +
2*0.5 (the two empty vertices to the left of the string, split half each with the
16
surrounding X string) + 1*0.33 (the connection point, split between three strings) =
9.33
However, the influence function of GUN Go is not so suitable for this research. It is
because its influence function is mainly focused on the small part of territory and more
suitable for the complexed territory competing. The function there is worth utilizing at
the middle or near the end of the game. The blank territory is too large at the
beginning and it is not so good that regarding the whole game board is one big
territory. And it becomes meaningless if there is a too big blank unoccupied area on
the game board which is counted as the estimated territory.
Under this consideration, the first function is used because that influence function is
more suitable for finding the territory values in the beginning of the game board and it
will be more accurate if this function is used under the big blank unoccupied area on
the game board.
Moreover, influence values of the stones should not be too large and the influence
distance should not be too far away. It is because the influence values can highly
represent the influence of the stones as long as the influence values are almost the
same number of the estimate territory they can get. And it can deduce the work of
normalization since the over estimate the power of the stones can be removed. As a far
influence distance is concerned, at the beginning, the stones can enclose their own
territory easily because there are many places for competing. With the increase of
stones in the game board, the influence distance will be shortened because of the lack
of the free territory and there are full of stones around each others. On the other hand,
17
the game board for this research is downscaled to 13 x 13. The influence values would
be over-estimate if the influence distance is too far away. As a result, the influence
values of the stones should not be too large and the influence distance should not be
too far away. [8]
The influence function, as a result, is modified as follows.
The influence of the stone (st) to a point (pt) is:
Inf(st,pt) = m * f (d(st,pt) -1)
Where
m, the maximum value = 16,
f , the decay factor = 0.5,
d , the difference between st and pt in unoccupied points
inf < 1 was ignored (i.e. d(st,pt) > 5 was ignored).
The reason why the influence function is set as above is that the influence of the
stones should be directly added to each other at beginning of the game. There is none
of complex territory competition of stones of both sides and the free territory is too
large for calculation.
18
Consideration of problems in Go Game:
Some of the definition problems found in Go Game are just a small part in the game. It
is also the basic issues for the professionals to think over before the game has started.
However, those simple problems would affect a lot in the project because the
influence function, which would show the exact values about the stones, is required
the clear and direct factors to give out the accurate values. As a result, every small
problems should also be deeply considered and seek for the exact influence ability on
the influence function.
The following are the problems which would affect the influence values shown in the
game board:
The connectivity problem [1]:
19
fig. 8
fig. 9
We can obviously see that the connection of the stones in fig. 8 is much stronger than
that in fig. 9. It is because if there are white stones put on the positions of a line with
the number 1, 2, and 3 in the fig. 9, the connection of the black stones would be
broken. However, in the fig. 8, the connected stones will have higher ability to obtain
the new territory and defend the attack from the white stones. Comparing the influence
values obtained in the above diagrams with the influence function, and taking one of
the stones as a reference, we can get the equations:
For the fig. 4, { let x be d(st,pt)-1 }
Inf(st,pt) = 16 * (1/2) X + 16 * (1/2) X + 1
For the fig. 5,
Inf(st,pt) = 16 * (1/2) X + 16 * (1/2) X + 2
x = 0, 1, 2,3,4,5
After putting x = 0,
The difference of above equation becomes
16 * (1/2)
1
- 16 * (1/2) 2
= 8–4
= 4
This influence value is under the consideration of the nearest positions around the
connected and separated two stones.
20
The difference of the influence values with the two situations (the nearest blank
position next to the stones) is 4. It shows that the ability of “solid connection” (fig. 4)
is about 4 values stronger than “one-point jump” (fig. 5). In contrast, the “solid
connection” withstanding the attack from opponent stones is 4 values stronger than
“one-point jump”. As a result, for every two-stone solid connection, additional 4
values would be added to the influence values of these stones.
The “Cross” Problem:
Fig. 10
fig. 11
The “cross” problem is that when the stone surrounded by four other own stones have
no influence ability
The influence ability of the stones in fig. 10 should be the same as that of the stones in
the fig. 11. Except the cases that one of the stones in the fig. 11 is under the risk of
being captured by opponent stones, the influence ability is the same as stones in fig. 10.
As a result, the original influence values and additional values from the connection
with the centered stone will be omitted. Once the “cross” situation is checked on the
game board, the influence values of stones in fig.10 will be the same as the stones in
fig. 11.
21
The definition problem:
With the help of fig. 1 and fig. 2, it obviously shows that the ladder is performed as
two diagonal lines beginning from the enclosed white stones. The ladder breaker can
be set in between these two diagonal lines so that the white stones will not be captured.
On the right top corner, they are the positions for both the new territory and ladder
breaker. In every case, the new territory started at right top corner would get the
influence values from starting new territory and at the same time, would prevent the
own stones from being captured. In the real situation, the opponent understands that
the positions on the right top corner is the positions for the ladder breaker and
therefore, stop the ladder to reduce the loss of its own stones. Once the ladder is
stopped, it is out of the area of consideration of if the starting the new territory or
performing ladder breaker. As a result, the above situation is defined as starting the
new territory but not ladder breaker.
22
The handicapped problem:
In a “Computer Go” game, the black stones will be handicapped with several numbers
of stones because black stones get advantages from putting the first stone on the game
board. In different countries or areas, the number of handicapped stones is different. In
the Go game in Japan, the handicapped stones are in a range of 5.5 – 6.5. In some
competition in China, the number of handicapped stones would be up to 8.5. In this
project, the game board is set to 13 x 13 which is smaller than the original game board.
The handicapped stones should not be too many because the territory competition on a
small game board is more vigorous than that on the original game board. As a result,
the handicapped stones are set to 5.5 for this reason.
23
The research area:
The research area is mainly concerned about where the ladder cases and new
territories start on the game board. The positions where the cases start will fully affect
the strategies for next stones and for the whole game. The area should be set that both
sides can get as much advantages as possible.
Ladder cases:
It is commonly that the starting stones are komoku 3-4, hoshi 4-4, sansan 3-3 or the
places around those positions. In fig. 12, the red rectangle is the area of sansan 3-3,
komoku 3-4 and hoshi 4-4. The solid blue position is sansan 3-3. In fig. 12, the
horizontal symbols are changed to A, B, C…… It is convenient for pointing the exact
position on the game board. The confusion of 7-6 or 6-7 would be ignored.
24
Fig. 12
The ladder will also be performed near those positions. On the other hand, the
direction of the ladder would also be in all four directions and there would be 4
diagonal lines. Since the game board is a square board and therefore, I will concentrate
the research in the left bottom corner. The result would be the same if the research
started at any other corners. As a result, the ladder cases in the project are sansan 3-3
which is the left bottom corner on the game board.
25
New territory cases:
Fig. 13
Besides, the new territory area will be the three other corners and two whole lines
between those three corners. The position areas are shown as the red rectangles in fig.
13. The positions are the most common area for the opponent stones starting the new
territory if the left bottom corner is occupied by the black stones. If the stones are
26
more and more for starting the new territory, the stones will put on the lines between
those three corners.
However, with the reason that the game board is diminished to 13 x 13, the starting
area will mainly focus on the right top corner and may further the area when necessary.
Results calculation:
It is necessary to have an algorithm to determine the territory got from the stones so
as to estimate the result of the research.
At first, divide the game board into 4 equal big pieces from the “tengen”. It is because
the basic rule of the Go Game is that the territory values are counted when the blank
area is surrounded by the stones of one side. With the two walls near the corners, it is
the easiest for the stones to surround the blank area. The professionals also regard it as
the most suitable method and always start the game near the corners. And also they
will try to form the territory in the corners as their first thinking.
27
Fig. 14
In each of the pieces of territories, the influence values are larger or equal to 16+8 =
24 (smaller or equal to - 24 for the opponent side) is regarded that the territory is
owned by the player. In fig. 14, it is the simplest form of stones which can get the
temporary territory values. From the influence function map above, 24 is the least
value that the two connected stones should earn at least one territory value. The stones
are connected so that the influence values will be accumulated more and more. If there
are no opponents’ stones affecting the territory, at least of two connected stones can
obtain small parts of the territories.
However, the influence values which must be faced the corners or the edges of the
game board are courted as the territories got. It is because the area for the values faced
the “tengen” to form is too large and it is impossible to form the significant territory
area in the beginning of the game.
28
Value alternation:
It is the game board with totally four stones. The X represents Black in color and O is
on behalf of the White color. The black stones are now in connection. However, the
white stones are put separately.
a
13
12
11
10
9
8
7
6
5
4
3
2
1
b c
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
a b
d e
. .
. .
. X
. X
. .
. .
. +
. .
. .
. +
. .
. .
. .
c d
f g h i j k mn
. . . . . . . . . 13
. . . . . . . . . 12
. . . . . . . . . 11
. . + . . + . . . 10
. . . . . . . . . 9
. . . . . . . . . 8
. . + . . + . . . 7
. . . . . . . . . 6
. . . . . . . . . 5
. . + . . . . . . 4
. . . . . O . O . 3
. . . . . . . . . 2
. . . . . . . . . 1
e f g h i j k mn
29
With the above case, the influence values will be:
13
12
11
10
9
8
7
6
5
4
3
2
1
A
5
7
10
10
7
5
A
B
7
10
16
16
10
7
5
B
C
10
16
28
28
16
10
7
5
C
D
16
24
X
X
24
16
10
7
5
+
D
E
10
16
28
28
16
10
7
5
F
7
10
16
16
10
7
5
1
1
2
1
E
F
G
5
7
10
10
7
5
+
1
2
5
2
1
G
H
J
K
L
M
N
13
5
12
7 5
11
7 5 +
10
5
9
1
1
8
1 2 2 2 1 7
1 2 5 4 5 2 6
2 5 10 8 10 5 5
5 10 20 16 20 10 4
10 20 O 32 O 20 3
5 10 20 16 20 10 2
2 5 10 8 10 5 1
H J
K L M N
The influence values around “O” should be negative!!
The influence values of the “X” and “O” are shown above. The “X” side has a
connection; as a result, there is an extra 4 values which are added to the accumulated
values!
The estimated territory values “X” got are 3. It is because we would only count the
values facing the boundaries only. The estimated territory values “O” got is 1.
In the program, the extra influence values getting from connection will be changed.
From the original idea is that 4 extra influence values will be added to the influence
area of the two connected stones. However, it is for the convenience of checking and
adding the values. Once the connection is found, for each of the connected stones,
extra 2 values will be added to respective its own influence area. If the upper case is
used, the result will be changed to:
A
B
C
D
E
F
G
H
J
K
L
M
N
30
13
12
11
10
9
8
7
6
5
4
3
2
1
3
7
10
10
7
3
A
7
10
16
16
10
7
3
B
10
16
28
28
16
10
7
3
C
16
24
X
X
24
16
10
7
3
+
D
10
16
28
28
16
10
7
3
7
10
16
16
10
7
3
1
1
2
1
E
F
3
7
10
10
7
3
+
1
2
5
2
1
G
13
3
12
7 3
11
7 3 +
10
3
9
1
1
8
1 2 2 2 1 7
1 2 5 4 5 2 6
2 5 10 8 10 5 5
5 10 20 16 20 10 4
10 20 O 32 O 20 3
5 10 20 16 20 10 2
2 5 10 8 10 5 1
H J
K L M N
The change is appropriate because the influence values of the outermost part will not
affect the counting of the territory values and it has very least affect on the other part
of the stones.
Territory value calculation:
The territory is formed by surrounding the blank area on the game board with the
stones. By this reason, it is easier to form the territory near the corners compared to
the “tengen”.
In fig. 15, the areas in the four red rectangles are the places where the territory is the
easiest way to be formed. There are two walls near the corner. As a result, the
additional stones necessary for surrounding the blank area are the least. Hence, when
the influence value is found higher than 24 (lower than -24 for the white stones) in
those 4 red rectangle, the values should be more reliable. If the influence value is
found higher than 24 in the solid blue position and there is a corresponding stone are
found in the big blue rectangle, that influence value will be regarded as significant
value and 1 territory value will be counted. The area of blue rectangle is 3 x 3 because
31
the influence value would be over accumlated and estimated and there should be area
for controlling the significant area.
Fig.
15
Comparing with fig. 15, it is more difficult for the stones in the area of the red
rectangles in fig. 16 to form the territory. There is just one wall provided by the game
board and more stones are required for surrounding the blank area. As a result,
whenever the influence values are high enough in the red rectangle area, the
controlling area for making the value significant is much smaller. The controlling area
is just 1 x 3 units square.
32
Fig. 16
The area in red rectangle in fig. 17 is the place where the territory is the most difficult
to be formed. And the area in “tengen” will be severely affected by the stones
surrounded. It is almost impossible to form the significant territory in that area. As a
result, although the influence value is found high enough in that red rectangle, the
value is still not considered as significant, which means no available territory would
be formed in that small red rectangle area.
33
Fig.
17
The maximum influence value is set to 99 for black stones and -99 for white stones. It
is because it prevents the influence values are over estimated and it is convenient to be
located in the game board.
34
Algorithm
Input stones
According to the positions of the
stones on the board
Influence function
calcalution
Territories got from the basic
rule of Go
Black
Stones Side
White
Stones Side
Calculate influence
values of one stone
&
Record on the
board
Calculate influence
values of one stone
&
Record on the
board
Calculate for all
stones one by one
&
Summate all values
Calculate for all
stones one by one
&
Summate all values
Net influence values found by the
difference of values of both sides
Values equal to or larger than 24 for
black (smaller than -24 for white) is
counted as one territory value
Record the
captured stones
of both sides
&
One stone
counts as one
territory value
Record the
surrounded
territory
&
Each counts as
one territory
value
Summate all three territory values to
calculate final territory values for final
results
Page 1
35
System Design
Entry of Stones
Place the white or black
stone one by one
C++ program
The C++ program
using the influence
function
Do the calculations of
stones values
Enter the
stones
alternatively
Or,
Choose
“pass" for
some
situation
Display of stones
Display in two different
square blocks
Display (square block)
Display (square block)
Stones positions &
respective territory
information
Stones positions &
respective
influence values
Not save
Saving
Saving fomat
Saving the maps
in the text mode
Text mode with
the maps and the
territory values
Save
Page 1
36
1)
Entry of Stones
The Stones put on the game board must be not repeated in the same place of the board
or outside the game board, otherwise, the wrong message is shown until the available
position is to be made. The stones should be alternatively placed on the board except
the “pass” being chosen for special situation. Since the board is in the binary code
mode, “X” is used for representing the black color and “O” is used for representing the
white colour.
2)
C++ program
The program is mainly separated in three parts. The first part deals with the input,
error and storage. The inputs will be stored in a 2-dimension array. It is because the
screen needs to reprint for every new steps being added on the board. If the one the
position is occupied by the “X” or “O”, the error message is shown. The files and
results storage are also concerned in this part.
The second part is the calculation part which is sub-divided in two parts. The first part,
in each of the steps, the influence values are calculated in a manner, for example, if the
black stones are positive, the positive influence values are counted. The white stones
are also dealt with in the corresponding manner. The final calculation will then be
stored in another 2-dimension array. The second part is about the calculation of the
territory values The territory values for each kind of stones are possible to get will not
be displayed on the board. However, the amount of the territory will be displayed in
another corner for both colour stones.
The last part is the display part. The display of inputs, messages, game board will be
dealt with in this part. The content of the display will be fully discussed in the
Interface part.
37
3)
Display of stones
The game board will be displayed twice for the convenience of the research. The first
one is the common game board for the game. It makes the observation of the steps
easier. Another one is the game board with the corresponding influence values. It is
mainly used for the consideration of the steps which should be placed in next position.
4)
Saving
For the convenience of the record the results of the simulation, after each input of the
stones on the game board, the saving of the information can be chosen. The
information saved should be the two arrays mentioned above so that the stones and the
corresponding influence values can be recorded. The record is in the map format,
which is used for observation of the results. The territory values will also be recorded.
5)
Saving format
The saving format is in the text files. Each case is saved for a file. When the saving is
chosen, another interface is coming out. The file name is then added. The detailed
description is also typed.
38
User Interface
(1)
(2)
(3)
(4)
(5)
(6)
Page 1
39
1)
The instruction board
It shows which colour of stones should be placed in the coming round. It is used to
remind the user to think of the correct steps of its colour.
2)
The first game board
It shows the original game board with the steps which is moved before. It is used to
show the steps of the players.
The format should be:
13
12
11
10
9
8
7
6
5
4
3
2
1
3)
a
.
.
.
.
.
.
.
.
.
.
.
.
.
a
b
.
.
.
.
.
.
.
.
.
.
.
.
.
b
c
.
.
.
.
.
.
.
.
.
.
.
.
.
c
d
.
.
.
+
.
.
+
.
.
+
.
.
.
d
e
.
.
.
.
.
.
.
.
.
.
.
.
.
e
f
.
.
.
.
.
.
.
.
.
.
.
.
.
f
g
.
.
.
+
.
.
+
.
.
+
.
.
.
g
h
.
.
.
.
.
.
.
.
.
.
.
.
.
h
i
.
.
.
.
.
.
.
.
.
.
.
.
.
i
j
.
.
.
+
.
.
+
.
.
+
.
.
.
j
k mn
. . . 13
. . . 12
. . . 11
. . . 10
. . .9
. . .8
. . .7
. . .6
. . .5
. . .4
. . .3
. . .2
. . .1
k mn
The second game board
It shows the game board with the steps which is moved and the corresponding
influence values of the steps. It is used for the users to observe the result of the
simulation. The format would be the same as the first game board.
4)
The information board
40
It shows the territory values of the each side may get after the moves. The format
should be:
Black (X): xxx
5)
White (O): xxx
The message board
It shows the error messages. When the user enters the repeated steps, it shows the
steps have been repeated. Or, other kind of error message, for example, out of bound
message.
6)
The input board
It is used for the users input the stones. With the above board game for reference, the
format should be:
Input : m7
41
File Format & Style
(1)
(2)
(3)
Page 1
42
1)
The first game board
The information of the input of stones in a map format
2)
The second game board
The information of the influence values of the stones on the game board in map format.
3)
The captured stones values, the estimated territory values and the territory
values
The information of the captured stones values, the estimated territory values and the
territory values of both sides of stones.
Result comparison and analysis:
43
The simulation will focus on how many territory values the player can get when
starting a new territory and how many territory values he will lose during losing the
stones under the ladder. It is because if the ladder breaker is performed, the stones in
the ladder would be saved and there would be a vigorous competition. As a result, the
number of new territory values when performing a new territory is a good reference
for determine whether performing a new territory or do a ladder breaker is better.
The results simulated will be compared with the number of total estimated territory
values from both sides of players. The side of player (either the ladder or opponent)
having more number of estimated territory values will regard as taking advantage on
the game.
The number of territory values will be used to plot a graph, which is used to see the
result to determine when to start a new territory is the best time. The greatest
difference of territory values will be regarded as the biggest advantage of player in the
game.
The data set:
44
The data should be mainly focused on the 1 stone ladders, 2 stones ladder, 3 stones
ladder and 4 stones ladder. The number of stones ladder means that there are number
of the stones in the ladder and then the player starts to perform the ladder breaker. The
main point of the problem is that enclosing the opponent stones requires much more
stones (enclosing one stones requires 4 stones). The number of stones needed is almost
2x. (For every x of stones, we need 2x stones to completely enclose all) .None of
players would waste too many stones to just capture small number of stones and focus
to a small territory. As a result, the ladder is just focused up to 6 stones ladder.
After dealing with the ladder case, there are many different methods to start to
perform a new territory. For example, if there are three stones in the ladder, the
opponent would have extra 3 stones to perform the new territory. However, since one
stone does not have enough influence values to get a territory, the stones must be put
in connection-form. However, there still have many different ways to form the
connection. There are some examples to form a connection with 3 stones
Fig. 18
Simulation cases:
45
Fig. 19
Here is one of the cases of one-stone ladder (fig. 19). The ladder is started at the
sansan3-3 on the left bottom corner and the new territory is started on the right top
corner. The white stones trends to expand to the horizontal line.
Fig. 20
The influence values of the game board in fig. 19 are shown in fig. 20. It clearly shows
the actual influence values with the stones on the game board. It shows the possible
values for getting the territory values. And it is the values for reference on the attack
or defends on the next steps.
46
Fig. 21
Fig. 21 shows the captured stones, estimated territory values and the territory values
from both sides. The values are calculated with the influence functions and based on
the rule set above. By comparing with the territory values, it is simply concluded that
black side has the advantage of one territory value to white side in this one-stone
ladder case.
Conclusion on simulation:
47
For variety of combinations of the stones, the territory values for stones starting new
territory will be within a small range depending on the numbers of stones used for
making territory.
The data is obtained as below:
Data:
During the one stone ladder, the player will lose 6 estimated territory values together
with 1 stone captured, therefore, totally 7 territory values. There are total 12 cases.
The frequency for total number of territory values and handicapped numbers gained:
Total number of values gained
12.5
11.5
10.5
9.5
8.5
Frequency
3
4
2
1
2
1 stone ladder
14
12
value
10
8
6
4
frequency
value lost
value gained
2
0
Fig. 22
It is obvious that the number of values gained is higher than number of values lost in
any cases. When there is just one stone in the ladder case, the player can simply give
48
up that stone and start new territory. That player can get more advantages from
starting new territory than performing a ladder breaker.
In the two stones ladder, the player will lose 12 estimated territory values together
with 2 stones captured, therefore, totally 14 territory values. There are total 39 cases.
The frequency for total number of territory values and handicapped numbers gained:
49
Total number of values gained
17.5
16.5
15.5
14.5
13.5
12.5
11.5
10.5
9.5
7.5
Frequency
1
6
6
5
8
6
4
1
1
1
2 stones ladder
20
value
15
frequency
10
value lost
value gained
5
0
Fig. 23
There are about 46% cases that the player will gain more number of values than losing
the counterpart during the ladder (18 out of 39). However, it shows that it drops about
50% of cases comparing to the one-stone ladder.
In the three stones ladder, the player will lose 16 estimated territory values together
with 3 stones captured, therefore, totally 19 territory values. There are total 117 cases.
The frequency for total number of territory values and handicapped numbers gained:
Total number of values gained
21.5
Frequency
2
50
20.5
19.5
18.5
17.5
16.5
15.5
14.5
13.5
12.5
11.5
4
10
22
21
14
16
17
7
3
1
3 stones ladder
25
value
20
15
frequency
value lost
10
value gained
5
0
Fig. 24
The percentage of number of cases that the player can gain more number of values
than losing the number of values is 14% (16 out of 117). The player still can gain the
advantages on the game with the deep consideration and available steps.
In the four stones ladder, the player will lose 25 estimated territory values together
with 4 stones captured, therefore, totally 29 territory values. There are total 359 cases.
The frequency for total number of territory values and handicapped numbers gained:
Total number of values gained
23.5
22.5
21.5
Frequency
6
13
35
51
20.5
19.5
18.5
17.5
16.5
15.5
14.5
13.5
12.5
67
48
78
55
23
15
11
5
3
4 stones ladder
90
80
70
value
60
50
40
30
frequency
value lost
value gained
20
10
0
Fig. 25
There is none of case (0 out of 359) that the player can gain more the number of
values than losing the number of values. When there are four stones in the ladder, the
player should perform the ladder-breaker rather than start the new territory in any
circumstances.
52
graph for summary
90
80
70
values
60
50
40
30
frequency
value lost
value gained
20
10
0
Fig. 26
It is the graph for summary the data got from the simulation. It shows that the rate of
increase in the value gained from the starting from the new territory is smaller than the
increase in the value lost from stones being captured in the ladder. From the beginning,
the gained value is higher than the lost values in one-stone ladder case, which shows
that the ladder-breaker should not perform in this stage. The player should give up its
53
stones in ladder. However, in the case of four-stones ladder, the lost value is higher
than the gained values in any circumstances. It appeals that the player should save its
stones which are in the risk of being captured in the ladder. The ladder breaker should
be performed and the player should try to save back the stones. It is because the
territory getting from the new territory will not compensate for the loss in the ladder.
The best opportunity for ladder breaker performed should be at the cases more than 3
stones in the ladder. It is because the player will simply get more advantages in the 1
and 2 stones ladder. The player will get some advantages with the appropriate
consideration in the 3 stones ladder. However, the player totally can’t get the
advantages in 4 stones ladder case. And it trends that the difference should be larger if
the stones in ladder increase.
Comparison with downloaded software:
The same ladder and new territory cases are simulated with the downloaded software
called “WinHonte” [6].
The results are as the following:
54
It shows the percentage of the cases that the territory values from starting the new
territory is higher than the territory values lost from the ladder cases.
92% in 3 stones cases (11 out of 12)
67% in 4 stones cases (26 out of 39)
50% in 5 stones cases (59 out of 117)
26% in 6 stones cases (93 out of 359)
The statistics are similar to the simulation from the program in the project. It shows
that the percentage of the cases is decreasing with the increase in number of stones in
the ladder. It can conclude that more the stones in the ladder, more the loss of territory
values in the game.
Here is the histogram of the comparison (fig. 27)
55
comparison histogram
120
100
%
80
60
my program
web software
40
20
0
Fig 27
It shows that the rate of the decrease in the percentage of cases having higher territory
values from starting new territory is much slower than the program in the project. It is
because there are more restrictions on the program, for example, the connection
problems and the territory value calculation part.
Discussion:
56
Influence function is one of the algorithms used in the Computer Go. It is the useful
algorithm especially in the beginning of the game. It is because it can show the direct
and exact values from the stones on the board. The influence function would be altered
in any form under the necessary situation in the Go Game, for example, attack, defend,
capture, territory. The function in the project is mainly focused on the territory values.
In the result of simulation, it shows that the rate of territory values lost in the ladder is
much higher than the rate of the territory values gained from starting the new territory.
It can simply consider that the stones in ladder can get the territory values for the
game and the captured stones are also counted as the gain in the territory values. It is a
double gain in the territory values. By contrast, stones to start the new territory will
gain some territory values. However, the values gained will be compensated by the
values lost in the ladder. With this relationship in the ladder and starting the new
territory, the rate of the territory values lost in ladder is much higher than that values
gained from starting the new territory.
However, it is still too early to conclude when to perform the ladder breaker. It is
because the algorithm of influence function for calculating the territory values is not
perfect and there are too many factors affect the ladder. It is because the cases of
ladder may not be faced at the beginning of the game and the positions may not be
firmed in certain area. The simulation is just a reference for the player to think over
the ladder and ladder breaker cases when they face the real situation in the Go Game.
The result is more reliable because the rules in the project are stricter. With the
appropriate influence function, it is a good reference to check temporary territory
57
values in the beginning of the game. Of course, it should have more simulation on
different cases and get more comparison with other algorithms.
Project experience:
In the project, I learnt many techniques for working alone, for example, seeking the
information every in the world, learning the algorithm which is totally out of mind,
grouping the information from small pieces, finding the conclusion where the results
58
are in different formats. Especially, I can learn how to claim down when facing
problems and find out the solution when encountering difficulty. It is all the treasure
experience I can’t have learnt before doing this final year project.
Another experience I have learnt is that time is limited. Before doing the project, I
think that the time of a year is very long and I can do a lot of things fast and leave
much time. Once I started the project, I found out that time is so limited. It is because,
other than the final year project, I required to handle all other things, for example,
courses in sem B, examinations, part time, etc. The time became so hurry and the
project scope became less and less. If time had been unlimited, I would have tried
more different algorithms for comparison and more different cases in starting new
territory.
I also understand that seeking help from others is very important for solving any
difficulty. It makes me think over that the personal relationship is also very important
when seeking help. The attitude of learning and courtesy would highly affect one’s
impression and I should do more and learn more on this issues.
Possible extension:
In the results of simulation, there is still not a conclusion on when is the best time to
starting the new territory or performing the ladder breaker. The number of cases to
start the new territory is the main issue for the problem. The different cases of stones
should be fully found out and the number of stones for forming the new territory
59
should also increase until the absolute results come out. However, the difficulty is
much higher because the variety of cases for forming the new territory is an
exponential function. Simulation time for the cases would become a harsh problem for
the issue.
The rules in the project would set stricter if the situation is necessary. It is because the
thinking of the Go Game in the beginning, in the middle, and at the end of the game
are totally different and the rules for the algorithm should not be the same from the
beginning to the end. The suitable alternation of the rules according to the game
situation is also good extension on simulation on the ladder cases and also other cases
in Go Game.
The simulation results from small different cases are good reference for creating or
finding out the pure heuristic algorithm for the Go Game. As a result, simulation to the
cases on Go Game becomes an important part for the future algorithm.
Resources:
[1] D.N.L. Levy, D.F. Beal, Heuristic programming in artificial intelligence: the first
computer Olympiad, Ellis Horwood, 1989.
[2] jaap van den Herik and Victor Allis, Heuristic programming in artificial
intelligence 3: the third computer Olympiad, Ellis Horwood, 1991.
60
[3] Burmeister, J.; Wiles, J.; Purchase, H., “On Relating Local and Global Factors: A
case Study from the Game of Go”, Intelligent Information Systems, 1995.
ANZIIS-95. Proceedings of the Third Australian and New Zealand
Conference on , 27 Nov. 1995
Pages:187 - 192
[4] http://senseis.xmp.net/?LadderBreaker
[5] http://www.gnu.org/software/gnugo/gnugo.html
[6] http://www.jellyfish-go.com
[7] http://www.smart-games.com/igowin.html
[8] http://computer-go.org/pipermail/computer-go/2004-October/subject.html
[9] http://www.delorie.com/gnu/docs/gnugo/gnugo.html#SEC_Top
61
Download