<commit_before>﻿using Hearts.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using Hearts.Scoring;

namespace Hearts.Extensions
{
    public static class CardListExtensions
    {
        public static void Log(this IEnumerable<Card> self, string name)
        {
            int padToLength = 38;
            Logging.Log.ToBlue();
            Console.Write(" " + name.PadLeft(Logging.Log.Options.NamePad) + " ");

            foreach (var suit in new List<Suit> { Suit.Hearts, Suit.Spades, Suit.Diamonds, Suit.Clubs })
            {
                var cardsOfSuit = self.Where(i => i.Suit == suit);

                foreach (var card in cardsOfSuit.OrderBy(i => i.Kind))
                {
                    Logging.Log.Card(card);
                    Console.Write(" ");
                }

                Console.Write(new string(' ', padToLength - cardsOfSuit.Count() * 3));
            }

            Logging.Log.NewLine();
        }

        public static int Score(this IEnumerable<Card> self)
        {
            return new ScoreEvaluator().CalculateScore(self);
        }

        public static string ToDebugString(this IEnumerable<Card> self)
        {
            return string.Join(",", self);
        }
    }
}<commit_msg>Refactor to use card extensions<commit_after>﻿using Hearts.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using Hearts.Scoring;

namespace Hearts.Extensions
{
    public static class CardListExtensions
    {
        public static void Log(this IEnumerable<Card> self, string name)
        {
            int padToLength = 38;
            Logging.Log.ToBlue();
            Console.Write(" " + name.PadLeft(Logging.Log.Options.NamePad) + " ");

            foreach (var suit in new List<Suit> { Suit.Hearts, Suit.Spades, Suit.Diamonds, Suit.Clubs })
            {
                var cardsOfSuit = self.OfSuit(suit);

                foreach (var card in cardsOfSuit.Ascending())
                {
                    Logging.Log.Card(card);
                    Console.Write(" ");
                }

                Console.Write(new string(' ', padToLength - cardsOfSuit.Count() * 3));
            }

            Logging.Log.NewLine();
        }

        public static int Score(this IEnumerable<Card> self)
        {
            return new ScoreEvaluator().CalculateScore(self);
        }

        public static string ToDebugString(this IEnumerable<Card> self)
        {
            return string.Join(",", self);
        }
    }
}
{'fraction_non_alphanumeric': 0.10780816488307571, 'fraction_numerical': 0.0023781212841854932, 'mean_word_length': 1.7766776677667766, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2542750', 'n_tokens_mistral': 728, 'n_tokens_neox': 685, 'n_words': 155}