Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException     += OnUnhandledException;
            LogManager.Configuration.Variables["starttime"] = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss-ffff");

            using (var r = new StreamReader("api.txt"))
            {
                Bot = new TelegramBotClient(r.ReadLine());
            }

            Words = new WordBase(Directory.GetFiles("dictionaries"));
            Words.Files.AddRange(Directory.GetFiles("downloads"));

            Words.Init();
            //initbase = Words.InitAsync();
            //initbase.Wait();

            Bot.OnMessage       += BotOnMessageReceived;
            Bot.OnMessageEdited += BotOnMessageReceived;
            Bot.OnReceiveError  += BotOnReceiveError;
            Bot.OnCallbackQuery += BotOnCallbackQueryReceived;

            var me = Bot.GetMeAsync().Result;

            Console.Title = me.Username;

            Bot.StartReceiving();
            Send(Bot.SendTextMessageAsync(Vlad, $"Я проснулся {DateTime.Now}")).Wait();
            //initbase.Wait();
            Console.ReadLine();
            Bot.StopReceiving();
        }