public int AggresiveMove(int playerID, GameMatrix gm)
    {
        int pWinCheck = PrimaryWinMove(playerID, gm);

        if (pWinCheck != 0)
        {
            return(pWinCheck);
        }

        int pBlockCheck = PrimaryBlockMove(playerID, gm);

        if (pBlockCheck != 0)
        {
            return(pBlockCheck);
        }

        int best     = 0;
        int bestmove = 0;

        for (int iii = 1; iii < 10; iii++)
        {
            if (gm.MoveLegal(iii))
            {
                int value = gm.calculateAttackScore(iii, playerID);
                if (value >= best)
                {
                    bestmove = iii;
                    best     = value;
                }
            }
        }
        return(bestmove);
    }
 private int PrimaryWinMove(int playerID, GameMatrix gm)
 {
     for (int iii = 1; iii < 10; iii++)
     {
         if (gm.MoveLegal(iii))
         {
             if (gm.MoveWinner(iii, playerID) == playerID)
             {
                 return(iii);
             }
         }
     }
     return(0);
 }
    void MakeMove()
    {
        int playerID = (turn % 3) + 1;

        if (sm.CanPlay())
        {
            int move = 0;
            if (isHumanTurn(playerID))
            {
                move = HumanMove();
            }
            else
            {
                //Debug.Log("AI check was entered");
                if (Input.GetKeyDown(KeyCode.Return))
                {
                    //Debug.Log("Enter was hit");
                    move = AIMove(playerID);
                }
            }
            if (gm.MoveLegal(move))
            {
                sm.SpawnSequence(playerID, move);
                //Debug.Log(gm.calculateAttackScore(move, playerID));
                gm.RegisterMove(move, playerID);
                winner = gm.CheckForWin();
                turn++;
                int newPlayerID = (turn % 3) + 1;
                wm.TurnChange(newPlayerID);
                if (winner != 0)
                {
                    wm.WinSequence(winner);
                }
            }
        }
    }
    private int PrimaryBlockMove(int playerID, GameMatrix gm)
    {
        int nextPlayer;

        if (playerID == 3)
        {
            nextPlayer = 1;
        }
        else
        {
            nextPlayer = playerID + 1;
        }
        for (int iii = 1; iii < 10; iii++)
        {
            if (gm.MoveLegal(iii))
            {
                if (gm.MoveWinner(iii, nextPlayer) == nextPlayer)
                {
                    return(iii);
                }
            }
        }
        return(0);
    }