<commit_before>// <copyright file="Game.cs" company="<NAME>">
//     John.Colagioia.net. Licensed under the GPLv3
// </copyright>
// <author><NAME></author>
namespace BaseDice
{
        using System;
        using System.Collections.Generic;

        /// <summary>
        /// One game of BaseDice.
        /// </summary>
        public class Game
        {
                /// <summary>
                /// The random number generator.
                /// </summary>
                private Random rand = new Random();

                /// <summary>
                /// The dice.
                /// </summary>
                private Die[] dice = new Die[2];

                /// <summary>
                /// The bases.
                /// </summary>
                private Base[] bases = new Base[4];

                /// <summary>
                /// The point.
                /// </summary>
                private int point;

                /// <summary>
                /// The number of outs.
                /// </summary>
                private int outs;

                /// <summary>
                /// The player's score.
                /// </summary>
                private int runs;

                /// <summary>
                /// The number of hits.
                /// </summary>
                private int hits;

                /// <summary>
                /// The number of errors.
                /// </summary>
                private int errors;

                /// <summary>
                /// The number of runners to cross home that haven't otherwise been processed.
                /// </summary>
                private int home;

                /// <summary>
                /// Initializes a new instance of the <see cref="BaseDice.Game"/> class.
                /// </summary>
                public Game()
                {
                        for (int die = 0; die < this.dice.Length; die++)
                        {
                                this.dice[die] = new Die(this.rand);
                        }

                        this.bases[3] = new Base(null);
                        this.bases[2] = new Base(this.bases[3]);
                        this.bases[1] = new Base(this.bases[2]);
                        this.bases[0] = new Base(this.bases[1]);
                        this.bases[3].SetRun(this.Run);
                }

                /// <summary>
                /// Takes the turn.
                /// </summary>
                /// <returns>A report of the at-bat results.</returns>
                public string TakeTurn()
                {
                        int rollTotal = 0;
                        List<int> roll = this.Roll();
                        string report = string.Empty;
                        string nl = Environment.NewLine;

                        foreach (int val in roll)
                        {
                                rollTotal += val;
                        }

                        if (this.point == 0)
                        {
                                report = this.TurnNoPoint(roll);
                                this.point = rollTotal;
                                report = "the point is " + this.point.ToString() + ", " + report;
                        }
                        else
                        {
                                if (rollTotal == this.point)
                                {
                                        report = this.TurnPointMatched(roll);
                                        this.point = 0;
                                }

                                string report2 = this.TurnWithPoint(roll);
                                if (!string.IsNullOrWhiteSpace(report) && !string.IsNullOrWhiteSpace(report2))
                                {
                                        report += nl + report2;
                                }
                                else if (!string.IsNullOrWhiteSpace(report2))
                                {
                                        report = report2;
                                }
                        }

                        string runners = string.Empty;
                        if (this.home > 0)
                        {
                                runners = this.home.ToString() + " runner" +
                                        (this.home == 1 ? string.Empty : "s") +
                                        " cross" + (this.home == 1 ? "es" : string.Empty) +
                                                " Home Plate." + nl;
                                this.home = 0;
                        }

                        return runners +
                                "Rolled " + DiceTalk(rollTotal, roll[0] == roll[1]) + ", " + report;
                }

                /// <summary>
                /// Describes whether the game is over.
                /// </summary>
                /// <returns>True if the game still has outs remaining.</returns>
                public bool Done()
                {
                        return this.outs >= 27;
                }

                /// <summary>
                /// Produces the final tally.
                /// </summary>
                /// <returns>The tally.</returns>
                public string FinalTally()
                {
                        return this.runs.ToString() + " run" +
                                (this.runs == 1 ? "" : "s") + ".  " +
                                this.hits.ToString() + " hit" +
                                (this.hits == 1 ? "" : "s") + ".  " +
                                this.errors.ToString() + " error" +
                                (this.errors == 1 ? "" : "s") + ".";
                }

                /// <summary>
                /// Translates the roll to crap-ese.
                /// </summary>
                /// <returns>The talk.</returns>
                /// <param name="roll">The roll.</param>
                /// <param name="equal">The dice show the same face.</param>
                private static string DiceTalk(int roll, bool equal)
                {
                        string res = string.Empty;
                        switch (roll)
                        {
                                case 2:<commit_msg>Fix and note craps state<commit_after>// <copyright file="Game.cs" company="<NAME>">
//     John.Colagioia.net. Licensed under the GPLv3
// </copyright>
// <author><NAME></author>
namespace BaseDice
{
        using System;
        using System.Collections.Generic;

        /// <summary>
        /// One game of BaseDice.
        /// </summary>
        public class Game
        {
                /// <summary>
                /// The random number generator.
                /// </summary>
                private Random rand = new Random();

                /// <summary>
                /// The dice.
                /// </summary>
                private Die[] dice = new Die[2];

                /// <summary>
                /// The bases.
                /// </summary>
                private Base[] bases = new Base[4];

                /// <summary>
                /// The point.
                /// </summary>
                private int point;

                /// <summary>
                /// The number of outs.
                /// </summary>
                private int outs;

                /// <summary>
                /// The player's score.
                /// </summary>
                private int runs;

                /// <summary>
                /// The number of hits.
                /// </summary>
                private int hits;

                /// <summary>
                /// The number of errors.
                /// </summary>
                private int errors;

                /// <summary>
                /// The number of runners to cross home that haven't otherwise been processed.
                /// </summary>
                private int home;

                /// <summary>
                /// Initializes a new instance of the <see cref="BaseDice.Game"/> class.
                /// </summary>
                public Game()
                {
                        for (int die = 0; die < this.dice.Length; die++)
                        {
                                this.dice[die] = new Die(this.rand);
                        }

                        this.bases[3] = new Base(null);
                        this.bases[2] = new Base(this.bases[3]);
                        this.bases[1] = new Base(this.bases[2]);
                        this.bases[0] = new Base(this.bases[1]);
                        this.bases[3].SetRun(this.Run);
                }

                /// <summary>
                /// Takes the turn.
                /// </summary>
                /// <returns>A report of the at-bat results.</returns>
                public string TakeTurn()
                {
                        int rollTotal = 0;
                        List<int> roll = this.Roll();
                        string report = string.Empty;
                        string nl = Environment.NewLine;

                        foreach (int val in roll)
                        {
                                rollTotal += val;
                        }

                        if (this.point == 0)
                        {
                                report = this.TurnNoPoint(roll);
                                if (rollTotal == 12)
                                {
                                        report += " (Crapped out, bets pushed) ";
                                }
                                else if (new List<int>() { 2, 3 }.Contains(rollTotal))
                                {
                                        report += " (Crapped out) ";
                                }
                                else if (new List<int>() { 7, 11 }.Contains(rollTotal))
                                {
                                        report += " (Natural) ";
                                }
                                else
                                {
                                        this.point = rollTotal;
                                        report = "the point is " + this.point.ToString() + ", " + report;
                                        report += " (On) ";
                                }
                        }
                        else
                        {
                                if (rollTotal == this.point)
                                {
                                        report = this.TurnPointMatched(roll);
                                        report += " (Hit the point) ";
                                        this.point = 0;
                                }
                                else if (rollTotal == 7)
                                {
                                        report += " (Seven-out) ";
                                        this.point = 0;
                                }

                                string report2 = this.TurnWithPoint(roll);
                                if (!string.IsNullOrWhiteSpace(report) && !string.IsNullOrWhiteSpace(report2))
                                {
                                        report += nl + report2;
                                }
                                else if (!string.IsNullOrWhiteSpace(report2))
                                {
                                        report = report2;
                                }
                        }

                        string runners = string.Empty;
                        if (this.home > 0)
                        {
                                runners = this.home.ToString() + " runner" +
                                        (this.home == 1 ? string.Empty : "s") +
                                        " cross" + (this.home == 1 ? "es" : string.Empty) +
                                                " Home Plate." + nl;
                                this.home = 0;
                        }

                        return runners +
                                "Rolled " + DiceTalk(rollTotal, roll[0] == roll[1]) + ", " + report;
                }

                /// <summary>
                /// Describes whether the game is over.
                /// </summary>
                /// <returns>True if the game still has outs remaining.</returns>
                public bool Done()
                {
                        return this.outs >= 27;
                }

                /// <summary>
                /// Produces the final tally.
                /// </summary>
                /// <returns>The tally.</returns>
                public string FinalTally()
                {
                        return this.runs.ToString() + " run" +
                                (this.runs == 1 ? string.Empty : "s") + ".  " +
                                this.hits.ToString() + " hit" +
                                (this.hits == 1 ? string.Empty : "s") + ".  " +
                                this.errors.ToString() + " error" +
                                (this.errors == 1 ? string.Empty : "s") + ".";
                }

                /// <summary>
                /// Translates the roll to crap-ese.
                /// </summary>
                /// <returns>The talk.</returns>
                /// <param name="roll">The roll.</param>
                /// <param name="equal">The dice show the same face.</param>
                private static string DiceTalk(int roll, bool equal)
                {
                        string res = string.Empty;
                        switch (roll)
                        {
                                case 2:
{'fraction_non_alphanumeric': 0.10665707088880892, 'fraction_numerical': 0.005253688377114069, 'mean_word_length': 0.6458604761340756, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4069991', 'n_tokens_mistral': 3153, 'n_tokens_neox': 2792, 'n_words': 708}