public string C(int n, int k, WifeMode wifeMode = WifeMode.Maniacal) { string o = "", x; int j = 1, i = 1, m; for (; i <= n; i++) { o += string.Concat(Enumerable.Repeat("^ ", i)).PadLeft(n + i) + "\n"; m = 0; x = ""; if (i < n) { while (m < i + 1) { if (j > k) { j = 1; } x += j++ + " "; m++; } o += x.PadLeft(n + i + 1) + "\n"; } } return(o); }
public void ColourTree(int n, int k, WifeMode wifeMode = WifeMode.Maniacal) { string o = "", x; int j = 1, i, m; for (i = 1; i <= n; i++) { o = string.Concat(Enumerable.Repeat("^ ", i)).PadLeft(n + i) + "\r\n"; Console.ForegroundColor = ConsoleColor.Green; string padString = " "; Console.Write(padString + o); m = 0; x = ""; if (i < n) { while (m < i + 1) { if (j > k) { j = 1; } x += j++ + " "; m++; } //o += x.PadLeft(n + i + 1) + "\r\n"; o = x.PadLeft(n + i + 1) + "\r\n"; Console.Write(padString); foreach (var character in o) { ConsoleColor color; if (char.IsNumber(character)) { color = (ConsoleColor)int.Parse(character.ToString()) + 6; } else { color = ConsoleColor.Green; } Console.ForegroundColor = color; Console.Write(character.ToString()); } //Console.Write("\r\n"); } } }