PlayGo: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (fix source location)
 
(18 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Olpcboxtop|toptext=[[{{PAGENAME}}|PlayGo]]}}
{{ OBX activity |[[Image:PlayGo.gif]]|extra|Version 6}}
{{OBX xobundle |http://activities.sugarlabs.org/en-US/sugar/addon/4083}}
{{ OBX source other|http://git.sugarlabs.org/projects/playgo|GIT}}
{{ OBX team |[[user:Aa|Andrés Ambrois]]}}
<small>see more [[:Category:OBX templates|templates]] or [[OBX proposals|propose new]]</small>
{{Olpcboxbottom}}
== The Ancient Game of Go (derived from WikiPedia) ==
== The Ancient Game of Go (derived from WikiPedia) ==


Line 5: Line 12:
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.
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.


=== Basic rules from WikiPedia[http://en.wikipedia.org/wiki/Go_(board_game)#Rules]===
===[http://en.wikipedia.org/wiki/Go_(board_game)#Rules Basic rules from WikiPedia]===
[[Image:Go adjacent stones.png|thumb|right|One black chain and two white chains, their liberties shown with dots. Note that liberties are shared among all stones of a chain.]]
[[Image:Go adjacent stones.png|thumb|right|One black chain and two white chains, their liberties shown with dots. Note that liberties are shared among all stones of a chain.]]


Line 66: Line 73:
[[Image:PlayGo_PlayGo_class.jpg|thumb|right]]
[[Image:PlayGo_PlayGo_class.jpg|thumb|right]]


The PlayGo object is derived from Sugar's Activity
The PlayGo object is derived from Sugar's
[[http://dev.laptop.org/~cscott/joyride-1477-api/sugar.activity-module.html]] 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.
[http://dev.laptop.org/~cscott/joyride-1477-api/sugar.activity-module.html 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:
Upon object creation __init__ the PlayGo object performs:
Line 150: Line 157:
== Phase 2 ==
== Phase 2 ==


Allow the child to save and review played games
Allow the children to save and review played games


== Phase 3 ==
== Phase 3 ==


Allow the child to connect to the IGS Go server[[http://www.pandanet.co.jp/English/]]
Allow the child to connect to the [http://www.gokgs.com/ KGS Go server], or use [http://sourceforge.net/projects/nngs/ NNGS software] to allow students to play on the [[school server]].

== External Links ==
*[http://www.usg.org American Go Association] including clubs, tutorials
*[http://gobase.org/ Gobase] Including multilingual Internet Go Dictionary, game database, tutorials, and other material and links
*[http://www.pandanet.co.jp/English/ IGS Pandanet] The Internet Go Server
*[http://sourceforge.net/projects/nngs/ No Name Go Server] Go server software under GPL.
*[http://www.gokgs.com The KGS Go Server] A good place for kids to play.

Other Free Software for playing go: cgoban, qgo, gnugo, gtkgo, uligo


[[Category:Game]]
[[Category:Games]]
[[Category:Games]]
[[category:Software]]
[[category:GSoC proposals]]
[[category:Software_development]]

Latest revision as of 22:10, 13 May 2009

PlayGo.gif
Version 6
.xo BundlePlayGo.xo

see more templates or propose new

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.

Basic rules from WikiPedia

One black chain and two white chains, their liberties shown with dots. Note that liberties are shared among all stones of a chain.

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.<ref>How to place Go stones Retrieved March 4, 2007</ref><ref>The Go Board Retrieved March 4, 2007</ref>

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<ref>Sensei's Library. "Chain". Archived from the original. Template:Citation error. http://senseis.xmp.net/?Chain. Retrieved on 2007-11-27. </ref>. 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.

If white plays at A, the black chain loses its last liberty. It is captured and removed from the board.

A vacant point adjacent to a stone is called a liberty for that stone.<ref>Why do I keep getting captured? Retrieved March 4, 2007</ref>. 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.

An example of a situation in which the ko rule applies.

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.<ref>Sensei's Library. "Ko". Archived from the original. Template:Citation error. http://senseis.xmp.net/?Ko. Retrieved on 2007-12-20. </ref> 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.<ref>Sensei's Library. "Basics On Ko's". Archived from the original. Template:Citation error. http://senseis.xmp.net/?path=KoFighting&page=BasicsOnKos. Retrieved on 2007-12-20. </ref>

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<ref>Template:Citation</ref>— 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.<ref name=AGAConcise>AGA Rules Committee (1991). "AGA Concise Rules of Go". Archived from the original. Template:Citation error. http://www.cs.cmu.edu/~wjh/go/rules/AGA.concise.html. Retrieved on 2007-11-30. </ref>

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<ref>Fred Hansen. "Demonstration of the Relationship of Area and Territory Scoring". Archived from the original. Template:Citation error. http://www.cs.cmu.edu/~wjh/go/rules/AGA.commentary.html. </ref>. Under US rules, players hand over a prisoner when they pass, called a pass stone<ref name=AGAConcise/>. 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.

Each of these scoring methods has advantages and disadvantages.<ref>Jasiek, Robert (2007). "Objective Advantages of the Scoring Methods". Archived from the original. Template:Citation error. http://home.snafu.de/jasiek/advant.html. Retrieved on 2007-11-30. </ref> There have been some efforts to agree on a standardized set of international rules.<ref>Robert Jasiek. "International Rules". Archived from the original. Template:Citation error. http://home.snafu.de/jasiek/int.html. Retrieved on 2007-12-13. </ref>

Optional rules

Optional Go rules may set the following:

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:

PlaygoPhase1UC.jpg

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:

PlayGo classes.jpg

The Python PlayGo object

PlayGo PlayGo class.jpg

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:

  1. initializes the parent activity object
  2. creates an empty abstract board
  3. creates the activity tool bar
  4. creates the graphic objects, boardWidget, buddyPanel, InfoPanel
  5. groups the graphic objects in a layout containers
  6. opens a channel to the presence server
  7. 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

Allow the child to connect to the KGS Go server, or use NNGS software to allow students to play on the school server.

External Links

Other Free Software for playing go: cgoban, qgo, gnugo, gtkgo, uligo