Simple Mancala Game

Create a mancala game using as few bytes as possible.

The game

Mancala is a family of games where a player has a control over a set amount of pots filled with stones/seeds. The particular version which you should implement has a board with 14 pots, of which two are designated as scoring pots. At the start of the game the scoring pots are empty and each of the other pots contains 4 stones. On each player's turn they select one non-empty non-scoring pot, remove the stones from it, and starting with the next pot counter-clockwise they place one stone per pot, moving counterclockwise, until they have placed them all.

Unlike some other variants, there is no way to get a second turn. Once the stones from one pot have been redistributed, the play passes to the other play.

The game ends when all the stones are in the scoring pots, so that there is no valid move remaining.

The challenge

Implement a simple program to allow two players to play against each other at a shared computer. No AI is required.

For the purposes of input, the pots are labelled as shown:



The scoring pots are (R1H1) and (R2H1).

The input will be a list of pots separated by a semicolon: e.g. R2P3;R2P1. These represent the moves in order from left to right. You may assume that each move is valid.

The output will be the number of stones in each pot after the input moves have been performed. The output need not use brackets in the same way as the diagram above or the examples below, but the pots must be distinguishable and the scoring pots should also be clearly distinguished from regular ones.

Worked example

The initial board position is



Given input R2P3 the output should be



placing the four stones from R2P3 in the first four pots working counter-clockwise from R2P3.

Given input R2P3;R2P1 the output should be



closed as unclear what you're asking by FryAmTheEggman, Sriotchilism O'Zaic, Qwerp-Derp, mbomb007, Daniel Feb 5 '17 at 4:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    \$\begingroup\$ Welcome to PPCG! It might be better to specify the output. Also you should put the code-golf tag for these criterias. \$\endgroup\$ – Matthew Roh Feb 5 '17 at 3:50
  • \$\begingroup\$ I am voting to close this as unclear because as it currently stands it does not indicate input and output. It also needs a winning criterion as suggested. \$\endgroup\$ – Sriotchilism O'Zaic Feb 5 '17 at 4:03
  • \$\begingroup\$ I revised it, should've helped \$\endgroup\$ – Sine_ Feb 5 '17 at 4:06
  • 2
    \$\begingroup\$ Also, the Sandbox might be able to help you. \$\endgroup\$ – Matthew Roh Feb 5 '17 at 4:08
  • 2
    \$\begingroup\$ The edits answered my questions, although I've rewritten it to try to separate out the game rules from the challenge. Before I vote to reopen I would like to ask (as Arnauld has) how flexible you are on the input format. Personally I would allow labelling the pots 0 to 13 or 1 to 14 in clockwise or anti-clockwise order, so long as the answer clearly specifies the convention followed. That allows people to focus on the game logic rather than on parsing the pot labels. \$\endgroup\$ – Peter Taylor Feb 5 '17 at 22:20

Browse other questions tagged or ask your own question.