<commit_before>﻿using System;
using System.Collections.Generic;
using TexasHoldEm.Interfaces;

namespace TexasHoldEm.Internals
{
    internal class HandInvestigator : IHandInvestigator
    {
        private IList<CheckerBase> checkers = new List<CheckerBase>();
        private ComparerHelper comparer;

        public HandInvestigator(ComparerHelper comparer)
        {
            this.comparer = comparer;
        }
        public IBestPossibleHand LocateBestHand(IEnumerable<ICard> theHoleCards, IEnumerable<ICard> theCommunityCards)
        {
            IList<ICard> cards = CreateCardsList(theHoleCards, theCommunityCards);
            CheckerData data = new CheckerData(cards);
            CreateCheckers(data);
            IBestPossibleHand hand = null;
            foreach (CheckerBase checker in checkers)
            {
                hand = checker.Check();
                if (hand != null)
                {
                    break; ;
                }
            }
            return hand;
        }

        private void CreateCheckers(CheckerData data)
        {
            // The checkers are added sorted by hand value, most valuable first.
            checkers.Add(new FullHouseChecker(data, comparer));
            checkers.Add(new FourOfAKindChecker(data, comparer));
            checkers.Add(new ThreeOfAKindChecker(data, comparer));
            checkers.Add(new TwoPairsChecker(data, comparer));<commit_msg>correct  checkers sequence<commit_after>﻿using System;
using System.Collections.Generic;
using TexasHoldEm.Interfaces;

namespace TexasHoldEm.Internals
{
    internal class HandInvestigator : IHandInvestigator
    {
        private IList<CheckerBase> checkers = new List<CheckerBase>();
        private ComparerHelper comparer;

        public HandInvestigator(ComparerHelper comparer)
        {
            this.comparer = comparer;
        }
        public IBestPossibleHand LocateBestHand(IEnumerable<ICard> theHoleCards, IEnumerable<ICard> theCommunityCards)
        {
            IList<ICard> cards = CreateCardsList(theHoleCards, theCommunityCards);
            CheckerData data = new CheckerData(cards);
            CreateCheckers(data);
            IBestPossibleHand hand = null;
            foreach (CheckerBase checker in checkers)
            {
                hand = checker.Check();
                if (hand != null)
                {
                    break; ;
                }
            }
            return hand;
        }

        private void CreateCheckers(CheckerData data)
        {
            // The checkers are added sorted by hand value, most valuable first.
            checkers.Add(new FourOfAKindChecker(data, comparer));
            checkers.Add(new FullHouseChecker(data, comparer));
            checkers.Add(new ThreeOfAKindChecker(data, comparer));
            checkers.Add(new TwoPairsChecker(data, comparer));
{'fraction_non_alphanumeric': 0.07487001733102253, 'fraction_numerical': 0.0, 'mean_word_length': 2.1301518438177873, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3315078', 'n_tokens_mistral': 775, 'n_tokens_neox': 756, 'n_words': 167}