Exemplo n.º 1
0
        public void ShouldCreateACardInstance(string input, CardValueType cardValueType, SuitType suitType)
        {
            var card = new Card(input);

            Assert.Equal(cardValueType, card.ValueType);
            Assert.Equal(suitType, card.Suit);
        }
Exemplo n.º 2
0
    public void SetValue(int newValue, CardValueType type)
    {
        switch (type)
        {
        case CardValueType.Cost:
            if (newValue < 0)
            {
                newValue = 0;
            }
            Cost = newValue;
            break;

        case CardValueType.Attack:
            if (newValue < 0)
            {
                newValue = 0;
            }
            Attack = newValue;
            break;

        case CardValueType.Defense:
            if (newValue <= 0)
            {
                Assert.AreEqual(State, CardState.Idle);
                EnterState(CardState.Dead);
            }

            Defense = newValue;
            break;
        }

        ValueChanged?.Invoke(this, newValue, type);
    }
Exemplo n.º 3
0
    public void OnValueChanged(CardController card, int newValue, CardValueType type)
    {
        TextMeshProUGUI textToChange = null;

        switch (type)
        {
        case CardValueType.Cost:
            textToChange = CostText;
            break;

        case CardValueType.Attack:
            textToChange = AttackText;
            break;

        case CardValueType.Defense:
            textToChange = DefenseText;
            break;
        }

        textToChange.text = newValue.ToString();

        _canvas.sortingOrder += 3; // Bring the card to the top.

        // Animate the number.
        DOTween.Punch(() => { return(textToChange.transform.localScale); }, (Vector3 newScale) => { textToChange.transform.localScale = newScale; }, new Vector3(1.0f, 1.0f), 0.5f, 5);
    }
Exemplo n.º 4
0
        /// <summary>
        /// 建立抽牌堆
        /// </summary>
        /// <param name="settings">遊戲設定</param>
        public DrawPile(GameSettings settings)
        {
            // NOTE: 各色牌都有 3張1 2張2,3,4 1張5
            CardValueType[] values =
            {
                CardValueType.Value1, CardValueType.Value1, CardValueType.Value1,
                CardValueType.Value2, CardValueType.Value2,
                CardValueType.Value3, CardValueType.Value3,
                CardValueType.Value4, CardValueType.Value4,
                CardValueType.Value5
            };

            int cardNumber = ( int )settings.ColorCount * values.Length;

            CardIndexType[] indeies = new CardIndexType[cardNumber];
            for (int count = 0; count < cardNumber; ++count)
            {
                indeies[count] = new CardIndexType(count);
            }
            GameBoard.RandomSort(indeies);

            Card[] tempCards = new Card[cardNumber];
            for (int count = 0; count < cardNumber; ++count)
            {
                CardColorType color  = ( CardColorType )(((count / 10) + 1) * 10);
                CardValueType number = values[count % 10];
                tempCards[count] = new Card(new CardIdType(count), indeies[count], color, number);
            }
            GameBoard.RandomSort(tempCards);

            Pile = new Queue <Card>(tempCards);
        }
Exemplo n.º 5
0
        public void ShouldReturnTheIntValueForCardValueTypeEnum()
        {
            const CardValueType valEnum = CardValueType.A;

            const int intVal = (int)valEnum;

            Assert.Equal(14, intVal);
        }
Exemplo n.º 6
0
 public Card(CardIdType id, CardIndexType index, CardColorType color, CardValueType value)
 {
     this.Id          = id;
     this.Index       = index;
     this.Color       = color;
     this.Value       = value;
     this.Information = new CardInformation();
 }
Exemplo n.º 7
0
 /// <summary>
 /// 提示此牌的數字
 /// </summary>
 /// <param name="promptValue">提示的數字</param>
 /// <param name="realValue">牌的數字</param>
 public void Prompt(CardValueType promptValue, CardValueType realValue)
 {
     if (promptValue == realValue)
     {
         this.Value = realValue;
     }
     else if (!ImpossiblePrompt.Contains(( PromptInformation )promptValue))
     {
         ImpossiblePrompt.Add(( PromptInformation )promptValue);
     }
 }
Exemplo n.º 8
0
    public bool AddCardValue(int cardIndex, int amount, CardValueType type)
    {
        CardController card = Cards[cardIndex];

        if (card.State != CardState.Idle)
        {
            return(false);
        }

        int currentValue = card.GetValue(type);

        card.SetValue(currentValue + amount, type);

        return(true);
    }
Exemplo n.º 9
0
        /// <summary>
        /// 傳遞訊息
        ///   消耗 1個藍色傳達指示物,若已無未消耗藍色傳達指示物,則不可執行此行動。
        ///   告訴另一玩家其手牌的線索
        ///   提供線索須遵循以下原則:
        ///     只能就玩家手牌內的某種顏色或某種數字提供線索
        /// </summary>
        /// <param name="value">提示的數字</param>
        /// <param name="player">被提示的玩家</param>
        /// <param name="board">遊戲資訊</param>
        /// <returns>提示結果</returns>
        public PromptCardResult PromptCard(CardValueType value, IHanabiPlayer player, GameBoard board)
        {
            if (value == CardValueType.Unknown)
            {
                return(PromptCardResult.InvalidPrompt);
            }

            if (!board.Use())
            {
                return(PromptCardResult.PromptEmpty);
            }

            player.PromptCard(value);
            return(PromptCardResult.Success);
        }
Exemplo n.º 10
0
        public void PromptCard(CardValueType value)
        {
            foreach (var card in Cards)
            {
                if (card.Value == value)
                {
                    card.Information.Value = value;
                }
                else
                {
                    card.Information.ImpossiblePrompt.Add(( PromptInformation )value);
                }
            }

            CheckIsLastTurn();
        }
Exemplo n.º 11
0
    public int GetValue(CardValueType type)
    {
        switch (type)
        {
        case CardValueType.Cost:
            return(Cost);

        case CardValueType.Attack:
            return(Attack);

        case CardValueType.Defense:
            return(Defense);
        }

        return(int.MinValue);
    }
Exemplo n.º 12
0
        private void setMultiples(int sameValueCount, CardValueType lastCardValue)
        {
            if (sameValueCount == 2)
            {
                ++doubles;

                if (lastCardValue >= CardValueType.Jack)
                {
                    isJacks = true;
                }
            }
            else if (sameValueCount == 3)
            {
                isTriple = true;
            }
            else if (sameValueCount == 4)
            {
                isQuadruple = true;
            }
        }
Exemplo n.º 13
0
    public void MutateCard()
    {
        int numCards = CardManager.Cards.Count;

        if (numCards < 1)
        {
            return;
        }

        int           amount = UnityEngine.Random.Range(Config.MinCardDamage, Config.MaxCardDamage);
        CardValueType type   = (CardValueType)UnityEngine.Random.Range(0, _numValueTypes);

        bool didChange = false;

        while (!didChange)
        {
            didChange = CardManager.AddCardValue(_currentCardIndex, amount, type);

            _currentCardIndex++;
            _currentCardIndex %= numCards;
        }
    }
Exemplo n.º 14
0
Arquivo: Card.cs Projeto: MrBek/Poker
 public Card(CardSuiteType suite, CardValueType value)
 {
     this.suite = suite;
     this.value = value;
 }
Exemplo n.º 15
0
Arquivo: Card.cs Projeto: MrBek/Poker
 public void Read(BinaryReader reader)
 {
     suite = (CardSuiteType)reader.ReadByte();
     value = (CardValueType)reader.ReadByte();
 }
Exemplo n.º 16
0
        public static PlayerAction BigStackMethod(GetTurnContext context, CardValueType preFlopCards, Card firstCard, Card secondCard, IReadOnlyCollection <Card> communityCards)
        {
            List <Card> currentCards = new List <Card>();

            currentCards.Add(firstCard);
            currentCards.Add(secondCard);

            if (context.RoundType == GameRoundType.PreFlop)
            {
                if (context.MoneyLeft / context.SmallBlind > 50)
                {
                    if (!context.CanCheck && context.MyMoneyInTheRound == context.SmallBlind)
                    {
                        // we are first and we can paid SmallBlind , can Raise and can Fold
                        return(CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 7, 9));
                    }
                    else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind)
                    {
                        // oppponent is first and has raised with moneyToCall - opponent has raised pre-flop
                        // we can Re-Raise (very strong hand only) - we can call (Verystrong or string) - we Fold
                        return(CustomPlayerActions.PassivePlayerActionPreFlop(context, preFlopCards, 11, 21));
                    }
                    else if (context.CanCheck)
                    {
                        // opponet is first and he has paid SmallBlind
                        // we can check or raise here
                        return(CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 8, 11));
                    }

                    return(PlayerAction.CheckOrCall());
                }
                else if (context.MoneyLeft / context.SmallBlind > 15 && (context.MoneyLeft / context.SmallBlind <= 50))
                {
                    if (!context.CanCheck && context.MyMoneyInTheRound == context.SmallBlind)
                    {
                        // we are first and we can paid SmallBlind , can Raise and can Fold
                        return(CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 8, 11));
                    }
                    else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind)
                    {
                        // oppponent is first and has raised with moneyToCall - opponent has raised pre-flop
                        // we can Re-Raise (very strong hand only) - we can call (Verystrong or string) - we Fold
                        return(CustomPlayerActions.PassivePlayerActionPreFlop(context, preFlopCards, 11, 21));
                    }
                    else if (context.CanCheck)
                    {
                        // opponet is first and he has paid SmallBlind
                        // we can check or raise here
                        return(CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 8, 14));
                    }

                    return(PlayerAction.CheckOrCall());
                }
                else if (context.MoneyLeft / context.SmallBlind <= 15)
                {
                    if (!context.CanCheck && context.MyMoneyInTheRound == context.SmallBlind)
                    {
                        // we are first and we can paid SmallBlind , can Raise and can Fold
                        return(CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 9, 14));
                    }
                    else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind)
                    {
                        // oppponent is first and has raised with moneyToCall - opponent has raised pre-flop
                        // we can Re-Raise (very strong hand only) - we can call (Verystrong or string) - we Fold
                        return(CustomPlayerActions.PassivePlayerActionPreFlop(context, preFlopCards, 11, 21));
                    }
                    else if (context.CanCheck)
                    {
                        // opponet is first and he has paid SmallBlind
                        // we can check or raise here
                        return(CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 10, 14));
                    }

                    return(PlayerAction.CheckOrCall());
                }

                return(CustomPlayerActions.CheckOrFoldCustomAction(context));
            }
            else if (context.RoundType == GameRoundType.Flop)
            {
                // TODO
                // add strong logic for FLOP
                // (do we have good card conmbination from our 2 cards and the floppef 3 cards)
                // иif we have already played aggresivly (all-in) we should check/call
                // if NOT god combination - we can check or fold
                // if strong combination we can put more agressiong and raise/all-in
                currentCards.AddRange(communityCards);

                var combination = Logic.Helpers.Helpers.GetHandRank(currentCards);

                if (CustomHandStreightChecks.GotStrongHand(combination))
                {
                    if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
                    {
                        return(CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 2, 12));
                    }
                    else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
                    {
                        return(CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 2, 14));
                    }

                    return(PlayerAction.CheckOrCall());
                }
                else
                {
                    // TODO add here a method to see if we have chance to make good hand and add logic
                    if (context.MoneyLeft > 0)
                    {
                        return(CustomPlayerActions.PassivePlayerAction(context, combination, 6, 8));
                    }

                    return(CustomPlayerActions.CheckOrFoldCustomAction(context));
                }

                // return PlayerAction.CheckOrCall();
            }
            else if (context.RoundType == GameRoundType.Turn)
            {
                // TODO
                // add strong logic for FLOP
                // (do we have good card conmbination from our 2 cards and the floppef 4 cards)
                // иif we have already played aggresivly (all-in) we should check/call
                // if NOT god combination - we can check or fold
                // if strong combination we can put more agressiong and raise/all-in
                currentCards.Clear();
                currentCards.Add(firstCard);
                currentCards.Add(secondCard);
                currentCards.AddRange(communityCards);

                var combination = Logic.Helpers.Helpers.GetHandRank(currentCards);

                if (CustomHandStreightChecks.GotStrongHand(combination))
                {
                    if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
                    {
                        return(CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 2, 12));
                    }
                    else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
                    {
                        return(CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 2, 15));
                    }

                    return(PlayerAction.CheckOrCall());
                }
                else
                {
                    // TODO add here a method to see if we have chance to make good hand and add logic
                    if (context.MoneyLeft > 0)
                    {
                        return(CustomPlayerActions.PassivePlayerAction(context, combination, 6, 8));
                    }

                    return(CustomPlayerActions.CheckOrFoldCustomAction(context));
                }
            }
            else
            {
                // GameRoundType.River (final card)
                // TODO
                // add strong logic for FLOP
                // (do we have good card conmbination from our 2 cards and the floppef 5 cards)
                // иif we have already played aggresivly (all-in) we should check/call
                // if NOT god combination - we can check or fold
                // if strong combination we can put more agressiong and raise/all-in
                currentCards.Clear();
                currentCards.Add(firstCard);
                currentCards.Add(secondCard);
                currentCards.AddRange(communityCards);

                var combination = Logic.Helpers.Helpers.GetHandRank(currentCards);

                if (CustomHandStreightChecks.GotStrongHand(combination))
                {
                    if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
                    {
                        return(CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 2, 18));
                    }
                    else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
                    {
                        return(CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 2, 15));
                    }

                    return(PlayerAction.CheckOrCall());
                }
                else
                {
                    // TODO add here a method to see if we have chance to make good hand and add logic
                    if (context.MoneyLeft > 0)
                    {
                        return(CustomPlayerActions.PassivePlayerAction(context, combination, 6, 8));
                    }

                    return(CustomPlayerActions.CheckOrFoldCustomAction(context));
                }
            }
        }
Exemplo n.º 17
0
Arquivo: Card.cs Projeto: sgww/cozy
 public Card(CardValueType v, CardSuiteType s)
 {
     Value = v;
     Suite = s;
 }
Exemplo n.º 18
0
        public static PlayerAction SmallStackrMethod(GetTurnContext context, CardValueType preFlopCards, Card firstCard, Card secondCard, IReadOnlyCollection<Card> communityCards)
        {
            List<Card> currentCards = new List<Card>();
            currentCards.Add(firstCard);
            currentCards.Add(secondCard);

            if (context.RoundType == GameRoundType.PreFlop)
            {
                if (context.MoneyLeft / context.SmallBlind > 50)
                {
                    if (!context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind)
                    {
                        // we are first and we can paid SmallBlind , can Raise and can Fold
                        return CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 6, 8);
                    }
                    else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind)
                    {
                        // oppponent is first and has raised with moneyToCall - opponent has raised pre-flop
                        // we can Re-Raise (very strong hand only) - we can call (Verystrong or string) - we Fold
                        return CustomPlayerActions.PassivePlayerActionPreFlop(context, preFlopCards, 11, 21);
                    }
                    else if (context.CanCheck)
                    {
                        // opponet is first and he has paid SmallBlind
                        // we can check or raise here
                        return CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 7, 9);
                    }

                    return PlayerAction.CheckOrCall();
                }
                else if (context.MoneyLeft / context.SmallBlind > 15 && (context.MoneyLeft / context.SmallBlind <= 50))
                {
                    if (!context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind)
                    {
                        // we are first and we can paid SmallBlind , can Raise and can Fold
                        return CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 7, 10);
                    }
                    else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind)
                    {
                        // oppponent is first and has raised with moneyToCall - opponent has raised pre-flop
                        // we can Re-Raise (very strong hand only) - we can call (Verystrong or string) - we Fold
                        return CustomPlayerActions.PassivePlayerActionPreFlop(context, preFlopCards, 11, 21);
                    }
                    else if (context.CanCheck)
                    {
                        // opponet is first and he has paid SmallBlind
                        // we can check or raise here
                        return CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 7, 12);
                    }

                    return PlayerAction.CheckOrCall();
                }
                else if (context.MoneyLeft / context.SmallBlind <= 15)
                {
                    if (!context.CanCheck && context.MyMoneyInTheRound == context.SmallBlind)
                    {
                        // we are first and we can paid SmallBlind , can Raise and can Fold
                        return CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 8, 12);
                    }
                    else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind)
                    {
                        // oppponent is first and has raised with moneyToCall - opponent has raised pre-flop
                        // we can Re-Raise (very strong hand only) - we can call (Verystrong or string) - we Fold
                        return CustomPlayerActions.PassivePlayerActionPreFlop(context, preFlopCards, 11, 21);
                    }
                    else if (context.CanCheck)
                    {
                        // opponet is first and he has paid SmallBlind
                        // we can check or raise here
                        return CustomPlayerActions.AgressivePlayerActionPreflop(context, preFlopCards, 9, 14);
                    }

                    return PlayerAction.CheckOrCall();
                }

                return CustomPlayerActions.CheckOrFoldCustomAction(context);
            }
            else if (context.RoundType == GameRoundType.Flop)
            {
                // TODO
                // add strong logic for FLOP
                // (do we have good card conmbination from our 2 cards and the floppef 3 cards)
                // иif we have already played aggresivly (all-in) we should check/call
                // if NOT god combination - we can check or fold
                // if strong combination we can put more agressiong and raise/all-in
                currentCards.AddRange(communityCards);

                var combination = Logic.Helpers.Helpers.GetHandRank(currentCards);

                if (CustomHandStreightChecks.GotStrongHand(combination))
                {
                    if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
                    {
                        return CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 8, 10);
                    }
                    else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
                    {
                        return CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 10, 12);
                    }

                    return PlayerAction.CheckOrCall();
                }
                else
                {
                    // TODO add here a method to see if we have chance to make good hand and add logic
                    if (context.MoneyLeft > 0 && context.MoneyToCall <= context.SmallBlind * 2)
                    {
                        return PlayerAction.CheckOrCall();
                    }

                    return CustomPlayerActions.CheckOrFoldCustomAction(context);
                }
            }
            else if (context.RoundType == GameRoundType.Turn)
            {
                // TODO
                // add strong logic for FLOP
                // (do we have good card conmbination from our 2 cards and the floppef 4 cards)
                // иif we have already played aggresivly (all-in) we should check/call
                // if NOT god combination - we can check or fold
                // if strong combination we can put more agressiong and raise/all-in
                currentCards.Clear();
                currentCards.Add(firstCard);
                currentCards.Add(secondCard);
                currentCards.AddRange(communityCards);

                var combination = Logic.Helpers.Helpers.GetHandRank(currentCards);

                if (CustomHandStreightChecks.GotStrongHand(combination))
                {
                    if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
                    {
                        return CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 8, 10);
                    }
                    else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
                    {
                        return CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 10, 12);
                    }
                    else
                    {
                        return CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 6, 8);
                    }
                }
                else
                {
                    // TODO add here a method to see if we have chance to make good hand and add logic
                    if (context.MoneyLeft > 0 && context.MoneyToCall <= context.SmallBlind * 2)
                    {
                        return PlayerAction.CheckOrCall();
                    }

                    return CustomPlayerActions.CheckOrFoldCustomAction(context);
                }
            }
            else
            {
                // GameRoundType.River (final card)
                // TODO
                // add strong logic for FLOP
                // (do we have good card conmbination from our 2 cards and the floppef 5 cards)
                // иif we have already played aggresivly (all-in) we should check/call
                // if NOT god combination - we can check or fold
                // if strong combination we can put more agressiong and raise/all-in
                currentCards.Clear();
                currentCards.Add(firstCard);
                currentCards.Add(secondCard);
                currentCards.AddRange(communityCards);

                var combination = Logic.Helpers.Helpers.GetHandRank(currentCards);

                if (CustomHandStreightChecks.GotStrongHand(combination))
                {
                    if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
                    {
                        return CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 8, 10);
                    }
                    else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
                    {
                        return CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 10, 12);
                    }
                    else
                    {
                        return CustomPlayerActions.AgressivePlayerAction(context, preFlopCards, combination, 6, 8);
                    }
                }
                else
                {
                    // TODO add here a method to see if we have chance to make good hand and add logic
                    if (context.MoneyLeft > 0 && context.MoneyToCall <= context.SmallBlind * 2)
                    {
                        return PlayerAction.CheckOrCall();
                    }

                    return CustomPlayerActions.CheckOrFoldCustomAction(context);
                }
            }
        }
Exemplo n.º 19
0
Arquivo: Card.cs Projeto: xxy1991/cozy
 public Card(CardValueType v, CardSuiteType s)
 {
     Value = v;
     Suite = s;
 }
 public static PlayerAction AgressivePlayerAction(GetTurnContext context, CardValueType preFlopCards, HandRankType combination, int potMultiplier, int raiseSbMultipliyer)
 {
     if (preFlopCards == CardValueType.Recommended)
     {
         if (CustomHandStreightChecks.GotStrongHand(combination))
         {
             if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
             {
                 if ((context.MoneyToCall > context.CurrentPot / 2 || context.MoneyToCall > context.SmallBlind * 14) &&
                     context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
                 else if (context.MoneyLeft >= context.SmallBlind * raiseSbMultipliyer)
                 {
                     return(PlayerAction.Raise(context.CurrentPot * potMultiplier));
                 }
                 else
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
             }
             else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
             {
                 if (!context.CanCheck &&
                     (context.MoneyToCall > context.CurrentPot / 2 * 3 || context.MoneyToCall > context.SmallBlind * 20) &&
                     context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
                 else if (context.MoneyLeft >= context.SmallBlind * raiseSbMultipliyer)
                 {
                     return(PlayerAction.Raise(context.CurrentPot * potMultiplier));
                 }
                 else
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
             }
             else
             {
                 if (context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.SmallBlind * 6));
                 }
                 else
                 {
                     return(PlayerAction.CheckOrCall());
                 }
             }
         }
         else
         {
             if (context.CanCheck && context.MoneyLeft > 0 && context.MyMoneyInTheRound == 0)
             {
                 return(PlayerAction.Raise((context.SmallBlind * raiseSbMultipliyer) - context.SmallBlind));
             }
             else if (context.MoneyToCall <= context.SmallBlind * 2)
             {
                 return(PlayerAction.CheckOrCall());
             }
             else
             {
                 return(CheckOrFoldCustomAction(context));
             }
         }
     }
     else if (preFlopCards == CardValueType.NotRecommended || preFlopCards == CardValueType.Risky)
     {
         if (CustomHandStreightChecks.GotStrongHand(combination))
         {
             if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
             {
                 if (!context.CanCheck &&
                     (context.MoneyToCall > context.SmallBlind * 10) &&
                     context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
                 else if (context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.CurrentPot * potMultiplier));
                 }
                 else
                 {
                     return(CheckOrFoldCustomAction(context));
                 }
             }
             else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
             {
                 if (!context.CanCheck &&
                     (context.MoneyToCall > context.CurrentPot / 2 * 3 || context.MoneyToCall > context.SmallBlind * 20) &&
                     context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
                 else if (context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.CurrentPot * potMultiplier));
                 }
                 else
                 {
                     return(CheckOrFoldCustomAction(context));
                 }
             }
             else
             {
                 if (context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.SmallBlind * 6));
                 }
                 else
                 {
                     return(CheckOrFoldCustomAction(context));
                 }
             }
         }
         else
         {
             if (context.CanCheck && context.MoneyLeft > 0 && context.MyMoneyInTheRound == 0)
             {
                 return(PlayerAction.CheckOrCall());
             }
             else if (context.MoneyToCall <= context.SmallBlind * 2)
             {
                 return(PlayerAction.CheckOrCall());
             }
             else
             {
                 return(CheckOrFoldCustomAction(context));
             }
         }
     }
     else
     {
         if (CustomHandStreightChecks.GotStrongHand(combination))
         {
             if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
             {
                 if (!context.CanCheck &&
                     (context.MoneyToCall > context.CurrentPot / 2 || context.MoneyToCall > context.SmallBlind * 14) &&
                     context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
                 else if (context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.CurrentPot * potMultiplier));
                 }
                 else
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
             }
             else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
             {
                 if (!context.CanCheck &&
                     (context.MoneyToCall > context.CurrentPot / 2 * 3 || context.MoneyToCall > context.SmallBlind * 20) &&
                     context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
                 else if (context.MoneyLeft >= context.SmallBlind * raiseSbMultipliyer)
                 {
                     return(PlayerAction.Raise(context.CurrentPot * potMultiplier));
                 }
                 else
                 {
                     return(PlayerAction.Raise(context.MoneyLeft));
                 }
             }
             else
             {
                 if (context.MoneyLeft > 0)
                 {
                     return(PlayerAction.Raise(context.SmallBlind * 6));
                 }
                 else
                 {
                     return(CheckOrFoldCustomAction(context));
                 }
             }
         }
         else
         {
             if (context.CanCheck && context.MoneyLeft > 0 && context.MyMoneyInTheRound == 0)
             {
                 return(PlayerAction.CheckOrCall());
             }
             else if (context.MoneyToCall <= context.SmallBlind * 2)
             {
                 return(PlayerAction.CheckOrCall());
             }
             else
             {
                 return(CheckOrFoldCustomAction(context));
             }
         }
     }
 }
Exemplo n.º 21
0
 public CardValue(CardValueType cardValueType)
 {
     CardValueType = cardValueType;
 }
 public static PlayerAction AgressivePlayerAction(GetTurnContext context, CardValueType preFlopCards, HandRankType combination, int potMultiplier, int raiseSbMultipliyer)
 {
     if (preFlopCards == CardValueType.Recommended)
     {
         if (CustomHandStreightChecks.GotStrongHand(combination))
         {
             if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
             {
                 if ((context.MoneyToCall > context.CurrentPot / 2 || context.MoneyToCall > context.SmallBlind * 14)
                     && context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
                 else if (context.MoneyLeft >= context.SmallBlind * raiseSbMultipliyer)
                 {
                     return PlayerAction.Raise(context.CurrentPot * potMultiplier);
                 }
                 else
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
             }
             else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
             {
                 if (!context.CanCheck
                     && (context.MoneyToCall > context.CurrentPot / 2 * 3 || context.MoneyToCall > context.SmallBlind * 20)
                     && context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
                 else if (context.MoneyLeft >= context.SmallBlind * raiseSbMultipliyer)
                 {
                     return PlayerAction.Raise(context.CurrentPot * potMultiplier);
                 }
                 else
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
             }
             else
             {
                 if (context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.SmallBlind * 6);
                 }
                 else
                 {
                     return PlayerAction.CheckOrCall();
                 }
             }
         }
         else
         {
             if (context.CanCheck && context.MoneyLeft > 0 && context.MyMoneyInTheRound == 0)
             {
                 return PlayerAction.Raise((context.SmallBlind * raiseSbMultipliyer) - context.SmallBlind);
             }
             else if (context.MoneyToCall <= context.SmallBlind * 2)
             {
                 return PlayerAction.CheckOrCall();
             }
             else
             {
                 return CheckOrFoldCustomAction(context);
             }
         }
     }
     else if (preFlopCards == CardValueType.NotRecommended || preFlopCards == CardValueType.Risky)
     {
         if (CustomHandStreightChecks.GotStrongHand(combination))
         {
             if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
             {
                 if (!context.CanCheck
                     && (context.MoneyToCall > context.SmallBlind * 10)
                     && context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
                 else if (context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.CurrentPot * potMultiplier);
                 }
                 else
                 {
                     return CheckOrFoldCustomAction(context);
                 }
             }
             else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
             {
                 if (!context.CanCheck
                     && (context.MoneyToCall > context.CurrentPot / 2 * 3 || context.MoneyToCall > context.SmallBlind * 20)
                     && context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
                 else if (context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.CurrentPot * potMultiplier);
                 }
                 else
                 {
                     return CheckOrFoldCustomAction(context);
                 }
             }
             else
             {
                 if (context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.SmallBlind * 6);
                 }
                 else
                 {
                     return CheckOrFoldCustomAction(context);
                 }
             }
         }
         else
         {
             if (context.CanCheck && context.MoneyLeft > 0 && context.MyMoneyInTheRound == 0)
             {
                 return PlayerAction.CheckOrCall();
             }
             else if (context.MoneyToCall <= context.SmallBlind * 2)
             {
                 return PlayerAction.CheckOrCall();
             }
             else
             {
                 return CheckOrFoldCustomAction(context);
             }
         }
     }
     else
     {
         if (CustomHandStreightChecks.GotStrongHand(combination))
         {
             if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination))
             {
                 if (!context.CanCheck
                     && (context.MoneyToCall > context.CurrentPot / 2 || context.MoneyToCall > context.SmallBlind * 14)
                     && context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
                 else if (context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.CurrentPot * potMultiplier);
                 }
                 else
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
             }
             else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination))
             {
                 if (!context.CanCheck
                     && (context.MoneyToCall > context.CurrentPot / 2 * 3 || context.MoneyToCall > context.SmallBlind * 20)
                     && context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
                 else if (context.MoneyLeft >= context.SmallBlind * raiseSbMultipliyer)
                 {
                     return PlayerAction.Raise(context.CurrentPot * potMultiplier);
                 }
                 else
                 {
                     return PlayerAction.Raise(context.MoneyLeft);
                 }
             }
             else
             {
                 if (context.MoneyLeft > 0)
                 {
                     return PlayerAction.Raise(context.SmallBlind * 6);
                 }
                 else
                 {
                     return CheckOrFoldCustomAction(context);
                 }
             }
         }
         else
         {
             if (context.CanCheck && context.MoneyLeft > 0 && context.MyMoneyInTheRound == 0)
             {
                 return PlayerAction.CheckOrCall();
             }
             else if (context.MoneyToCall <= context.SmallBlind * 2)
             {
                 return PlayerAction.CheckOrCall();
             }
             else
             {
                 return CheckOrFoldCustomAction(context);
             }
         }
     }
 }
Exemplo n.º 23
0
 public Card(CardSuitType suit, CardValueType value)
 {
     Suit  = suit;
     Value = value;
 }
        public static PlayerAction PassivePlayerActionPreFlop(GetTurnContext context, CardValueType preFlopCards, int raiseAmount, int pushAmount)
        {
            if (preFlopCards != CardValueType.Unplayable)
            {
                if (preFlopCards == CardValueType.NotRecommended)
                {
                    if (context.MoneyLeft > 0)
                    {
                        if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind)
                        {
                            return PlayerAction.Raise(context.SmallBlind * raiseAmount);
                        }
                        else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind)
                        {
                            return CheckOrFoldCustomAction(context);
                        }
                        else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 11)
                        {
                            return CheckOrFoldCustomAction(context);
                        }
                        else if (!context.CanCheck && context.MoneyToCall < context.SmallBlind * 11 && context.MoneyToCall > context.SmallBlind * 6)
                        {
                            return CheckOrFoldCustomAction(context);
                        }
                        else
                        {
                            return PlayerAction.Raise(context.SmallBlind * raiseAmount / 2);
                        }
                    }

                    return CheckOrFoldCustomAction(context);
                }
                else if (preFlopCards == CardValueType.Risky)
                {
                    if (context.MoneyLeft > 0)
                    {
                        if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind)
                        {
                            return PlayerAction.Raise(context.SmallBlind * raiseAmount);
                        }
                        else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind)
                        {
                            return PlayerAction.CheckOrCall();
                        }
                        else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 21)
                        {
                            return CheckOrFoldCustomAction(context);
                        }
                        else if (!context.CanCheck && context.MoneyToCall < context.SmallBlind * 21 && context.MoneyToCall > context.SmallBlind * 11)
                        {
                            return CheckOrFoldCustomAction(context);
                        }
                        else
                        {
                            return PlayerAction.Raise(context.SmallBlind * raiseAmount / 2);
                        }
                    }

                    return CheckOrFoldCustomAction(context);
                }
                else if (preFlopCards == CardValueType.Recommended)
                {
                    if (context.MoneyLeft > 0)
                    {
                        if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind)
                        {
                            return PlayerAction.Raise(context.SmallBlind * raiseAmount);
                        }
                        else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind)
                        {
                            return PlayerAction.Raise(context.SmallBlind * pushAmount);
                        }
                        else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 41)
                        {
                            return PlayerAction.Raise(context.MoneyLeft);
                        }
                        else if (!context.CanCheck && context.MoneyToCall < context.SmallBlind * 41 && context.MoneyToCall > context.SmallBlind * 11)
                        {
                            return PlayerAction.CheckOrCall();
                        }
                        else
                        {
                            return PlayerAction.Raise(context.SmallBlind * raiseAmount / 2);
                        }
                    }

                    return PlayerAction.CheckOrCall();
                }
            }

            return CheckOrFoldCustomAction(context);
        }
        public static PlayerAction AgressivePlayerActionPreflop(GetTurnContext context, CardValueType preFlopCards, int raiseAmount, int pushAmount)
        {
            if (preFlopCards != CardValueType.Unplayable)
            {
                if (preFlopCards == CardValueType.NotRecommended)
                {
                    if (context.MoneyLeft > 0)
                    {
                        if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind)
                        {
                            return(PlayerAction.Raise(context.SmallBlind * raiseAmount));
                        }
                        else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind)
                        {
                            return(PlayerAction.CheckOrCall());
                        }
                        else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 11)
                        {
                            return(CheckOrFoldCustomAction(context));
                        }
                        else
                        {
                            return(PlayerAction.Raise(context.SmallBlind * raiseAmount / 2));
                        }
                    }

                    return(CheckOrFoldCustomAction(context));
                }
                else if (preFlopCards == CardValueType.Risky)
                {
                    if (context.MoneyLeft > 0)
                    {
                        if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind)
                        {
                            return(PlayerAction.Raise(context.SmallBlind * raiseAmount));
                        }
                        else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind)
                        {
                            return(PlayerAction.CheckOrCall());
                        }
                        else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 21)
                        {
                            return(CheckOrFoldCustomAction(context));
                        }
                        else if (!context.CanCheck && context.MoneyToCall < context.SmallBlind * 21 && context.MoneyToCall > context.SmallBlind * 11)
                        {
                            return(CheckOrFoldCustomAction(context));
                        }
                        else
                        {
                            return(PlayerAction.Raise(context.SmallBlind * raiseAmount / 2));
                        }
                    }

                    return(PlayerAction.CheckOrCall());
                }
                else if (preFlopCards == CardValueType.Recommended)
                {
                    if (context.MoneyLeft > 0)
                    {
                        if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind)
                        {
                            return(PlayerAction.Raise(context.SmallBlind * raiseAmount));
                        }
                        else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind)
                        {
                            return(PlayerAction.Raise(context.SmallBlind * pushAmount));
                        }
                        else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 41)
                        {
                            return(PlayerAction.Raise(context.MoneyLeft));
                        }
                        else if (!context.CanCheck && context.MoneyToCall < context.SmallBlind * 41 && context.MoneyToCall > context.SmallBlind * 11)
                        {
                            return(PlayerAction.CheckOrCall());
                        }
                        else
                        {
                            return(PlayerAction.Raise(context.SmallBlind * raiseAmount / 2));
                        }
                    }

                    return(CheckOrFoldCustomAction(context));
                }
            }

            return(CheckOrFoldCustomAction(context));
        }