The Ancient Game of Go (derived from WikiPedia)
The olpc PlayGo activity implements Go a strategic board game for two players. Go originated in ancient China, centuries before its earliest known references in 5th century BC writing. It is mostly popular in East Asia but has nowadays gained some popularity in the rest of the world as well. Go is noted for being rich in strategic complexity despite its simple rules.
Go is played by two players alternately placing black and white stones on the vacant intersections of a line grid. The standard size of this grid is 19 × 19, although the rules of Go can be freely applied to any size: 13 × 13 and 9 × 9 are also popular choices for simpler and more tactic-oriented games as well as a way to introduce Go to new players. The objective of the game is to control a larger part of the board than the opponent. To achieve this, players strive to place their stones in such a way that they cannot be captured, while mapping out territories that cannot be invaded by the opponent without being captured. A stone or a group of stones is captured and removed if it has no empty adjacent intersections, the result of being completely surrounded by stones of the opposing color. Generally, placing stones close together helps them avoid capture, whereas placing them far apart allows a player to surround more territory. Part of the strategic difficulty of the game stems from finding a balance between these two conflicting interests. The game ends, and the score is counted when both players consecutively pass on a turn, indicating that neither side can increase its territory or reduce its opponent's.
Two players, Black and White, take turns placing a stone (game piece) of their own color on a vacant point (intersection) of the grid on a Go board. Black moves first. Normally, the grid measures 19×19 lines, though the rules can be freely applied to all grid sizes. Grid sizes 9×9 and 13×13 are often used to teach beginners and still offer a challenging game to experienced players. Once played, a stone may not be moved to a different point.
Orthogonally adjacent stones of the same color form a chain (also called a group) that shares its liberties (see below) in common, cannot subsequently be subdivided, and in effect becomes a single larger stone. Only stones connected to one another by the lines on the board create a chain; stones that are diagonally adjacent are not connected. Chains may be expanded by playing additional stones on adjacent intersections or connected together by playing a stone on an intersection that is adjacent to two or more chains of the same color.
A vacant point adjacent to a stone is called a liberty for that stone.. Chains of stones share their liberties. A chain of stones must have at least one liberty to remain on the board. When a chain is surrounded by opposing stones so that it has no liberties, it is captured and removed from the board.
Generally, it is not allowed to play a stone in such a way that one of your own chains is left without liberties. Such a move is dubbed suicide. An exception to this rule occurs if doing so captures one or more of the opponent's stones. In this case, the opponent's stones are captured first, leaving the newly played stone at least one liberty.
Players are not allowed to make a move that returns the game to the position before the opponent's last previous move. This rule, called the ko rule, prevents unending repetition. See the example to the right: Black has just played the stone marked 1, capturing a white stone at the intersection marked with a circle. If White were now allowed to play on the marked intersection, that move would capture the black stone marked 1 and recreate the situation before Black made the move marked 1. Allowing this would result in an unending cycle of captures by both players. The ko rule therefore prohibits White from playing at the marked intersection. Instead White must play elsewhere; Black can then end the ko by filling at the marked intersection, creating a five-stone Black chain. If White wants to continue the ko, she will try to find a play that Black must answer; if Black answers, then White can retake the ko. A repetition of such exchanges is called a ko fight.
Instead of placing a stone, a player may pass, indicating that he sees no way to increase his territory or reduce his opponent's territory. When both players pass consecutively, the game ends and is then scored.
 Scoring Rules
There are two basic ways to count the score at the end of the game. The oldest of these is called territory scoring and is used in Japan, Korea and most Western nations. The other scoring rules —invented in 15th-century China— are called area scoring and are used in China and some other countries. The US uses a scoring system that is a hybrid of these two systems.
With territory scoring, a player's score is the number of empty points enclosed by his stones, plus the number of prisoners he has. Prisoners are opposing stones which he has captured during the game or those that are still on the board but cannot avoid capture.
With area scoring, a player's score is the number of stones he has on the board, plus the number of empty intersections he has surrounded. Prisoners do not count toward the score under these rules.
Given the fact that the number of stones a player has on the board is directly related to the number of prisoners his opponent has taken, the resulting score under both rules is often identical and is rarely more than one point different. Under US rules, players hand over a prisoner when they pass, called a pass stone. Combined with the requirement that White makes the last pass, this system guarantees that the net score under territory scoring will be the same as that under area scoring.
 Optional rules
Optional Go rules may set the following:
- compensation points, almost always for the second player, see komi; Tournaments commonly use a compensation in the range of 5-8 points, generally including a half-point to prevent draws.
- compensation stones placed on the board before alternate play, allowing players of different strengths to play competitively (see Go handicap for more information);
- superko: Although the basic ko rule described above covers over 95% of all cycles occurring in games, there are some complex situations —triple ko, eternal life, etc.— that are not covered by it but would allow the game to cycle indefinitely. To prevent this, the ko rule is sometimes extended to disallow any previous position. This is called superko .
 PlayGo Software
Source : in git
The suggested activities page encourages development of a Go Game Activity. The connect-activity offers an excellent jumping off point for the game of go implementation, so the first phase of this project does not appear to be too ambitious.
 Phase 1
Phase 1 will simply allow two children to play a game of go just as two children play connect. The game will pick up prisoner stones and prevent Ko exploitation. It will also allow chat between the two player children. Other children in the neighborhood may attach and see the game progress.
Here is the use case:
Player A and Player B decide the order of play, black goes first and the number, if any, of additional handicap stones will be placed for the first move. The game automatically clears prisoners and enforces Ko.
The entire activity is implemented with 6 Python Classes:
 The Python PlayGo object
The PlayGo object is derived from Sugar's Activity object. Phase 1 of PlayGo implements the communication callbacks for playing and watching a Go game over the network with a member of your neighborhood.
Upon object creation __init__ the PlayGo object performs:
- initializes the parent activity object
- creates an empty abstract board
- creates the activity tool bar
- creates the graphic objects, boardWidget, buddyPanel, InfoPanel
- groups the graphic objects in a layout containers
- opens a channel to the presence server
- sets up for a game
Game setup consists of:
if creating the game, make me the only player and go into local play mode
-- or --
if connecting to a neighborhood game, call the activity connection methods
From the souce code of sugar Activity
To get a working Activity: 0. Derive your Activity from this class: class MyActivity(activity.Activity): ... 1. implement an __init__() method for your Activity class. Use your init method to create your own ActivityToolbar which will contain some standard buttons: toolbox = activity.ActivityToolbox(self) Add extra Toolbars to your toolbox. You should setup Activity sharing here too. Finaly, your Activity may need some resources which you can claim here too. The __init__() method is also used to make the distinction between being resumed from the Journal, or starting with a blank document. 2. Implement read_file() and write_file() Most activities revolve around creating and storing Journal entries. For example, Write: You create a document, it is saved to the Journal and then later you resume working on the document. read_file() and write_file() will be called by sugar to tell your Activity that it should load or save the document the user is working on. 3. Implement our Activity Toolbars. The Toolbars are added to your Activity in step 1 (the toolbox), but you need to implement them somewhere. Now is a good time. There are a number of standard Toolbars. The most basic one, the one your almost absolutely MUST have is the ActivityToolbar. Without this, you're not really making a proper Sugar Activity (which may be okay, but you should really stop and think about why not!) You do this with the ActivityToolbox(self) call in step 1. Usually, you will also need the standard EditToolbar. This is the one which has the standard copy and paste buttons. You need to derive your own EditToolbar class from sugar.EditToolbar: class EditToolbar(activity.EditToolbar): ... See EditToolbar for the methods you should implement in your class. Finaly, your Activity will very likely need some activity specific buttons and options you can create your own toolbars by deriving a class from gtk.Toolbar: class MySpecialToolbar(gtk.Toolbar): ... 4. Use your creativity. Make your Activity something special and share it with your friends! Read through the methods of the Activity class below, to learn more about how to make an Activity work. Hint: A good and simple Activity to learn from is the Read activity. To create your own activity, you may want to copy it and use it as a template.
 Phase 2
Allow the children to save and review played games
 Phase 3
 External Links
- American Go Association including clubs, tutorials
- Gobase Including multilingual Internet Go Dictionary, game database, tutorials, and other material and links
- IGS Pandanet The Internet Go Server
- No Name Go Server Go server software under GPL.
- The KGS Go Server A good place for kids to play.
Other Free Software for playing go: cgoban, qgo, gnugo, gtkgo, uligo