Beispiel #1
0
        public static void Main(string[] args)
        {
            string       hand     = "qh kc";
            string       board    = "qs 7c qc 8d 8s";
            HandAnalysis analysis = HandEvaluator.evalHandSmart(CardParser.parse(hand), CardParser.parse(board));

            Console.WriteLine("chance = " + analysis.Chance);
            Console.WriteLine("basic = " + analysis.HandBasic);
            Console.WriteLine("smart = " + analysis.HandSmart);

            List <Rule>   rules = RulesReader.readRules();
            RuleEvaluator eval  = new RuleEvaluator(rules);
            Rule          rule  = eval.findRule(StreetTypes.Turn, HandTypes.Top_pair, ChanceTypes.Draws, 4, OpponentActionTypes.Check, PositionTypes.Early, 0.5, 0.7);

            Console.WriteLine(rule.Decision);
            Console.ReadKey();
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            string              hand    = "2d 2s";
            string              board   = "9d 2h 7s 9s Ts";
            StreetTypes         street  = StreetTypes.River;
            int                 opps    = 1;
            OpponentActionTypes action  = OpponentActionTypes.Raise;
            double              maxBet  = 1.26;
            double              potSize = 0.64;

            HandAnalysis analysis = HandEvaluator.evalHandSmart(CardParser.parse(hand), CardParser.parse(board));

            Console.WriteLine("chance = " + analysis.Chance);
            Console.WriteLine("basic = " + analysis.HandBasic);
            Console.WriteLine("smart = " + analysis.HandSmart);

            List <Rule>   rules = RulesReader.readRules();
            RuleEvaluator eval  = new RuleEvaluator(rules);
            Rule          rule  = eval.findRule(street, analysis.HandSmart, analysis.Chance, opps, action, PositionTypes.Early, maxBet, potSize);

            Console.WriteLine("rule = " + rule.Decision);

            Console.ReadKey();
        }
Beispiel #3
0
        public void ProcessTable(Settings settings,
                                 Image tableImage,
                                 TableRenderer renderer,
                                 Table table,
                                 TableContainer container,
                                 RuleEvaluator evaluator,
                                 RuleInterpreter interpreter,
                                 Controller controller,
                                 Replayer replayer,
                                 RandomClicker clicker,
                                 List <TableControl> controls)
        {
            // hand visible?
            if (table.Hand.Count != 0)
            {
                // identify situation
                Situation situation = SituationEvaluator.evaluateSituation(tableImage, table, controls, settings.BigBlind);

                // wait for blinds activatd or not enough players or money reached
                if (!container.IsWaitingForBlind && situation.Street == StreetTypes.Preflop)
                {
                    // override blinds?
                    if (waitForBlinds)
                    {
                        Log.Info("table " + (container.Number + 1) + " override blinds");
                        WaitForBlind(controller, container);
                    }
                    // out of players?
                    else if (table.IsOutOfPlayers)
                    {
                        Log.Info("table " + (container.Number + 1) + " ran out of players");
                        CloseTable(container, controller);
                        return;
                    }
                    // reached money?
                    else if (settings.CloseTableActivated && table.HasSeat && table.MyPlayer.HasMoney)
                    {
                        if (table.MyPlayer.Money > settings.CloseTableMoneyMax)
                        {
                            Log.Info("table " + (container.Number + 1) + " reached money limit " + table.MyPlayer.Money);
                            CloseTable(container, controller);
                            return;
                        }
                    }
                }

                // evaluate rule
                Rule rule = evaluator.findRule(situation.Street,
                                               situation.Hand,
                                               situation.Chance,
                                               situation.Opponents,
                                               situation.OpponentAction,
                                               situation.Position,
                                               table.MaxBet,
                                               table.Pot);
                // decision
                Decision decision = interpreter.interpret(table, rule.Decision);

                // render table
                Log.Debug("# rendering table");
                if (renderer != null)
                {
                    renderer.render(table, container.Layout, situation, rule, decision, controls);
                }

                // beep
                if (decision.DecisionType == Decision.Types.BET ||
                    decision.DecisionType == Decision.Types.CALL ||
                    decision.DecisionType == Decision.Types.RAISE)
                {
                    if (situation.Hand != HandTypes.None)
                    {
                        Beep(settings);
                        TextToSpeech.SayAsnc(settings, situation.Hand);
                    }
                }

                // random click on table
                if (RandomBool(0.05) && settings.AutoClick)
                {
                    Log.Debug("# auto click on table");
                    clicker.click(container.Layout);
                }

                // sit out
                if (!container.IsSittingOut && sitOutNextHand)
                {
                    SitOut(controller, container);
                }

                // press buttons
                Log.Debug("# press controls");
                Thread.Sleep(RandomInt(100, 500));
                controller.Handle(decision, container.Layout, controls);

                // random mouse moves
                if (RandomBool(0.05) && settings.AutoMoveMouse)
                {
                    Log.Debug("# auto move mouse");
                    Sleep(settings, RandomInt(100, 300));
                    AutoMoveMouse(controller.Mouse);
                }
                if (situation.Opponents > 2 && RandomBool(0.05) && settings.ReplayMouseMoves)
                {
                    Log.Debug("# replay mouse");
                    Sleep(settings, RandomInt(100, 300));
                    replayer.ReplayRandomShort();
                }
            }
            else
            {
                // render table
                Log.Debug("# rendering table");
                renderer.render(table, container.Layout);
            }
        }