Application of combinatorial techniques to the Ghanaian Board Game Zaminamina Draft

. Games happen to be a part of our contemporary culture and way of life. Often mathematical models of conﬂict and cooperation between intelligent rational decision-makers are studied in these games. Example is the African board game ’Zaminamina draft’ which is often guided by combinatorial strategies and techniques for winning. In this paper we deduce an intelligent mathematical technique for playing a winning game. Two diﬀerent starting strategies were formulated; center starting and edge or vertex starting. The results were distorted into a 3x3 matrix and elementary row operations were performed to establish all possible wins. MatLab was used to distort the matrix to determine the diagonal wins. A program was written using python in artiﬁcial intelligence (AI) to help in playing optimally.


Introduction
A game is any activity that involves different players who aim at satisfying their desire to win with set rules and principles guiding it. It include indigenous Ghanaian games like ampe, pampanaa, oware, pempenaa,pi lolo, alikoto, zanzama, sansankroma, kyemper, Adwoa Ata and many others [1]. These traditional games, in past times were held in high esteem by both the aged and the young in our society. Today, it is arguably true, that such traditional games are gradually on the decline and being replaced with computer aged games like Rubiks cube, brick game, super Mario, and the countless face book games. A typical example is the zaminamina board game, a traditional Ghanaian board game that is drawn using pen on a paper with different items that are used to

Related Literature
Traditional board games vary in size, players, seeds (marbles) and strategies. Several games have evolved from action and adventures, soccer, puzzle games, two-person zerosum games etc. of which Zaminamina draft game happens to be a two-person zero-sum game.
Definition 1. Two person zero-sum game involves only two players, in which the gain of one player equals the loss (payoffs) to the other player so that the total sum is zero. Such games ranges from chess, Go, checkers, grown up versions of tic-tac-toe games, hex etc. which gave rise to combinatorial chaos .

Variations in the Zaminamina Draft Game
Many board games share the element of trying to be the first to get in-a-row, including Three Men's Morris, Nine Men's Morris, Pente, Gomoku, Qubic, Connect Four, Quarto, Gobblet, Order and Chaos, Toss Across, and Mojo. Zaminimina draft game is an instance of an m, n, k-game, where two players alternate taking turns on an mxn board until one of them gets k in a row.
The zaminmina draft game have several variations which are modern computer games that can be traced back to ancient Egypt. Initially called tic-tac-toe game, it was played by the ancient Egyptians in the Roman Empire, around the first century BC of which it was named Terni lapilli (three pebbles at a time) and instead of having any number of pieces, each player only had three, thus they had to move them around to empty spaces to keep playing [2]. Everything has an origin and zaminamina draft game which is currently the name given to the three in a row game had its initial names and different looks. There are different names of the game recently.
Gomoku [3], also known as Gobang or five in a row is another abstract strategy board game which originated from the Japanese language gomokunarabe. Go means five, moku is a counter word for pieces and narabe means line-up. It is traditionally played with Go (black and white stones) on a Go board, using 1515 of the 1919 grid intersections [4]. A modification of the gomoku game is Renju shown in Figure 1 (h) requires 5marbles in a row or column of diagonal to signify a win for that player. Other equivalent version of the zaminamina board game is the SOS 8x8 board game in Figure 1 (i). The objective of the game is for each player to attempt to create the straight sequence S-O-S among connected squares (either diagonally, horizontally, or vertically), and to create as many such sequences as they can [5]. A wide variation of zaminamina board game is the ultimate tic-tac-toe 3x3 grid game in which each of the nine grid squares are also divided into nine different sub squares indicating a total of 81 squares on the board. The mini squares are known as the local board and the main squares are known as the global board. This game is complex due to its nature. Before a player can even have an upper hand on a global square on the global board, that player needs to have a 3 in a row (vertical, horizontal or diagonal) before he can place either an X or an O on the global board indicating dominance [6]. A player wins when he gets 3 in a row (vertical, horizontal, or diagonal). Notakto is a tic-tac-toe variant, also known as neutral or impartial tic-tac-toe.
According to [7], Notakto is a combination of tic tac toe and Nim played across one or several boards with both of the players playing the same piece (an "X" or "O"). The game ends when all the boards contain a three-in-a-row of X's, at which point the player to have made the last move loses the game. With this type of game, the first player to complete 3 in a row loses the game and the player to complete 3 in a row last wins the game. This is shown in Figure 1 (d). Qubic or 3D tic-tac-toe is an abstract strategy board game similar in concept to traditional tic-tac-toe but is played in a cubical array of cells, usually 4x4x4. Players take turns placing their markers in blank cells in the array. The first player to achieve four of their own markers in a row wins. The winning row can be horizontal, vertical, or diagonal on a single board as in regular tic-tac-toe, or vertically in a column, or a diagonal line through four boards. Illustrative example is in Figure 1(c).
Number scrabble is a mathematical game where players take turns to select numbers from 1 to 9 without repeating any numbers previously used, and the first player to accumulate a personal total of exactly 15 wins the game [8]. The game is isomorphic to tic-tac-toe, if it is mapped onto a magic square. Once a number has been picked, it cannot be picked again. However, if all the numbers are used and no player gets exactly 15, the game is a draw. This is shown in Figure 1 (e). Order and Chaos is a variant of the tic-tactoe on a 66 game board invented by [9].The player Order strives to create a five-in-a-row of either Xs or Os. The opponent Chaos endeavors to prevent this. Unlike typical board games, both players control both sets of pieces (Xs and Os). The game starts with the board empty. Order plays first, then turns alternate. On each turn, a player places either an X or an O on any open square. Once played, pieces cannot be moved, thus Order and Chaos can be played using pencil and paper [10]. Order aims to get five like pieces in a row either vertically, horizontally, or diagonally. Chaos aims to fill the board without completion of a line of five like pieces. Quantum tic-tac-toe game is played on the same board as the classical tic-tac-toe game which consists of a 3 X 3 grid of squares, labelled 1 through 9 (left to right and top to bottom). It came into existence as a result of quantum theory games invented by Allan Goff as a way of introducing quantum physics without mathematics. It is noted in classical physics that a single object cannot be in two places at once whiles in quantum physics, the mathematics used to describe quantum systems seems to imply that before an object can be subjected to quantum measurements, certain quantum particles can be in multiple places at once [11]. The motivation to invent quantum tic-tac-toe was to explore what it means to be in two places at once.

Combinatorial Games
Combinatorial games are games that are played by two persons with no hidden information, no chance moves (no dice) and outcome restricted to (lose, win), (tie, tie) and (draw, draw) for the two players who move alternately [12]. According to [13], combinatorial games should satisfy the following conditions; a) There are two players moving alternately b) There are no chance devices and both players have perfect information c) The rules are such that the game must eventually end; and d) There are no draws, and the winner is determined by who moves last.
When considering only the state of the zaminamina board, and after taking into account board symmetries (i.e. rotations and reflections), there are only 138 terminal board positions. Assuming that X makes the first move every time: [14] i) 91 distinct positions are won by (X) [14] ii) 44 distinct positions are won by (O) [14] iii) 3 distinct positions are drawn (also known as a cat's game[15])

Strategic Form of A Game
There are several strategies of playing a game that will either bring you a win or a loss. In the outcomes, there exist different aspects of the win or lose techniques of which we have the weak win and a strong draw, win versus weak win. The situation where a player gets a strong win is when the opponent player plays a strong lose that is to say he or she plays a mistake and the other player plays a pure strategy game to win. A player can play a perfect game of zaminamina draft (to win or, at least, draw) if they choose the first available move from the following list, each turn, as used in Newell and Simon's tic-tac-toe program [16]. The strategic form of a two-person zero-sum game is given by a triplet (X, Y, A), where a) X is a nonempty set, the set of strategies of Player I b) Y is a nonempty set, the set of strategies of Player II c) A is a real-valued function defined on X×Y which is the 3×3 matrix grid board representation.
A(x,y) is a real number for every x∈X and every y∈Y. Assuming player I chooses x∈X and Player II chooses y∈Y, each unaware of the choice of the other. Then their choices are made known and Player I win the amount A(x,y) from player II. Which indicates that the mistake of player I will give player II the chance of winning the game. When A(x,y) is positive, it indicates a win for Player I and if A(x,y) is negative, it indicates a lose of Player I over Player II. Thus, A(x,y) represents the winnings of player I and the losses of player II.

Pure Strategy and Mixed Strategy
Taking the case of (X,Y,A). The various pure strategies of both players is that player I which is X's pure strategy is to have a winning game and player II which is a Y's pure strategy is also to have a winning game. If both players only play with the mindset of playing an average game thereby not aiming at winning but blocking the other player from winning the game thereby bringing it to a tie. This is called mixed strategy.
Definition 2. (Minimax Algorithm Theorem). For every finite two-person zero-sum game a) There is a number V, called the value of the game, b) There is a mixed strategy for Player I such that I's average gain is at least V, no matter what II does, and c) There is a mixed strategy for Player II such that II's average loss is at most V, no matter what I do. If V is zero (0) we say the game is fair. If V is positive (+1), we say the game favoursPlayer I, while if V is negative (-1), we say the game favours Player II.

Fundamental Concept
The Zaminamina draft game is a two-person, zero-sum game which involves either two people or a player and the computer. It is a nine (9) square grid of which each player has only four plays to justify his winning strategy. In the absence of that, the opponent then devises a strategy to either win or bring it to a tie.

Assumptions
The zaminimina board game is fairly played with the assumption that; a) Time limit for both players to make a turn is established.
b) The initial move of a player cannot be change and is considered as a play.
c) The board is having distinct colours to distinguish the play cards from each other.
d) It requires one player to start.

The Strategic Form
The Zaminamina draft uses an alternative model known as the strategic form which represents the game as a matrix in table form. With the strategic form, we assume that both players select strategies before the game is played and uses those strategies in turn. In their first play, we define a strategy for player I and a responding strategy for player  Table 3.1.   Table 3.1: A payoff matrix between player I and player II Player I control rows A 1 , A 2 , A 3 , A m which are his strategies and player II controls column B 1 , B 2 , B 3 , , B n . The game is specified by the sets of strategies available to both players and the payoff matrix. The payoff matrix tables in Table 3.1(a) specifies the gain or profit to player I for every strategy pair (i,j).The two players select their strategies simultaneously, and when player I uses strategy i and player II uses strategy j, player I receives the payoff a ij from player II. A positive number is a gain for player I and a negative number is a loss (a gain for player II). A gain to one player is a loss to the other, thus providing the zero-sum feature.

Linear Programming Model
The players use a mixed strategy in the form of a discrete probability distribution. Suppose player Is probabilities are (x 1 , x 2 , x 3 , x m ) and player IIs probabilities are (y 1 , y 2 , y 3 , y m ) where X i and Y j are the probabilities that strategies I and j are chosen. The probabilities of both set of plays must sum up to 1. Thus, Player I always know that the expected payoff when player II plays a pure strategy j is m i=1 (P ij )X i , ∀j = 1, ..., n It is assumed that player II selects a strategy that will assure that the value of the game for player I, V i , is less than or equal to the expected value for any pure strategy j. Then we can write for each j the constraint The linear programming solution for player 1s strategy is The dual of the LP above is the strategies used by player II to minimize loss given by the LP mode Solving either one of these linear programs yields the optimal solution for one player

Matrix Representation of the Game Board
The zaminamina game board has 9! =362,880 ways of filling up each square with any of the numbers from 1 to 9. Table 3.2 show some of the possible outcomes of the game board. The game board in Table 3.2 is transformed to row reduced echelon form (RREF) in MatLab giving out the diagonal possible wins as shown in Table 3 Apart from the distorted matrix, if players are to play the game in a hierarchical arrangement with player I playing all odd numbers and player II playing all even numbers, the result will not give a win. This is stems from the fact that the RREF does not produce a leading diagonal of 1 with all other entries being zero. Table 3.4 shows the hierarchical arrangement in matrix form and its corresponding game loss is proven by yielding a result in row echelon form(REF).  Proof. Suppose A=(S, S, u 1 ; u 2 ) be a two player strategic form game in which S is a Hausdorff space and u 1 ; u 2 : SxS→R are Borel measurable and bounded. Assume A is symmetric, so that u 1 (s 1 ; s 2 ) = u 2 (s 2 ; s 1 ) for all s 1 ; s 2 ∈S. A mixed strategy for player i, denoted by σi, is an element of the of the payoffs, the set of Borel probability measure on S. The definition of the expected payoffs u i (σ 1 ; σ 2 ) generated by a pair of mixed strategies.

Symmetry of The Zaminamina Draft Game.
The Zaminamina draft game is symmetric because of its square nature and its rules in playing amongst both players. As a result it is only necessary to consider squares 1, 6 and 7 for player I and a reduced number of squares for player II. Any moves left out are symmetric to one of those shown. Because player I goes first, the three possible plays are in square 1, 6 and 7. Given the choice of player I, player II has several remaining squares as a possible response. The symmetric nature of the game is shown in Table 3.6 with → as line of symmetry. As experienced players observe, the result of the game is completely determined after the first player (X) and the second player (O) have played, assuming neither player makes a mistake. Representing a win for X as the value 1, a tie with a 0, and a win for O as -1. Figure 2 shows the decision tree based on the first two plays. The results of the game given the first two plays are shown in the Figure 2. The game shown in Table 3.5 (b) to (h) follows the bottom path of the decision tree where player I uses square 1, the centre, and player II follows with square 6. The ultimate result is a win (+1) for player I. If player II follows with square 7, it is a loss (0). The complete game in Table 3.5(i) is the result obtained when player I starts with square 6 and player II counters with square 7 as shown in the topmost part in Figure 2. The game is always a tie when the successive plays are made intelligently. The decision tree in Figure  2. which is a model game called the extensive form depicts the sequential nature of the game. Even for this simple situation, the extensive form can be very large. If we had not recognized the symmetry of the game and the fact that only the first two moves are important, the tree would be very complex.

The Zaminamina Board Game User Interface (GUI)
A code is written to give a description of the GUI of the game in python programming language and the RREF of the different interpositions of both plays in MatLab that gives a center starting and edge or vertex starting strategy for a winning game. Also, since it requires either a player against computer or 2 different players, we set a button and textbox for the number of players selection. For a user friendly game board environment, we place on the board a new game button for a restart of a game and a quit button for an exit of the game. The game has a design which makes the plays of both players distinct from each other. Player I plays X and the colour indication is red whereas player II plays and the colour indication is blue as shown in Figure 3. There are 3 different outputs at the end of every play which is either a win, tie or a lose for a player Figure 4.(b) is an image of a win at the end of a play.

The Strategic Moves.
A player can play a perfect game of zaminamina draft (to win or, at least, draw) if they choose the first available move from the following list; a) Win: If the player has two in a row, they can place a third to get three in a row. b) Block: If the opponent has two in a row, the player must play the third themselves to block the opponent. Let represent the zaminamina game board R i by i'th row and C j by j'th column where i, j belongs to N. Thus, This is shown in When X plays 1 as their opening move, then O should take 5. Then X takes 9 (in this situation, O should not take 3 or 7, O should take 2, 4, 6 or 8): This is symbolically represented as follows; . This game will end in a tie. Subsequent draw or tie payoffs include playing in the following sequential order.
In both of these situations ( if X takes 9 or 6 as second move after playing either the center or edge), X has a probability of 1/3 to win. If X is not a perfect player, X may take 2 or 3 as second move. Then this game will be a draw, X cannot win.

Win payoffs for X and vice versa.
If X plays 1 opening move, and O is not a perfect player, the following may happen.
Although O takes the only good position (5) as first move, but O takes a bad position as second move which is represented by; • X1→ O5 → X9 → O3 → X7, then X can take 4 or 8 to win.
Although O takes good positions as the first two moves, but O takes a bad position as third move: , then X can take 4 or 9 to win.
O takes a bad position as first move (except of 5, all other positions are bad) this is what will happen: • X1→ O3 → X7 → O4 → X9,then X can take 5 or 8 to win.

Findings
The output above indicates that there is always a probability of a player winning as a result of playing a fair game or a game of no mistakes by taking a turn in either the center starting and edge or vertex starting without a block from the other player. In the situation whereby the player is blocked from winning either from the center starting and edge or vertex starting, the game then ends in a tie which is called a mixed strategy for both players. Again, a win is always determined by who moves last. Lastly, when a player plays a fork, the opponent have to use the mixed strategy move to defend or else the player who played the fork wins.

Conclusion
This paper aims at deducing an intelligent mathematical technique for playing a winning game in Zaminamina draft using two different starting strategies: centre starting and edge or vertex starting. Also, to distort the results into a 3x3 matrix and perform an elementary row operation on the results to establish all possible wins. During the study, the 3x3 square matrix was distorted and Matlab was used to distort the matrix to establish all the possible wins. The game was then designed using Python programming Language. Machine Learning was incorporated to check when there is a position filled so as to prevent double play on a single position. The game gives a user friendly environment which will help anyone who wants to play the game on his computer to play it without stress.On the basis of the findings we recommend that: a) The strategies deduced in this paper only should be used to achieve a win in the zaminamina draft game.
b) In order to play this game on your computer, python program must be installed. c) All the codes for the game must be in your python program in order to run the game.
d) All py-game packages be installed and updated or pycharm 5.0 e) Windows 7 or higher version should be installed on your computer. [3] Japan 101.Gomoku -Japanese Board Game (2014).