Gametrees = Įnd end if totalscore+score = 48 disp( 'Found 48-marble winning sequence!') disp(newwinningstreak) return end end endĮnd % The driver code calls a move function which will runs through 'automatic' % moves recursively. You know how some games have a first-player advantage? It turns out that in Mancala, you can find a way not only to win (which is nice), but to win all the marbles (awesome), and to do so on your very first move! % Here is driver code to find (one of many!) % all-48-marble-win-on-first-move solutions, which runs in ~20s on my % laptop! Is There a First-Player Advantage? (You Bet!) In the intial position, there are four stones in every hole. If you drop your last stone into a non-empty hole, you get to continue with what I call an 'automatic' move, picking up all stones from that hole. If you drop your last stone into your home, you get a 'free' turn. The rule set we wrote the code for is: you pick from any hole, and drop one stone at a time while circling the board in counterclockwise fashion, drop a stone into your home whenever you pass through it. Now, there are many ways to play the games in the Mancala family. Shout-out to my daughter, sixth grader Natalie, for introducing me to the game, and being a partner in these experiments. Let me tell you what happened when I got tired of losing at Mancala, and decided to write some MATLAB code to play it.
0 Comments
Leave a Reply. |