igGameCenter API Developer Guide >> List of available games >> Kalah
This page describes all specific details related to the Kalah game. All information below is connected to the following board:


Place value meaning
The value of 1 contained in place parameter in all XML responses corresponds to the bottom line of pits on the board and the right kalah.

The value of 2 corresponds to the top line of pits on the board and the left kalah.

Keep in mind that this is just an internal representation used in the igGameCenter but your application can use other forms of visual interface.


Move code format
The format of the move codes that should be sent from an external application is very simple. When a player wants to sow seeds from some pit the application should send a numeric index of the source pit. 1 should be sent if the source pit is "a" or "A", 2 - if the source pit is "b" or "B" and so on.


Game board data format
Below is an example of how the board data is encoded in XML response coming from handler API script:

<gameData>
<pit00>0000000000000001111</pit00>
<pit01></pit01>
<pit02></pit02>
<pit03></pit03>
<pit04>2</pit04>
<pit05>3</pit05>
<pit06>00</pit06>
<pit10>0000000000000</pit10>
<pit11>0</pit11>
<pit12>222</pit12>
<pit13></pit13>
<pit14></pit14>
<pit15></pit15>
<pit16>0</pit16>
</gameData>

Each pitXY tag contains a string of digits representing a group of stones currently or previously present in a corresponding pit.

X can equal 0 (for the bottom line of pits and the right kalah) or 1 (for the top line of pits and the left kalah).
Y can equal 0 (for the kalah) or 1 to 6 (for the corresponding pits).
For example, pit04 represents a group of stones in a pit marked with "d" letter, pit12 stands for "B" and pit00 stands for "o" (right kalah).

Each digit in the mentioned above strings can have the following values:
0 a single stone lying in the corresponding pit
1 a new stone, i.e. a stone that was dropped to the corresponding pit by the last move.
2 a disappeared stone, i.e. a stone that was taken or captured from the corresponding pit by the last move.
3 a disappeared new stone, i.e. a stone that was at first dropped to the corresponding pit by the last move and then was taken or captured from there by the same move.


Game options
There are two additional options specific to the Kalah game:

Field Name Field Content
stones This option defines the initial number of the stones present in each pit.
The value of this option can be 3,4,5 or 6.
The default value is 3.
captureEmpty The value of this option can be 0 or 1.
If the value is 1 then a player is allowed to capture zero seeds from the opponent when dropping a last stone in an empty pit on his side.
The default value is 0.


These options can be included as additional parameters when sending a POST request to the handler API script with the SETUP command.

The gameOptions part of the response received from the handler will be of the following form:

<gameOptions>
    <hidden>0</hidden>
    <scored>1</scored>
    <stones>4</stones>
    <captureEmpty>1</captureEmpty>
</gameOptions>


Game specific error messages
Error code Error meaning
NOT_YOUR_TURN_NOW One tried to make a move when it wasn&39;t his turn.
INVALID_MOVE_CODE An invalid move code was received.
GAME9_PIT_IS_EMPTY One tried to take seeds from an empty pit.



igGameCenter © Arty Sandler. Privacy Policy