コード例 #1
0
        public String Decide(IDecisionContext decisionContext)
        {
            String transitionName = "disapprove";

            String attributeName  = (String)decisionContext.GetConfiguration()["attribute"];
            Object attributeValue = decisionContext.GetAttribute(attributeName);

            if (attributeValue == Evaluation.APPROVE)
            {
                transitionName = "approve";
            }

            return(transitionName);
        }
コード例 #2
0
ファイル: EvaluationDecision.cs プロジェクト: ephebe/netbpm
        public String Decide(IDecisionContext decisionContext)
        {
            String transitionName = "disapprove";

            String attributeName = (String) decisionContext.GetConfiguration()["attribute"];
            Object attributeValue = decisionContext.GetAttribute(attributeName);

            if (attributeValue == Evaluation.APPROVE)
            {
                transitionName = "approve";
            }

            return transitionName;
        }
コード例 #3
0
        public PlayerAction GetAction(IDecisionContext ctx, EnchancedPlayer player)
        {
            var handStrenght = MonteCarloEvaluator.GetHandStrenght(
                ctx.FirstCard,
                ctx.SecondCard,
                ctx.CommunityCards);

            var currScore = handStrenght;

            if (ctx.TurnContext.RoundType == GameRoundType.River && currScore > 0.92m)
            {
                return(PlayerAction.Raise(2000));
            }

            if (currScore > 0.85m)
            {
                player.LastHandStrenght = currScore;
                player.MyLastRaise      = Math.Max(ctx.TurnContext.MoneyLeft / 4, (int)(player.MyLastRaise * (1 + currScore)));
                return(PlayerAction.Raise(player.MyLastRaise));
            }

            if ((currScore > player.LastHandStrenght) && (currScore > 0.6m))
            {
                player.LastHandStrenght = currScore;
                player.MyLastRaise      = (int)(player.MyLastRaise * (1 + currScore));
                return(PlayerAction.Raise(player.MyLastRaise));
            }
            else
            {
                if (currScore > 0.6m)
                {
                    var result = PlayerAction.CheckOrCall();
                    player.LastHandStrenght = currScore;
                    return(result);
                }
                else
                {
                    player.LastHandStrenght = currScore;
                    if (ctx.TurnContext.CanCheck)
                    {
                        return(PlayerAction.CheckOrCall());
                    }

                    return(PlayerAction.Fold());
                }
            }
        }
コード例 #4
0
        public PlayerAction GetAction(IDecisionContext ctx, EnchancedPlayer player)
        {
            var handStrenght = MonteCarloEvaluator.GetHandStrenght(
               ctx.FirstCard,
               ctx.SecondCard,
               ctx.CommunityCards);

            var currScore = handStrenght;

            if (ctx.TurnContext.RoundType == GameRoundType.River && currScore > 0.92m)
            {
                return PlayerAction.Raise(2000);
            }

            if (currScore > 0.85m)
            {
                player.LastHandStrenght = currScore;
                player.MyLastRaise = Math.Max(ctx.TurnContext.MoneyLeft / 4, (int)(player.MyLastRaise * (1 + currScore)));
                return PlayerAction.Raise(player.MyLastRaise);
            }

            if ((currScore > player.LastHandStrenght) && (currScore > 0.6m))
            {
                player.LastHandStrenght = currScore;
                player.MyLastRaise = (int)(player.MyLastRaise * (1 + currScore));
                return PlayerAction.Raise(player.MyLastRaise);
            }
            else
            {
                if (currScore > 0.6m)
                {
                    var result = PlayerAction.CheckOrCall();
                    player.LastHandStrenght = currScore;
                    return result;
                }
                else
                {
                    player.LastHandStrenght = currScore;
                    if (ctx.TurnContext.CanCheck)
                    {
                        return PlayerAction.CheckOrCall();
                    }

                    return PlayerAction.Fold();
                }
            }
        }
コード例 #5
0
        public string Decide(IDecisionContext decisionContext)
        {
            string transitionName = "";

            string attributeName  = (string)decisionContext.Configuration["attribute"];
            object attributeValue = decisionContext.GetAttribute(attributeName);

            if (attributeValue == Evaluation.APPROVE)
            {
                transitionName = "approve";
            }
            else if (attributeValue == Evaluation.DISAPPROVE)
            {
                transitionName = "disapprove";
            }

            return(transitionName);
        }
コード例 #6
0
        public PlayerAction GetAction(IDecisionContext ctx, EnchancedPlayer player)
        {
            if (player.PocketStrength > 20 || ctx.FirstCard.Type == CardType.Ace || ctx.SecondCard.Type == CardType.Ace)
            {
                player.MyLastRaise = Math.Max(player.BigBlind, (int)(ctx.TurnContext.MoneyLeft * player.PocketRaisePercent));
                return(PlayerAction.Raise(player.MyLastRaise));
            }

            if (player.PocketStrength > 0 || ctx.TurnContext.CanCheck)
            {
                return(PlayerAction.CheckOrCall());
            }
            else
            {
                var myBigBlinds     = (int)Math.Ceiling(ctx.TurnContext.MoneyLeft / (ctx.TurnContext.SmallBlind * 2.0));
                var bigBlindsToCall = (int)Math.Ceiling(ctx.TurnContext.MoneyToCall / (ctx.TurnContext.SmallBlind * 2.0));
                if (myBigBlinds / bigBlindsToCall < 10)
                {
                    return(PlayerAction.CheckOrCall());
                }

                return(PlayerAction.Fold());
            }
        }
コード例 #7
0
        public PlayerAction GetAction(IDecisionContext ctx, EnchancedPlayer player)
        {
            if (player.PocketStrength > 20 || ctx.FirstCard.Type == CardType.Ace || ctx.SecondCard.Type == CardType.Ace)
            {
                player.MyLastRaise = Math.Max(player.BigBlind, (int)(ctx.TurnContext.MoneyLeft * player.PocketRaisePercent));
                return PlayerAction.Raise(player.MyLastRaise);
            }

            if (player.PocketStrength > 0 || ctx.TurnContext.CanCheck)
            {
                return PlayerAction.CheckOrCall();
            }
            else
            {
                var myBigBlinds = (int)Math.Ceiling(ctx.TurnContext.MoneyLeft / (ctx.TurnContext.SmallBlind * 2.0));
                var bigBlindsToCall = (int)Math.Ceiling(ctx.TurnContext.MoneyToCall / (ctx.TurnContext.SmallBlind * 2.0));
                if (myBigBlinds / bigBlindsToCall < 10)
                {
                    return PlayerAction.CheckOrCall();
                }

                return PlayerAction.Fold();
            }
        }
コード例 #8
0
 public string Decide(IDecisionContext decisionContext)
 {
     return("pass");
 }