Development of Algorithm of Traditional Kei-Yen Game

Manipuri traditional game Kei-Yen, which originates from the ancient Meitei mythological story, is a mind game between two players of different mindsets, one has the mindset of killing (Kei), whereas the other (Yen) has the mindset of protecting itself and block the moves of Kei. We propose and develop an algorithm of this game by incorporating various possible logical tactics and strategies for a possible computer software of this game. Since this game involves various logical mind games, playing this game can improve our way of thinking, strategies, tricks and other skills related to mind game. In this play there is not the case of draw which means one has to win over the other at the end of the game. This game could become one of most interesting indoor national or international game.


Introduction
One of the most interesting Manipuri traditional indoor games, which is known as Manipuri Chess, is Kei-Yen (Tiger-Rooter) [1].Historically, this indigenous game is originated from the "Meitei mythological" story [2].This Manipuri traditional name Kei means Tiger, and Yen means Rooter or Cock.It is a mind game like Chess game between two players on a board drawn in a specific logical manner [3], but the way it is played is very different from the Chess game.The origin of the game goes far back to ancient Manipuri and can be played throughout the year.It is a simple but very logical battle or war game between groups of Kei and Yen which can improve our mind thinking skills and logical Before start of the game there could be a toss or decision defining which player will play Kei and the other Yen.Kei will start the game at the beginning.Then both the players will move turn wise.Kei player will attempt to kill all the pieces of Yen and Yen player will attempt to block the way of Kei.Kei will win the match if it kills all the Yens, whereas, Yen player will win the match if it could able to block the Kei moves.

Game Logic and Algorithm
We describe the details of the Kei-Yen board and all possible strategic moves of both Kei and Yen as in the following.

1) Kei-Yen Board
Kei-Yen board two dimensional square board which has 5 × 5 (25) positions to move for both Kei and Yen.One player has two Kei pieces (small wooden sticks as in Figure 1) and the opponent has 25 Yen pieces which is also a wooden sticks smaller in size as compared to Kei to distinguish from Kei.Both Kei and Yen pieces can have same move for strategy but Kei has extra move for eating Yen.Only dark places along the lines on the board (as shown in Figure 1  short-term actions or moves, and hence short-term tactics can be used to advance and manipulate next consecutive moves by a player.The possible depth of logical moves to win the match depends on the player's ability and strategic skill. In a particular position of either Kei or Yen with large number of possibilities on both sides, a deep calculation and logical strategy are more difficult and may not be practical, while in "tactical" positions with a limited number of forced variations, strong players can calculate long sequences of moves during the play.Further, simple one-move or two-move tactical actions, such as, threats, exchanges of moves, and double attacks, can be combined into more complicated combinations of move by each player, however, sequences of tactical maneuvers are often forced from the point of view of one or both players during the match.b) Fundamentals of strategy: Kei-Yen strategy is concerned with evaluation of Kei-Yen positions by each player, and with setting up goals and long-term winning plans for the future moves in the play.During the evaluation process, players must take into account numerous factors, such as, the strategic move of the pieces on the board, control of the center and centralization, the pawn structure, predating or protecting logics, and the control of key opponent's move and sequences of attacks (for example, diagonal moves, lines of actions, and positions of attack or hide).
The most basic step in evaluating a position is to count the total number of steps of their own advantages of both players.Every strategy move used for this purpose is based on the previous experience and evaluation of opponent's move.
Since Kei has only one step to move either to eat Yen or occupy position of higher opportunity, Kei player generally have to try to hold position which have a large number of possibility of eating Yen or move from that position in the next move.Because even though Kei does not have the fear to die, it should be careful about its being trapped by the Yens in the next steps followed by in the match.The strategy of Yen is completely different from that of the Kei.The main strategy of Yen should be to hold positions where it is safest to survive and easy to get hold of Kei moves during the match, and they have to play in groups in a coordinating way.Hence, the move of each Yen should be correlated to the occupied positions by the other Yens on the board.On the other hand, Kei will try to break the group activities of Yens to individualize them so that they can attack easily to eat.It's very similar to predator-prey strategy model but here in this match both predator and prey have human intelligence.

4) Phases of the game
There  b) Middle game Phase: In the Kei-Yen game, Kei will move first, followed by Yen's move and so on as a turn wise move.Kei will attempt to kill all the Yen and Yen will attempt to block all the way of Kei to trap.Then all possible tactics are used by both players and they are allowed to use those tactics freely.c) End game phase: There is one advantage of Kei-Yen game over other types of games, such as chess, that is one of the players should be winner either Kei player of Yen player [5].The match will never draw in the game.There are two ways to finish the game.They are either (i) finish by Kei, or finish by Yen.In the finish by Kei end game, Kei will either finish by eating all the Yens or reach a stage at which the remaining Yens will have impossible to block all the way of Kei as shown in Figure 2(c).However, in the finish by Yen, the Yens, the attempt to block the ways of Kei in all the possible ways becomes successful, and reach a situation that the two Keis could not able to move at all (Figure 2(d)).In this case Yen will win the game., where, a defined by ( ) , m n gives us a position of either Kei or Yen on the Kei-Yen board (Figure 3).In Kei-Yen condition check for arrangement move, there are three conditions for both Kei and Yen to win over the other.They are i) same position check condition, ii) even-odd condition, and odd-even condition which will be discussed in the subsequent sections with respective algorithms and pseudo codes.
Before we discuss the properties of the possible moves, we should know idea about moves regarding extremely end position.We can divide two types at the extremely end current position cases for common position moves.Let us discuss the logical moves and their possible pseudo code as follows.
Properties of move C 1 : When ( ) Pseudo code of C 1 logic: Properties of move C 2 : When ( ) , a m n is at the even-odd or odd-even or even-even extremely end positions where m = even number and n = odd number or vice-versa or m = n = even number respectively, then each Kei or Yen has three possible moves.
Pseudo code of C 2 logic: Properties of move C 3 : When ( ) , a m n is a position at main diagonal position but not at extremely end point, then the current position has eight possible moves, which means m = 1 or 2 or 3 & n = 1 or 2 or 3 respectively, m = 1 and n = 3 or m = 3 and n = 1.
Pseudo code of C 3 logic: ) Pseudo code of C 4 logic: ) ) , 1 a m n + Now we consider various check for arrangement move as in the following.
Property of move B 1 : In this property, there are three sub-properties.They are Property 0f move A 1 (Same Position Check Condition), Property of move A 2 (Even-Odd Check Condition) and Property of move A 3 (Odd-Even Check Condition) as shown details are next pages.This property of move B 1 is mainly used by Kei for their arranging moved.

Same Position Check Condition
In this move condition, we have m = n = even number or odd number or same number.
Property of move A 1 : For ( ) , a m n move, where, m and n are either both even numbers or both odd numbers or same numbers and 0 m ≥ & 4 n ≤ , then the current position can move 3 to 8 maximum positions.They are, ( )

Even-Odd Check Condition
In Even-Odd condition, the values of "m" is even number and "n" is odd Journal of Computer and Communications number where ( ) , m n is the position of Kei or Yen.This case means m = even number and n = odd number.
Property to move A 2 : The current position ( ) • When ( ) , a m n is at the extremely end current position means either m = 1 or 3 and n = 0 or 4 respectively or vice-versa, then a(m,n) has three possible moves using Property to move C 2 .

Condition Check for Killing Move (Kei Move)
Condition check for killing move means the Kei move which is shifted from one position to another position for killing the Yen.In this move, some extra conditions moves can be applied as compared to Yen moved i.e.Kei can kill when the next adjacent position of Yen is empty from and as same lines with Yen and Kei should be there on Kei-Yen board.Means Kei and Yen are same rows or columns or diagonals according to the Kei is either even-odd check condition or same position check condition or odd-even check condition.In Kei-Yen condition check for killing move, there are three conditions for Kei like Yen which are discussed below.

Same Position Check Condition for Killing Moves
In same position check condition, the values of m and n are both even numbers or odd numbers or same numbers where m and n are the array of first and second position number of "a".It means m = n = even number or odd number or same number.Property to move B 2 : For ( ) needs logical skills, tactics and strategy to win the game.The peculiar and interesting notion of this game is that both the players have different strategies and moves because mindsets of Kei and Yen are different because the mindset of Kei is to kill, whereas, the mindset of Yen is to protect itself and to block the Kei moves.Further, one of the player has to win in the match and there is no draw.The algorithm to develop a software for this interesting game is presented in this work.The game software could be an interesting one for interested players for practice.
(a)) can be moved by both the players.Kei will keep on moving two dark places, which are middle of either right most and left most side or top most and bottom most side of the Kei-Yen board.However, Yen will keep on moving four dark places.Yen have four separate groups to place on board; they are second dark placed of left most and top most, right most and top most, left most and bottom most and right most and bottom most as shown in Figure 1(b).
are three different phases in Kei-Yen game.They are opening phase, middle game phase and end game phase.These phases of the game correspond to different stages of the match.Opening phase means starting position of the game; middle game phase indicates after 9 -10 different moves of the game and end game phase correspond to the finishing stage of the game.a) Opening phase: Opening phase of Kei-Yen game start with the groups of Yen as an initial move of game.Initially four groups of Yen are kept separately at four specific places (Figure 2(a)) of Kei-Yen board beginning.Each group has five Yen, and two Kei are kept separately as shown in Figure 2(b).At initial stage, Kei will be kept at the middle of either right most and left most side or top most and bottom most side of the Kei-Yen board.Groups of Yen will be kept as shown in Figure 2(a).

Figure 2 .
Figure 2. Schematic diagram depicting different phases of Kei-Yen game: (a) Opening phase of Kei-Yen game; (b) middle phase of the Kei-Yen game; (c) End game by Kei, and (d) End game by Yen.
5) Arrange moveArrange move means the moves which are shifted from the current position to the better position either by Kei or Yen pieces.In arrange moves, both Kei and Yen have some conditions for moving one position to another position.But Kei has extra move as compared toYen.a) Kei and Yen arrange move: In Kei-Yen, there are different motive for arranging both by the Kei or the Yen.Kei arrange to the better position for killing the Yen, however, Yen arrange to the better position for trying to block all the way of Kei.In this arrange move, we check the current position first, then try to keep the better position on their respective turns.b) Condition check for arrangement move: The Kei-Yen game for condition check for arrangement move can be done by defining a two dimensional array ( )

,
a m n is at the even-even extremely end position where m n ≠ ,

Figure 3 .
Figure 3. Schematic diagram showing positions array on Kei-Yen traditional game board.

•
1 a m n + Properties of move C 4 : When ( ) , a m n is not position at the main diagonal position as well as not at extremely end point, then the current position has four possible moves, which means m = 1 & n = 1 or 3, m = 3 and n = 1 or 3 and n = 1.
a m n + .The Kei or Yen has not limitation for moving from the current position to another position when the current adjacent position has space for move.Pseudo code of A 1 logic: For ( ) , a m n , if n is even number or odd number or m = n or same number, then, • When ( ) , a m n is at the same number means either m = n = even number or m = n = odd number but not at extremely end position, then ( ) , a m n has eight possible moves using Property to move C 3 .•When ( ) , a m n is at the extremely end corner position and even number position, means both 4 has three possible moves using Property to move C 2 .•When ( ) , a m n is at the extremely end position and even number position but not at extremely end corner position, means both 2 where m = n = even number, then ( ) , a m n has five possible moves using Property to move C 1 .Example: If the current piece position is ( ) 2, 2 a means m = 2 & n = 2 (same position), then either Kei or Yen can move using Properties to move C 3 i.e.,

,
a m n , where m = even number and n = odd number 0, if m = even number and n = odd number, then• When ( ), a m n is not at the extremely end current position means m = 2 and n = 1 or 3 then ( ) , a m n has four possible moves using Property to move C 4 .• When ( ) , a m n is at the extremely end current position means either m = 0 or 4 and n = 1 or 3 respectively or vice-versa, then ( ) , a m n has three possible moves using Property to move C 2 .Odd-even check condition In odd-ven condition, m = odd number and n = even number.Property to move A 3 : The piece at position ( ) , a m n , where m = odd numbers or n = even number with , if m = odd number and n = even number, then • When a(m,n) is not at the extremely end current position means m = 1 or 3 and n = 2 then a(m,n) has four possible moves using Property to move C 4 .

,Figure 4 .
Figure 4. Flow chart for the Kei-Yen traditional game.