示例#1
0
文件: Program.cs 项目: prekel/AlikBot
        public static void Main(string[] args)
        {
            var wb = new WordBase(Directory.GetFiles("dictionaries"));

            wb.Files.AddRange(Directory.GetFiles("downloads"));
            wb.Init();
            System.Console.Write("Сколько букв? ");
            var n = int.Parse(System.Console.ReadLine());
            var g = new Guesser(n, wb);

            while (true)
            {
                var guess = g.GuessAnswer();
                var l     = guess.Letter;
                var c     = g.Attempts;
                System.Console.WriteLine($"Попытка №{c} Шаблон: {g.Matcher.Pattern}");
                System.Console.WriteLine($"Где буква '{l}'?");
                var d = (from i in System.Console.ReadLine().Split() select int.Parse(i)).ToArray();
                g.Hint(l, d);
                if (g.Matcher.Unknown == 0)
                {
                    System.Console.WriteLine($"Угадано слово '{g.Matcher.Pattern}' c {c} попытки!");
                    break;
                }
            }
        }