Hello,

I need a help how do I solve everything about Mancala.

PROBLEM: The game of Mancala is played by two players sitting on opposite sides of a board similar to the one above. Each of the numbered circles represent a bowl. At the start of the game each numbered bowl will contain 4 stones. The ovals represent the deposit bowls (mancalas). Player A can take all the stones from any one of his numbered bowls and place the stones one at a time in the bowls to his right (1, 2, 3....12). Player A may place a stone in his mancala as he goes from bowls 6 to 7. Player A does not place a stone in player B's mancala as he goes from bowls 12 to 1. When Player A has finished placing his stones, Player B follows the same rules during his turn. Player B may place a stone in his mancala as he goes from bowl 12 to 1. Player B does not place a stone in player A's mancala as he goes from bowls 6 to 7. A player wins when, after completing his turn, all the numbered bowls on his side are empty.

INPUT: There will be 5 lines of input. Each line will contain just two positive integers. The first integer will be the starting bowl number of each player in A-B-A-B-A order as the game is played. Using the Sample Input below, Player A moves the stones from bowl #4 and the count in bowl #6 is printed. Then Player B moves the stones from bowl #12 and the count from bowl #2 is printed. The game continues for a total of 5 turns. The game starts with its original configuration of 4 stones in each bowl.

OUTPUT: For each line of input, print the number of stones in the bowl given by the second integer after the turn is completed.

SAMPLE INPUT SAMPLE OUTPUT
1. 4, 6 1. 5
2. 12, 2 2. 5
3. 6, 12 3. 0
4. 8, 7 4. 6
5. 2, 4 5. 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.