Exemplo n.º 1
0
        public void QuickCalculate(WinEquity equity, List <Hand> hands, Hand table, int needToOpen, int calculationCount = 1000)
        {
            var         startPosition = 5 - needToOpen;
            Queue <int> cardIdQueue   = new Queue <int>();
            Random      rand          = new Random();

            for (int i = 0; i < calculationCount; i++)
            {
                for (int j = 0; j < needToOpen; j++)
                {
                    int nmb;
                    do
                    {
                        nmb = rand.Next(0, _cards.Count);
                    }while (cardIdQueue.Contains(nmb));
                    cardIdQueue.Enqueue(nmb);
                }

                for (int j = startPosition; j < 5; j++)
                {
                    table.Cards[j].Edit(_cards[cardIdQueue.Dequeue()]);
                }

                var result = HandComparer.CompareFullHands(hands.Select(p => p.Copy()).ToList(), table);
                equity.ProcessResult(result);
            }
        }
Exemplo n.º 2
0
        public void Interate(WinEquity equity, List <Hand> hands, Hand table, int needToOpen, int current = 0, int startCard = 0)
        {
            var currentPosition = 5 - needToOpen + current;

            foreach (var card in GetCards(currentPosition, startCard))
            {
                table.Cards[currentPosition].Edit(card);

                if (needToOpen == current + 1)
                {
                    var result = HandComparer.CompareFullHands(hands.Select(p => p.Copy()).ToList(), table);
                    equity.ProcessResult(result);
                }
                else
                {
                    Interate(equity, hands, table, needToOpen, current + 1, card.Position + 1);
                }
            }
        }