Each player has a store (also called a Mancala) to his/her right side of the Mancala board. Four pieces are placed in each of the 12 pockets. while gameover = 0 % while nobody has won while p1_turn = 0 % while still player 1 turn if sum(layout(1:6)) ~= 0 % while player 1 still has seeds in pits moves = moves + 1 % plus 1 for total moves while good_pick1 = 0 % loop to find a pit with seeds p1 = randi(6) % picks random pit amount = layout(p1) % finds amount of seeds in that pit if amount > 0 % if pit has seeds break % breaks out of loop (found a good pit) end endĪt the end of every game, the data points of interest are documented and carried through until all 100,000 simulations are complete. Mancala is a game with ancient heritage from Eritrea and Ethiopia, dating back as far as the 6th and 7th century, and is still enjoyed through to this day. The Mancala board is made up of two rows of six pockets (also called holes, or pits) each. You always choose a bin on your side and drop stones starting in. The player going first chooses one of their six pockets. Java applet implementation of Mancala, the ancient African stone game. The winner is the player with the most stones in their Store. The remaining stones go to the other player’s Store. The game ends when either player has no more stones in their six circles. Playing the Game Below are the rules for playing Mancala. The rules are optional (depending on the age of the players). Instead, you can use house rules for choosing, such as flipping a coin or letting the youngest player go first. A pit that has seeds is randomly picked, and those seeds are distributed counter-clockwise along the board (see below). Mancala rules don’t state how to choose who goes first. This simulation works by having two players make random moves against each other until one person wins.
0 Comments
Leave a Reply. |