TesujiGoFramework/Ladders

Sub-page of TesujiGoFramework

Ladders = 2-liberty tactical problems

Be sure to read the definition of Ladder if you're not familiar with the term. There's an old proverb saying if you don't know ladders don't play Go. From early on while programming Go it was clear that the same holds for computer-Go. "If you don't know how to program ladders, don't program Go". I believe that I was the first to say this, but please correct me if I'm wrong.

A ladder is also called a 2-liberty problem. The stones being chased have one or two liberties at the start, depending on which side is to move first. If the side that wants to escape is to move he needs to make two liberties or more. If he makes more than two liberties he escapes, if he makes two liberties the other side can continue the chase.

The chasing side always reduces the number of liberties from two to one. If there's no move that can do that, he fails. And we say the ladder escapes.

These conditions make a ladder simple in nature. The escaping side has only two choices:

  • Play on the last liberty that remains and see if it makes at least two new liberties.
  • Capture a neighbouring chain of the opposing coolor that has only one liberty.

The chaser has just as few options: all he can try is play directly at one of the two liberties of the chain it chases.

So in principle, programming a ladder is fairly straightforward. It's still a challenge, but a relatively easy one. What is a real challenge is programming a module that can read ladders fast, but I'll come back to that later. Ladders are the simplest form possible where reading ahead is required. Since this is a technigue commonly required in game-programming in general, and it's parrticularly a technigue required at several stages of making a Go program, I came to the proverb above: "if you don't know how to program ladders...".

There are several open-source projects that you can use to obtain a ladder-reading module. And this project is one of them. But if you're serious about programming Go I would advise any aspiring Go programmer to at least take a shot at programming ladders themselves. If only to get a hands-on experience to what is required to be a successful Go programmer. And it's fun! Only after you've written your own (and verified it actually works) would I advise you to turn to the one provided in this framework. If you're really ambitious you'll try to make a ladder-module that is faster than the one available here. Even though I don't think you'll succeed, if you make a serious effort trying I can guarantee you you'll learn a lot about Go programming just by trying. And in the off chance that you do succeed in making a faster one, you get the satisfaction of punishing my arrogance for making such a bold claim.

Tactics, and keeping track.

One thing is to have a module that reads ladders. But where does it fit in with respect to evaluating a position? Well, in many ways actually. But one way I'll focus on here specifically. A few building-blocks down the line we'll get to influence and groups. Two groups can be connected if the are separated by a chain of the opposing color that can be caught in a ladder. Even stronger, they could be considered connected if a chain is in atari and cannot escape.

So what we need is a building block that keeps track of all the chains that have one or two liberties. And for each of those it needs to keep track of the result of the ladder-reading module on these cases. This is the task of the tesuji.games.go.tactics.Tactics class. Instead of simply looping over the board and seeing which chains have one or two liberties, the Tactics module works incrementally.


This is a copy of the living page "TesujiGoFramework/Ladders" at Sensei's Library.
(OC) 2011 the Authors, published under the OpenContent License V1.0.
[Welcome to Sensei's Library!]
StartingPoints
ReferenceSection
About