Exemplo n.º 1
0
            static void Main(string[] args)
            {
                var showCheats = false;

                Console.Write("Show cheat colors? (Y/N)");
                ConsoleKeyInfo key;

                do
                {
                    key = Console.ReadKey(true);
                    if (key.Key == ConsoleKey.Y)
                    {
                        showCheats = true;
                        break;
                    }
                    else if (key.Key == ConsoleKey.N)
                    {
                        break;
                    }
                    else
                    {
                        Console.Beep();
                    }
                } while (true);
                Console.Clear();

                var wordList = new string[] {
                    "Justin", "kelly", "Whitney", "spencer", "andromeda", "aurora", "perry", "greenwood",
                    "josephine", "abraham", "eugene", "renee", "foster", "elizabeth"
                };

                var wordList2 = new string[] {
                    "Evy", "Julia", "Sylvia", "Treehouse", "Mailbox", "Lowe", "clubhouse", "Wakeup", "Eat", "Schoolwork", "Sleep"
                };

                var wordList3 = new string[] {
                    "Apples", "AppleJuice", "AppleCider", "SoynutButter", "SparklingGrapeJuice", "PaperTowels", "AppleButter", "Yogert", "Raspberries", "Blackberries", "Blueberries", "Strawberries", "Pants", "Earings", "Scarf", "Snowboots", "Dress", "Rubberbands", "Meltingbeads", "Fabrics", "Thread", "Needles", "OragomyPaper"
                };

                Console.Write("which option(a1,s2,d3)");
                ConsoleKeyInfo num;

                do
                {
                    num = Console.ReadKey(true);
                    if (num.Key == ConsoleKey.A)
                    {
                        Console.Clear();
                        var ws = WordSearch.CreateNew(18, 18, wordList);
                        for (var y = 0; y < ws.WordSearchLetters.GetLength(1); y++)
                        {
                            for (var x = 0; x < ws.WordSearchLetters.GetLength(0); x++)
                            {
                                if (showCheats && ws.HasHiddenWord(x, y))
                                {
                                    Console.ForegroundColor = ConsoleColor.Yellow;
                                }
                                else
                                {
                                    Console.ForegroundColor = ConsoleColor.White;
                                }
                                Console.Write($"{ws.WordSearchLetters[x, y]} ");
                            }
                            Console.WriteLine();
                        }
                        Console.ReadKey();
                        break;
                    }
                    else if (num.Key == ConsoleKey.S)
                    {
                        Console.Clear();
                        var ws = WordSearch.CreateNew(15, 15, wordList2);
                        for (var y = 0; y < ws.WordSearchLetters.GetLength(1); y++)
                        {
                            for (var x = 0; x < ws.WordSearchLetters.GetLength(0); x++)
                            {
                                if (showCheats && ws.HasHiddenWord(x, y))
                                {
                                    Console.ForegroundColor = ConsoleColor.Yellow;
                                }
                                else
                                {
                                    Console.ForegroundColor = ConsoleColor.White;
                                }
                                Console.Write($"{ws.WordSearchLetters[x, y]} ");
                            }
                            Console.WriteLine();
                        }
                        Console.ReadKey();
                        break;
                    }
                    else if (num.Key == ConsoleKey.D)
                    {
                        Console.Clear();
                        var ws = WordSearch.CreateNew(25, 25, wordList3);

                        for (var y = 0; y < ws.WordSearchLetters.GetLength(1); y++)
                        {
                            for (var x = 0; x < ws.WordSearchLetters.GetLength(0); x++)
                            {
                                if (showCheats && ws.HasHiddenWord(x, y))
                                {
                                    Console.ForegroundColor = ConsoleColor.Yellow;
                                }
                                else
                                {
                                    Console.ForegroundColor = ConsoleColor.White;
                                }
                                Console.Write($"{ws.WordSearchLetters[x, y]} ");
                            }
                            Console.WriteLine();
                        }
                        Console.ReadKey();
                        break;
                    }
                    else
                    {
                        Console.Beep();
                    }
                } while (true);
            }