Example #1
0
    public void AISelection()
    {
        Ai ai2 = player2.ai;

        int card = ai2.MyTurn();

        Debug.Log("Now" + turn + "th turn Ai select " + card);
        SelectCardAIVSPlayer(player2.hand[card]);
        if (player1.point >= 7)
        {
            Debug.Log("player1 win");
            Debug.Log("player1 gets " + player1.CalculatePoint());
            Debug.Log("player2 gets " + player2.CalculatePoint());
            ai2.GameFinish(1);
            StartRealGame();
        }
        else if (player2.point >= 7)
        {
            Debug.Log("player2 win");
            Debug.Log("player1 gets " + player1.CalculatePoint());
            Debug.Log("player2 gets " + player2.CalculatePoint());
            ai2.GameFinish(0);
            StartRealGame();
        }
    }
Example #2
0
    public void StartAI()
    {
        Ai ai1 = player1.ai;
        Ai ai2 = player2.ai;

        while (turn < 20 && player1.point < 7 && player2.point < 7)
        {
            if (turn % 2 == 0)
            {
                int card = ai1.MyTurn();
                SelectCard(player1.hand[card]);
            }

            else
            {
                int card = ai2.MyTurn();
                SelectCard(player2.hand[card]);
            }
        }
        if (player1.point >= 7)
        {
            ai1win++;
            ai1.GameFinish(0);
            ai2.GameFinish(1);
        }
        else if (player2.point >= 7)
        {
            ai2win++;
            ai2.GameFinish(0);
            ai1.GameFinish(1);
        }
        else
        {
            ai1.GameFinish(0);
            ai1.GameFinish(1);
            ai2.GameFinish(0);
            ai2.GameFinish(1);
        }
        if (gamenumber < 7000)
        {
            StartReGame();
        }
        else
        {
            gaming     = false;
            realgaming = true;
            StartRealGame();
        }
    }