

Mancala tules how to#
The problem was that I don’t know much about mancala and how to evaluate the board to determine if it’s good or not. A board where the bot has won should have the highest possible value, a board where it has lost should have the lowest possible value. It takes in the board state and spits out a number that expresses how good or bad the board is.

The function for evaluating the board state at any given time is called the heuristic function. That’s where the heuristic function comes in. Instead, there needs to be a way to evaluate how good the board is at any time and just try to get to a good place. That means that it’s incredibly expensive to try to look ahead to the end of the game and figure out how to get there. In mancala, though, there are 6 moves at any time and each move affects the remaining states of the game. In tic-tac-toe, there are at most 9 possible moves to be made at any given time, so it’s not unreasonable to examine all possible states of the game board. Minimax trees and AB pruning consider how good the board is for each player during their turn. The best move I consider is the only move the bot considers Here’s that example more visually (I’m X, the bot is O). How the bot thinksĪB pruning is a method of ignoring board states which will never occur (if the opponent also behaves like the bot).ĪB pruning assumes the following: if I’m playing a game of tic tac toe and there’s a move I can make that will make it possible for me to win, I will ignore all other moves so the bot making a decision can, too. It recurses n levels then returns the move which will eventually produce the most desirable board state. The bot uses a minimax tree to select the next move, meaning it chooses the move that will produce the best outcome assuming the opponent will do the same. My goal was to build a mancala bot that could beat both me and other mancala bots. This project was for Northwestern’s EECS 348. Here’s a writeup of general techniques and results. The player with the most stones in their Mancala at the end of the game wins.I spent the past week goofing around with genetic algorithms to develop a heuristic for evaluating a mancala board for more successful move selection. The winner is determined by counting stones in the Mancalas. Place all captured stones into your Mancala.Īccording to the Mancala Rules, the game is over when a player empties all six cups on his side. If the last stone placed on your turn is placed into an empty cup, capture all of the stones in the cup across from it on your opponents side of the board (the corresponding cup on your opponents side). Once you placed all the stones, your turn ends and your opponent repeats the process.

This process will distribute the contents of that first cup evenly among the next cups and leave an empty cup on your side of the board. You can, however place stones in your opponents non-Mancala cups. Stones must be placed into your own larger Mancala cup, but not into your opponents. Moving counter clockwise, place the stones one by into the other cups on the board, one stone at a time. On your turn, pick up all the stones in one of the smaller cups on your side.
Mancala tules free#
Decide who goes first (a 14 hour game of Monopoly is the editor’s recommendation,but you are free to determine the means among yourselves). Place four stones in each of the smaller cups, but not in the Mancalas,on both sides of the game board. They usually consist of colorful marbles or beads. You need a total of 48 game pieces or stones. The six small cups and the Mancala on your side of the board belong to you, and the cups and Mancala on your opponents side of the board belong to her. Place the board between you and your opponent. There are six small cups in each row, and a larger cup, the Mancala, is located at either end.
