EnglishFrançais

Documentation for miniGos v1

Copyright 1998-2012 - François Mizessyn - francois.mizessyn@orange.fr

What is miniGos?

MiniGos is a sgf reader to replay go games or problems in a web page. MiniGos is a simplified version of the sgf reader/editor Gos.

It's a set of php and javascript scripts.

You can use miniGos free of charge on your website (BSD type license).

How to install miniGos?

MiniGos can be installed on a web server with php available (version 5 or higher).

Just download miniGos archive, unzip it and copy all its contents anywhere in your web site.

Then look at this sample or this one to verify that all is OK.

The end user has nothing to do on its device. He has just to let javascript enable in its browser.

How to use miniGos?

To use miniGos in a web page, you have just to insert one line of php/html.

Evenly, you can modify the configuration (through a php configuration file), or the style (through a css file).

The line to insert in your web page

Include in your page where you want that the player displays something a line such as:

<script type="text/javascript" src="_mGos/sgfreader.php?sgf=xxx.sgf"></script>

Of course, you have to adapt the path before the php script (here "sgfreader.php") which is called a launcher, taking into account where you installed miniGos, and where your web page is. It's a relative path between your page and the launcher script file.

You can add as miniGos instances as you want in a page. The only limits are those of the web server and of the user device.

The "sgf" parameter in the url of the launcher specifies the sgf file to read.

If the file is prefixed by a path, it's a good idea to use the "urlencode()" php function. For instance, if the sgf file is in the launcher parent folder, use:

sgf=<?php print urlencode("../xxx.sgf"); ?>

The path is the relative path between the launcher and the sgf file.

You can also use an url.

For instance :

sgf=<?php print urlencode("http://xxx.org/sgf/file.php?id=77"); ?>

The launchers

MiniGos has two basic launchers, sgfreader.php to replay games (miniGos just places the moves on the goban) and sgfproblem.php to replay problems (the user can place a move and miniGos answers it according to what it reads in the sgf file).

Here is a sample to replay a game:

<script type="text/javascript" src="_mGos/sgfreader.php?mL=en&sgf=<?php print urlencode("../Hon-1941-1.sgf"); ?>"></script>

And here is a sample to replay a problem:

<script type="text/javascript" src="_mGos/sgfproblem.php?mL=en&sgf=<?php print urlencode("../p1.sgf"); ?>"></script>

Note: to display miniGos labels in english, don't forget to add "mL=en" in the launcher url as above.

Sgf files

You can use any valid sgf file.

When replaying a game, miniGos displays only moves of the main variation of the sgf.

When replaying a problem, miniGos considers all variations of the sgf. If one of them is a move outside the visible part of the goban or a pass, miniGos will place on the goban any move of the user. This is useful when one need to insert in the sgf a variation that can be played after any move of the user.

Configuration

Evenly, you can modify miniGos configurations.

A configuration is a set of php statements. For the replaying game configuration, these statements are in _mgos/_cfg/reader.cfg. For the replaying problem configuration, these statements are in _mgos/_cfg/problem.cfg.

To set a parameter, the php line is such as:

$gosParam["ParameterName"]="ParameterValue";

Take care of upper and lower case.

For instance, to remove the mark on the last move, use:

$gosParam["markOnLastOn"]=0;

If the parameter value is a string, don't forget the double quotes. For instance:

$gosParam["initMethod"]="last";

Parameters than you can modify are:

ParameterDescriptionValueDefault value
initMethodInitial action: display the goban as it was before the "first" move or after the "last" move"first" or "last""last"
markOnLastOnIf 1, miniGos displays a mark on the last move0 or 10
in3dOnIf 1, miniGos displays the stones with a 3d effect0 or 10
stretchOnIf 1, the goban height is 10% more than its width.0 ou 10
canUndoIf 1, miniGos displays an undo button (only for the replaying problem configuration)0 or 10

Note: to change goban background color, goban line color, stone radius, color or size of icon navigation buttons, use css (see below).

Style

A miniGos player is a set of components, each of them displays in a <div> html tag, and all of them display in a global <div>.

All these <div> have css classes.

Here is the list of all css classes used by miniGos:

Class name Comment
mReaderGlobalBoxDiv or mProblemGlobalBoxDiv <div> surrounding the player
mGobanDiv <div> surrounding goban
mNavigationDiv <div> surrounding navigation buttons of game player
mSolveDiv <div> surrounding navigation buttons of problem player
mCommentDiv <div> surrounding comment

The "replaying a game" css file is reader.css, and the "replaying a problem" css file is problem.css.

The goban is drawn in a <canvas></canvas> tag. To change its style, use "div.mGobanDiv canvas" in css files. For instance, to change goban background color, goban line color and stone radius of the game player, use something like:

.mReaderGlobalBoxDiv div.mGobanDiv canvas {background-color:#f00;color:#fff;font-size:12px;}

The navigation button tags are <button><canvas></canvas></button> or <button><span>...</span></button>. To change its style, use "div.mNavigationDiv button canvas" (for the game player) or "div.mSolveDiv button span" (for the problem player) in css files. For instance, to change icon color and size inside navigation buttons of the game player, use something like:

.mReaderGlobalBoxDiv div.mNavigationDiv button canvas {color:#f00;font-size:12px;}

Annexe 1: file list

"_mgos" content

Annexe 2: questions and answers

Question: what is the minimum I have to do to include a miniGos in one of my web page?

  1. Uncompress miniGos archive (a file called "_miniGosnnn.zip" where nnn is the miniGos version number): the result is stored in a folder called "_miniGos".
  2. Copy as is "_miniGos" to the root of your web site (you can put it anywhere, but in this case, you will have to adapt all the following paths accordingly).
  3. Assume your page is "page1.php" and is in a subfolder of the site root called "_pages".
  4. Assume the sgf file is "game1.sgf", represents a game and is in a subfolder of the site root called "_sgf".
  5. Insert in "page1.php" to the place where you want the player dislays something the following line:
    <script type="text/javascript" src="../_miniGos/_mgos/sgfreader.php?sgf=<?php print urlencode("../_sgf/game1.sgf"); ?>"></script>
  6. Et voilà!

Question: is miniGos working with any browsers?

In theory, miniGos works with internet explorer (from v9), firefox (from v4), safari (from v5) and chrome. It doesn't work with internet explorer v8 and older.

Question: can miniGos display numbering, marks, variations... on the goban?

MiniGos v1 is a sgf player designed to be ligth. It cannot displays numbering, marks, variations and so on. If you need such features, consider to use miniGos v2 or gos instead of miniGos v1.