Beispiel #1
0
    void Choice()
    {
        do
        {
            bool isLoop = true;
            do
            {
                switch (GetBestChoice(resultInfo.dealerIdx))
                {
                case ChoiceKind.Hit:

                    GetCardPlayer();

                    isLoop = (!player.GetCurrentHand.IsStopChoice && PreferHit(resultInfo.dealerIdx));

                    break;

                case ChoiceKind.Stand:
                    isLoop = false;
                    break;

                case ChoiceKind.DoubleDown:

                    player.DoubleDown();

                    GetCardPlayer();

                    isLoop = false;

                    break;

                case ChoiceKind.Split:

                    AI_PlayerHand secondHand = player.Split(player.GetCurrentHand.IsDoubleAce);
                    GetCardPlayer();

                    AI_Card secondCard = deck.Pop();
                    player.AddCCNumber(secondCard.cardCountingScore);
                    secondHand.Push(secondCard, false);

                    break;

                case ChoiceKind.Surrender:

                    player.GetCurrentHand.AmountOfBetting = 0;
                    player.GetCurrentHand.IsSurrender     = true;
                    isLoop = false;

                    break;

                case ChoiceKind.NotDetermined:

                    isLoop = false;

                    break;
                }
            } while (isLoop && !player.GetCurrentHand.IsStopChoice);
        } while(player.UpdateAndCheckAllPossibleHand());
    }
Beispiel #2
0
    public void GetCard(AI_Card card)
    {
        AI_PlayerHand hand = GetCurrentHand;

        bool isFirstHand = false;

        // 카드 추가전에 계산되기 때문에
        // 조건 수치를 2->1로 줄인다(origin=IsFirstHand)
        if (hands.Count == 1 && hands[0].GetCardCount <= 1)
        {
            isFirstHand = true;
        }

        hand.Push(card, isFirstHand); // (in)카드 하이라이트 +
    }
Beispiel #3
0
    public AI_PlayerHand Split(bool isAce)
    {
        AI_Card card = GetCurrentHand.Pop();
        float   bet  = GetCurrentHand.AmountOfBetting;

        AI_PlayerHand splitHand = AddHand();

        if (isAce)
        {
            GetCurrentHand.SetSplitAce();
            splitHand.SetSplitAce();
        }

        // 그 핸드에 정보 전달
        splitHand.Push(card, false);
        splitHand.Betting();

        return(splitHand);
    }
Beispiel #4
0
    void Choice()
    {
        ChoiceKind curChoice = ChoiceKind.NotDetermined;

        do
        {
            if (IsFirstChoiceNotDetermined())
            {
                ReadOnlyCollection <ChoiceKind> possibleOptions = GetPossibleOptions();

                curChoice = possibleOptions[Random.Range(0, possibleOptions.Count)];

                resultInfo.firstChoice = curChoice;
            }
            else
            {
                curChoice = GetBestChoice(resultInfo.dealerIdx);
            }

            while (true)
            {
                bool loop = true;

                switch (curChoice)
                {
                case ChoiceKind.Hit:
                    GetCardPlayer();

                    loop = (!player.GetCurrentHand.IsStopChoice && PreferHit(resultInfo.dealerIdx));

                    break;

                case ChoiceKind.Stand:
                    loop = false;
                    break;

                case ChoiceKind.DoubleDown:

                    player.DoubleDown();

                    int  preCount  = player.CCNumber;
                    int  preValue  = (int)player.GetCurrentHand.value;
                    bool isPreSoft = player.GetCurrentHand.IsSoft;

                    GetCardPlayer();

                    if (preValue >= 12 && isPreSoft == false)
                    {
                        if (player.GetCurrentHand.value == HAND_VALUE.BURST_PLAYER)
                        {
                            DB_Manager.Instance.AddBurstInfo(preCount, preValue);
                        }
                        else
                        {
                            DB_Manager.Instance.AddNotBurstInfo(preCount, preValue);
                        }
                    }

                    loop = false;

                    break;

                case ChoiceKind.Split:

                    AI_PlayerHand secondHand = null;
                    AI_Card       secondCard = deck.Pop();

                    player.AddCCNumber(secondCard.cardCountingScore);

                    secondHand = player.Split(player.GetCurrentHand.IsDoubleAce);
                    GetCardPlayer();
                    secondHand.Push(secondCard, false);

                    curChoice = GetBestChoice(resultInfo.dealerIdx);
                    loop      = (curChoice != ChoiceKind.Stand);

                    break;

                case ChoiceKind.Surrender:

                    player.GetCurrentHand.AmountOfBetting = 0;
                    player.GetCurrentHand.IsSurrender     = true;
                    loop = false;

                    break;

                case ChoiceKind.NotDetermined:

                    Debug.LogError("Stand is base choice, so whatever else should be determined in this stage");
                    loop = false;
                    break;
                }

                if (loop == false)
                {
                    break;
                }
            }
        } while (player.UpdateAndCheckAllPossibleHand());
    }