public void Setup(int rows = 7, int pick = 1)
        {
            Rows         = new Pile[rows];
            CardPile     = new List <Card>();
            WinningPiles = new Dictionary <Suite, List <Card> >();
            PickAmount   = pick;

            // Initialize Rows
            for (int i = 0; i < Rows.Length; i++)
            {
                Rows[i] = new Pile();
            }

            // Place Cards in Rows
            int index = 0;

            for (int i = 0; i < rows; i++)
            {
                Rows[i].Add(Deck[index++], false);
                for (int j = 0; j < rows - (i + 1); j++)
                {
                    Rows[i + j + 1].Add(Deck[index++], true);
                }
            }

            // Card Pile
            for (; index < Deck.Count; index++)
            {
                CardPile.Add(Deck[index]);
            }
        }
        public void MoveSubRow(int row, int column, int newRow)
        {
            Pile        r     = Rows[row];
            List <Card> cards = new List <Card>();

            for (int i = column; i < r.Count; i++)
            {
                cards.Add(r[i].Card);
            }

            Rows[row].RemoveUntilEnd(column);

            if (FindTopCard(row) == null && Rows[row].Count > 0)
            {
                Rows[row][Rows[row].Count - 1].Hidden = false;
            }

            Rows[newRow].AddRange(cards);
        }
        public string GetGameString()
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < Rows.Length; i++)
            {
                Pile row = Rows[i];
                sb.Append("Row " + (i + 1) + " [" + (row.Count - 1) + " Hidden]" + ": ");
                //int visibleCount = 0;
                bool first = true;
                for (int j = 0; j < row.Count; j++)
                {
                    if (row[j].Hidden)
                    {
                        continue;
                    }

                    if (!first)
                    {
                        sb.Append(", ");
                    }
                    first = false;
                    sb.Append(/*"[" + (++visibleCount) + "] " + */ row[j].Card.ToString());
                }

                sb.AppendLine();
            }

            sb.AppendLine("Card Pile");
            for (int i = 0; i < CardPile.Count; i++)
            {
                sb.AppendLine("    - Card[" + (i + 1) + "]: " + CardPile[i]);
            }

            return(sb.ToString());
        }
        public string GetLayoutAsString()
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < Rows.Length; i++)
            {
                Pile row = Rows[i];
                sb.Append("Row[" + (i + 1) + "]: ");
                if (ShowHidden)
                {
                    sb.AppendLine();
                }
                else
                {
                    sb.AppendLine((row.Count - 1) + " Hidden");
                }
                int visibleCount = 0;
                for (int j = 0; j < row.Count; j++)
                {
                    if (ShowHidden || !row[j].Hidden)
                    {
                        sb.Append("    - Card[" + (++visibleCount) + "]: ");
                        if (ShowHidden)
                        {
                            sb.AppendLine(row[j].ToString());
                        }
                        else
                        {
                            sb.AppendLine(row[j].Card.ToString());
                        }
                    }
                }
            }

            sb.AppendLine("Card Pile");
            for (int i = 0; i < CardPile.Count; i++)
            {
                sb.AppendLine("    - Card[" + (i + 1) + "]: " + CardPile[i]);
            }

            sb.AppendLine("Winning Pile");
            bool noCardsInAnyPile = true;

            foreach (var pile in WinningPiles)
            {
                if (pile.Value.Count > 0)
                {
                    noCardsInAnyPile = false;
                    break;
                }
            }
            if (WinningPiles.Count == 0 || noCardsInAnyPile)
            {
                sb.AppendLine("    - Empty");
            }
            foreach (var pile in WinningPiles)
            {
                if (pile.Value.Count == 0)
                {
                    continue;
                }
                sb.AppendLine("    - " + pile.Key + ":");
                for (int i = 0; i < pile.Value.Count; i++)
                {
                    sb.AppendLine("          - " + (i + 1) + " " + pile.Value[i]);
                }
            }

            return(sb.ToString());
        }