Last updated on: June 20, 2015 by Musa Kurhula Baloyi
Contents of this article
The ncuva game is of the family mancala. It is known by many different names across the continent of Africa. In South Africa at least, the Vhavenda call it mufuvha, whereas the Bapedi call it moruba. The name ncuva comes from the Vatsonga. It was traditionally played by men for relaxation in the hot summers, under a tree or behind a hut, while putting your brain to work. It is a strategy game based on mathematics.
You always move counterclockwise. In terms of number of players, there can be one-on-one or two versus two. Three against three, or even more per side, is not common. The logic of the second player in this game is a mirror image of what is shown below.
You score when you stop your moves in your inner line adjacent to your opponent's kanyi (token). The win is the hole column adjacent to your stopping kanyi on your opponent's side. You get to penalise your opponent by emptying one of his or her wholes. There are two strategies to do this. Either you empty the whole that puts you in danger the most, or you empty the whole that will make it easier for you to score in your next round.
Deep in the game, there may be a scenario where you or your opponent no longer has groupings of two. The person who is in this state "u parile". This state of the game means making single moves for the player who is in it. They cannot move a kanyi that has been blocked by another kanyi in front of them. They have to move the one in front first, except when there is one or more empty holes in between these makanyi. The main strategy is to bring into the inner row as few makanyi as possible so you can dodge hits, and so you can hide and move in on your targets. Single moves mean it takes longer for the player to go a full round.
Simply put, since we are using the Linux terminal for making moves, we need to guard against picking moves from outside the board. This is not something required in real-life but is a programmatic necessity for error handling. When a graphic user interface is finally completely implemented, this section of code will fall into disuse.
This piece of code registers a move made by a player. The selected move is then sent to the player's logic in order to start the play.
You win when your opponent no longer has makanyi on his half of the board. Others throw the towel when the game looks hopeless but we are not modelling this functionality. It is believed that if you start at the sixth hole against a player of reasonable skill and provided you always make the best choices, you will win. The same rules apply for all multiples of 6.
In terms of arranging the board there are two common states: 2 nhlokweni (two at the head) and 3 nhlokweni (three at the head, two elsewhere, and one before the empty hole). Arbitrary numbers at the head would create more complexity. The length is always 4 holes going up. The width can vary in multiples of 2. A reasonable minimum width is 6 holes going left or right. A reasonable maximum width is 32 holes going left or right. (This article shows how one could refactor the piece of code that implements this rule.)
Visually, you can expect this result from the above rule:
Players 1 and 2 (or sides 1 and 2) alternate in playing this game. This is regardless of whether one side scores or not, a side only plays once at a time.
To run this program, type these instructions on the terminal. (It is assumed that you have a Python runtime environment.)
Below is a short video of me explaining how the game works: