
Tags: large, board game, game, two-player""" 5. Without them, our Mancala program would require long series of if and elif statements to carry out the same game steps.ġ.
#MANCALA 2 PLAYER CODE#
Pay attention to how the code uses these dictionaries. This lets the expression NEXT_PIT evaluate to 'B' and the expression OPPOSITE_PIT evaluate to 'G'. The dictionaries NEXT_PIT and OPPOSITE_PIT map the letter of one pocket to the letter of the pit next to or opposite it, respectively. To avoid confusion, the labels use the letters A through L so they won’t be mistaken for the number of seeds in each pocket. Notice that each pocket needs to have not only the number of seeds in it but a label as well. Mancala uses ASCII art to display the board. When you run mancala.py, the output will look like this: Mancala, by Al Sweigart -snip.

More information about Mancala and its variants can be found at. The other player claims the remaining seeds for their store, and the winner is the one with the most seeds. The game ends when all of one player’s pits are empty. If the last placed seed is in your store, you get a free turn. If your last seed lands in an empty pit of yours, move the opposite pit’s seeds into that pit. To play, grab the seeds from a pit on your side of the board and place one in each subsequent pit, going counterclockwise and skipping your opponent’s store. The name comes from the Arab word naqala, meaning “to move.” There are several variants of this game across different cultures. The board game Mancala is at least 2,000 years old, making it almost as old as Project 63, “Royal Game of Ur.” It is a “seed-sowing” game in which two players select pockets of seeds to spread across the other pockets on the board while trying to collect as many in their store as possible.
