
Number of legal 18x18 Go positions computed. One more to go - tromp
http://tromp.github.io/go/legal.html
======
everyone
Anyone here play? It is pretty much the ultimate boardgame. Its like game-
theory the game. From the very start you are embroiled in interesting
risk/reward and provoking you opponent to overextending type stuff. Great
place to play is gokgs.com I actually cant play many strategy games anymore
because I realize this is like go with a load of crap thrown on it. My friend
and I call this 'false complexity' the game isnt really complex it just has
loads of rules and random stuff to familiarise yourself with before getting
into the game proper. Its not a great a comparison but I would say something
like magic the gathering or Dota would be good contenders for most 'false
complexity' attained in a game.

~~~
darkmighty
In Dota for example the false complexity is what allows someone with not so
great analytical thinking but great knowledge of the complexity (items and
hero combinations) to fare pretty well. It helps level the field. Although
comparing go to RTS is extremely misleading. RTS's have pretty deep of what I
call 'continuous tactics' where you need to plan an optimal control of your
character with a continuum rather than discrete set of plays. It presents
incredibly rich situations which you cannot explain with the kind of strategy
you see in go or chess, for instance. The same goes for games like counter-
strike, once you take into account limited aiming capability. I think it's
beautiful how those games can hide this richness into a very fun game at low
levels, and how they don't seem so hard just because we're so good at spatial
reasoning and planning.

Here's an illustration:

[http://youtu.be/5e8HZqF3cyk?t=2m1s](http://youtu.be/5e8HZqF3cyk?t=2m1s)

I also like this quote by von Neumann:

"If people do not believe that mathematics is simple, it is only because they
do not realize how complicated life is."

I confess I do wonder what would be the equivalent 'go of RTS games', where
the minimal, essential dynamics are captured without all the bling.

~~~
anewhnaccount
It doesn't have the richness of Go but I believe
[https://www.gnu.org/software/liquidwar6/](https://www.gnu.org/software/liquidwar6/)
captures the essence of the "action/micro" side of RTSs.

~~~
nsajko
I prefer the old
[http://www.ufoot.org/liquidwar/v5](http://www.ufoot.org/liquidwar/v5) .

------
tunesmith
Just because the number of legal positions is computed doesn't mean we're
anywhere close to "solving" 18x18 Go, right? What's the utility of computing
the number of legal positions?

~~~
joelangeway
One example that just occurred to me: The base 2 log of the number of legal
positions of a 9x9 go game is about 126.3, which means if I use a good hash of
board positions yielding twice that number of bits, I have a better than 50/50
chance of having no collisions. That is very good to know if you've got
anything like a transposition table in a Go playing program.

~~~
Someone
You don't really need that precise an estimate.

    
    
      81 * 2log3 ~= 128.38
    

So, the number of legal positions is only a factor of about 5 down from the
number of positions disregarding life.

------
hemmer
I wonder if this sort of thing might be appropriate for grid computing, e.g.
BOINC? There are plenty of mathematically minded projects.

[http://boinc.berkeley.edu/](http://boinc.berkeley.edu/)

------
e12e
I don't understand this quote: "[determining the number of valid positions is]
sadly unattainable for Chess, where determining if a given position is legal
is the essence of a class problems known as Retrograde analysis.".

Is this due to some subtle distinction between valid moves/games and
positions? Because since the starting position is given, and the rules are
set, surely it's possible (in theory) to simply emulate all possible moves,
and recording positions as one goes along, backtracking on cycles [ed: and on
check mate]?

~~~
cevn
It seems that in chess, the (current) "best" way to figure out whether a move
was legal is through retrograde analysis (1). As you can imagine, this becomes
very expensive, very fast. Not only that, but the current position may be
legal in chess given some previous conditions, but illegal given others
(consider Castling). Therefore, given no extra information, you may not be
able to tell whether a given chessboard is legal without being given the
entire history of the board as well.

Disclaimer: I don't know what I'm talking about, just googled retrograde
analysis

1\.
[http://en.wikipedia.org/wiki/Retrograde_analysis](http://en.wikipedia.org/wiki/Retrograde_analysis)

~~~
b3n
I'm not sure what ruleset OP is using for their analysis, but with superko in
place you would also need the entire history of the board to know if a move is
valid.

~~~
tromp
Although rulesets might differ on what is considered a legal move, they all
agree on what is a legal position: one where every connected group of stones
has liberties (empty adjacent point). Furthermore, in all rulesets you can
reach any legal position by playing legal moves (and passes) from the empty
starting position.

------
userbinator
_Following 9 months of computation and 4 petabyte of disk IO on a Dell
PowerEdge R280 server_

I wonder if the time could be improved by optimising the programs some more,
since at this scale constants matter a _lot_. The amount of memory needed
might not be reducible but optimising a tight loop and reordering it to take
advantage of cache effects could yield nontrivial speedups.

Taking advantage of the very wide new instructions in recent CPUs might also
be worth it, instructions which compilers often have difficulty figuring out
how to use effectively:

[http://davidad.github.io/blog/2014/02/25/overkilling-
the-8-q...](http://davidad.github.io/blog/2014/02/25/overkilling-the-8-queens-
problem/)

~~~
tromp
Most time is spent normalizing, encoding, decoding, and sorting so-called
border states, compact 18*3-bit descriptions of all information needed about a
partial board position to determine its legal full-board completions. This
code is fairly optimized, but it's possible that a small factor could be
gained by expert analysis. Even so, there's little to no room for reducing the
amount of disk-IO, so the end-result might be that the problem becomes more IO
bound than CPU bound.

------
protomyth
So, given all the positions, can you tell which one(s) are possible results of
another position after another turn?

// did not know you couldn't do this for chess (paper even pointed to why)

~~~
tromp
Are you asking whether it's possible to determine all possible 1-move
predecessors of a given position?

If so, then yes, that is pretty straightforward. E.g. the last move was either
a pass, or a move by White, or a move by Black. For a move by White, it was
either a suicide, so could be on any point in an empty region enclosed by
Black, or it was no suicide and is one of the points occupied by White in the
given position, possibly having captured a Black group in any of the adjacent
empty regions enclosed by White.

~~~
protomyth
Yeah, that what I'm asking (in a really bad way). I wonder, given a list of
positions, how long it would take to build the transitions between them. I
would imagine 19x19 would be a "practically forever" type thing.

~~~
tromp
It would take at least a nanosecond for each position. Given that 6x6 already
has 62567386502084877, it would take at least 724 days. To take "practically
forever", 7x7 more than suffices:)

------
julbaxter
Another great resource about Go combinatory:
[http://ps.waltheri.net/](http://ps.waltheri.net/)

------
pathikrit
I want to learn Go. I would like to practice against a bot first before I get
on KGS. What is a good Go program I can run on my Mac to practice against? The
AI does not need to be very good at all since I am novice. Once I get familiar
with rules, I will play online against players. What is a good Go client to
play online on the Mac?

~~~
tunesmith
There is a way to compile GoGui so it is a mac app. Through it you can play
against GnuGo (brew install gnugo), fuego (brew install fuego), or pachi
(compile yourself). With it, you can also learn a lot by making an AI play
starting at a certain move, or making AI's play against each other.

You can also buy Goban from the app store to play GnuGo or Pachi (both
bundled), but it is a bit buggy (and not really better than the older free
version). They do respond to bug reports though so it sounds like they are
actively working on it.

Start out playing 9x9 against GnuGo. Give yourself a 9-stone handicap, you
should probably win. Take away handicap stones until you can win with a 3
stone handicap.

In general you don't want to play an AI at less than 3-stone handicap or you
will learn bad habits.

At that point, play against GnuGo 19x19 with a 9-stone handicap. If you are a
beginner around 20kyu, you will find it a challenge to win.

I've been practicing consistently for the past couple of months. I do problems
on goproblems.com or from a few iPhone apps. I've played a couple of games
against ranked bots on kgs and am ranked 15kyu there since I beat a popular
16kyu-ranked bot. KGS is inflated through so I'm probably around 20kyu, still
a complete beginner. I beat GnuGo 19x19 at a 9-stone handicap but not quite
yet at an 8-stone handicap.

Once you are able to beat GnuGo 19x19 at a lower handicap then you can start
playing against Fuego or Pachi. But at that point you should also already be
playing humans regularly - it's a very different playing style in that you'll
come across clearly bad moves that you will have to learn to recognize and
take advantage of.

------
Houshalter
For fun I did a search for approximations to the function with Eureqa. I get
exp(0.0319x(naturalLogOfLastValue) + 1.056xn^2 - 0.184).

Some other approximations here:
[http://i.imgur.com/w84aPWs.png?1](http://i.imgur.com/w84aPWs.png?1)

Note they are all in the log domain.

------
alexbecker
> we need from 10 to 13 servers, each with at least 8 cores, 512GB RAM, and
> ample disk space (10-15TB), running for about 5-9 months.

Is he sure about 512GB of RAM? That's a lot of memory. Even the 32-core
memory-optimized AWS instances only have 244GB.

~~~
nippoo
Where I'm currently working (computational neuroscience / data analysis) we've
just had to upgrade our servers and 512GB is only just enough for some
datasets. A couple of the labs nearby (genomics) share a cluster of ~10
machines with 1.5TB RAM each. So no, 512GB isn't stupidly high (though it's
still uncommon!).

(Large SQL servers, etc, often have this much RAM)

------
DiaaAttia
Hello, we provide jobs for ESL teachers through
[http://preply.com/en/skype/english-tutoring-
jobs](http://preply.com/en/skype/english-tutoring-jobs)

------
chizthtor
They got 57 legal position for a 2x2 game of go. They're counting all the
symmetries. They're not pruning anything. _facepalm_

~~~
tromp
Few people can believe that there are as many as 386,356,909,593 games on the
tiny 2x2 board. Needless to say, nothing is pruned there either. A game could
visit as many as 48 of the legal positions and have dozens of passes (but only
2 consecutive ones, which ends the game).

~~~
MichaelGG
Well it "ends" the game but play can resume. Plus, there's the crazy
hypothetical play in the way-over-complicated Japanese rules. I think, in
theory, you can play multiple almost-compete games after the game is "over".
Each hypothetical play is just to resolve one group, as I understand.

~~~
tromp
Indeed, the Japanese rules are not suitable for mathematical analysis of the
game; see
[https://en.wikipedia.org/wiki/Rules_of_go#Counting_phase](https://en.wikipedia.org/wiki/Rules_of_go#Counting_phase)

That's why our paper "Combinatorics of Go" assumes the so-called Logical Rules
at [http://tromp.github.io/go.html](http://tromp.github.io/go.html), which do
end a game on consecutive passes.

~~~
lambda
I would also like to point out, for the benefit of anyone else here (just
replying to you to clarify your point), that the Logical Rules referred to are
commonly referred to as the Tromp-Taylor Rules, after John Tromp (the
submitter and parent commenter) and Bill Taylor, who wrote them up as a
simplified version of the New Zealand rules; and that these, in turn, are in
the branch of Chinese-style, or area-scoring rules (counting the sum of stones
on the board and territory surrounded for score), to contrast with Japanese
and Korean style, or territory-scoring rules (counting the sum of territory
surrounded minus captured stones for the score).

The reason that rulesets in the Chinese style branch are more amenable to
mathematical analysis are that you can play the game until you have an
unambiguous result about the life or death of a group, and thus these rulesets
usually involve simply resuming the game and playing it out if there is any
dispute about whether a group is alive or dead (or, for the logical rules,
don't involve resumption at all, you just play it out and score it as is after
two passes, with all empty points that reach two colors being counted for no
one; since in area scoring games, ending the game before that point is mainly
a convention for human players who don't feel the need to play all the way to
the point of killing obviously dead groups).

Under Japanese style rules, playing within your territory to kill a disputed
group may reduce your own score, so rather than just playing it out to the
end, there are an elaborate set of conventions for determining the life or
death of particular shapes. This elaborate set of conventions is much more
difficult to represent mathematically.

The American Go Association rules of Go have an interesting hack to allow you
to use Japanese-style territory scoring, but wind up with the same result as
Chinese-style area scoring would give you, by having you actually give your
opponent a stone as a capture when you pass, plus making the game-ending
passes be two or three passes such that each player has the same number of
turns. This preserves the benefit of area scoring, that any dispute on life or
death can be resolved by resuming the game and playing it out until the
situation is completely unambiguous, while still allowing the somewhat easier
method of counting that territory scoring provides (filling in liberties with
captured stones, and then just counting the remaining territory, and thus
having to actually count to a lower number).

The Tromp-Taylor rules do make some adjustments for the sake of making it even
more amenable to analysis that most other rulesets do not, such as allowing
suicide. This doesn't actually affect the strategy in very many games, as it's
very rare to encounter a situation in which a suicidal move would be the best
choice, but it tends to make analysis a bit simpler as there is one fewer
constraint to worry about. I feel like allowing suicide is more elegant, but
it is only allowed in a few rulesets.

It is unfortunate that for such a simple game, there is no one agreed upon
worldwide rule set. There are a couple of different parameters that you can
tweak in a ruleset that give you a game that is very similar, but different
enough in a few corner cases to make them different games; territory vs. area
scoring (and with territory, the large number of conventions on life and death
you need to make it work), simple ko vs. situational superko vs. positional
superko, suicide vs. no suicide, counting points in seki, and komi (number of
extra points for the second player to make up for the first-move advantage).

