Exemplo n.º 1
0
        public static void Run_Fancy()
        {
            var scores = new List <double>();

            for (double s = ConsoleRead.ReadDouble(); s != -1; s = ConsoleRead.ReadDouble())
            {
                scores.Add(s);
            }
            double avg       = scores.Average();
            double threshold = 0.0001;

            for (int i = 0; i < scores.Count; i++)
            {
                string pos   = "";
                var    color = ConsoleColor.Yellow;

                if (scores[i] - threshold > avg)
                {
                    pos   = "ABOVE ";
                    color = ConsoleColor.Green;
                }
                else if (scores[i] + threshold < avg)
                {
                    pos   = "BELOW ";
                    color = ConsoleColor.Red;
                }

                ConsoleWrite.WriteLinesColored(color, $"{scores[i]:f2} {pos}AVERAGE");
            }
        }
Exemplo n.º 2
0
        public void Print(int depth = 0)
        {
            int c = 0;

            if (depth > 0)
            {
                for (int i = 0; i < depth; i++)
                {
                    while (c > colors.Length - 1)
                    {
                        c -= colors.Length;
                    }
                    ConsoleWrite.WriteColored(darkColors[c], "   |");
                    c++;
                }
            }

            while (c > colors.Length - 1)
            {
                c -= colors.Length;
            }

            ConsoleWrite.WriteLinesColored(this.completesString ? colors[c] : darkColors[c], (IsLeaf ? " " : " > ") + this.letter);

            foreach (TrieSet child in children.Values.OrderBy(x => x.children.Count))
            {
                child.Print(depth + 1);
            }
        }