There are five distinct first moves for red. They are as below:
Analyzing Board 11There are three distinct first moves for green that block red forming the third row. They are as below:
In Board 111 and Board 112 green has created a fork and wins. But in Board 113 there is no fork created by green and the game continues.
Analyzing Board 113There are two distinct moves for red to avoid losing and they are as follows:
No fork is created.
Analyzing the first two movesAs mentioned earlier there are five distinct first moves. Among them four first moves are bad as they lead to a fork by green.
The only legitimate first two moves are given below and the game continues there after.
Perfect PlayUnder perfect play where you know the best move in any situation, the game continues forever. The game finishes with a decision as soon as one does a
mistake.
Broken DiagonalAlong with three rows, three columns and two diagonal if we introduce four broken diagonals (two forward and two backward), as per my analysis so far, the first player loses.
However when playing in a four by four board with four red coins and four green coins considering wins with four rows and four columns, we may introduced four forward diagonals and four backward diagonals (including broken diagonals) to make the game more interesting.
Algorithm for Computer Play
The possible nine moves in any situations can be given priorities as follows and one may play the highest priority move where ties are a possibility.
Winning Move - Priority 1
Losing move - Priority 10
Creating Double Winning Possibilities (Fork) - Priority 2
Creating Single Winning Possibility - Priority 3
Other Moves - Priority 5
This strategy is working fine for a four by four board with broken diagonals. However, if we consider three by three board, all the first five moves have priority three and cannot be distinguished. But we know except one move others lead to a loss.
To tackle the situation a winning score, varying between -1 to +1 can be calculated. The winning score of a move is the average of the negatives of winning scores of opponents next nine moves. So the winning score of a move can be calculated recursively up to a certain depth and the move with highest winning score can be played. For a winning move, the score is +1.
A combination of the prioritizing strategy and the winning score strategy is working _ne in my computer.
RemarksI have no clue whether such a game is already designed or not. Any help with reference will be appreciated.