Beispiel #1
0
        public void run()
        {
            List <PreflopHand> hands = this.equities.Select(eq => eq.hand).ToList();

            foreach (int n in Enumerable.Range(0, this.iterations))
            {
                Deck  d = new Deck(new HashSet <Card>(this.deadCards));
                Board b = Board.generateBoard(d, this.board);

                WinState ws = PickWinner.determineWinner(b, hands);
                foreach (Equity eq in this.equities)
                {
                    bool matched = false;
                    foreach (BestHand bh in ws.winningHands)
                    {
                        if (bh.hasBestHand(eq.hand, b))
                        {
                            matched = true;
                        }
                        if (matched)
                        {
                            eq.updateEquity(ws.equity);
                        }
                        else
                        {
                            eq.updateEquity(0);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void handleEndgame(Board b, Pot pot)
        {
            List <Player>      players = table.getPlayersToAnalyze();
            List <PreflopHand> hands   = players.Select(p => p.Hand).ToList();

            WinState ws       = PickWinner.determineWinner(b, hands);
            double   potShare = pot.PotSize * ws.equity;

            foreach (Player p in players)
            {
                foreach (BestHand bh in ws.winningHands)
                {
                    if (bh.hasBestHand(p.Hand, b))
                    {
                        p.addToStack(potShare);
                    }
                }
            }
        }