Exemplo n.º 1
0
    protected override void PostEvaluate()
    {
        // Do nothing if triples and pairs is specified manually
        if (triples == null && pairs == null)
        {
            // End Pair and Triple evaluation
            tripleEvaluator.End();
            pairEvaluator.End();

            // Get the result of the evaluation
            triples = tripleEvaluator.Results;
            pairs   = pairEvaluator.Results;
        }

        // Build the result
        CardSet fullHouse = new CardSet(5);

        for (int tIndex = 0; tIndex < triples.Count; ++tIndex)
        {
            fullHouse.Clear();
            for (int pIndex = 0; pIndex < pairs.Count; ++pIndex)
            {
                if (triples[tIndex].Cards[0].Nominal != pairs[pIndex].Cards[0].Nominal)
                {
                    fullHouse.AddRange(pairs[pIndex].Cards);
                    fullHouse.AddRange(triples[tIndex].Cards);
                    results.Add(new PokerHand(fullHouse, triples[tIndex].Cards[2], PokerHand.CombinationType.FullHouse));
                    break;
                }
            }
        }


        // Reset triples and pairs variable
        triples = null;
        pairs   = null;
    }