예제 #1
0
파일: wordle.cs 프로젝트: LEPT0N/toybox
        static void Main(string[] args)
        {
            Console.WriteLine("W O R D L E");
            Console.WriteLine();

            // test_full_dictionary(args[1], args[2], args[3]);
            // return;

            i_bot bot;
            int   answer_index = int.MaxValue;

            if (args[0] == "++")
            {
                bot          = new c_bot_2(args[1], args[2]);
                answer_index = 3;
            }
            else
            {
                bot          = new c_bot_1(args[0]);
                answer_index = 1;
            }

            string answer = null;

            if (args.Length > answer_index)
            {
                answer = args[answer_index];
            }

            solve(bot, answer, true);
        }
예제 #2
0
파일: wordle.cs 프로젝트: LEPT0N/toybox
        static void test_full_dictionary(string hints_input_file, string answers_input_file, string output_file)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            Dictionary <int, int> totals = new Dictionary <int, int>();

            List <string> output_lines = new List <string>();

            foreach (string answer in File.ReadAllLines(answers_input_file))
            {
                // i_bot bot = new c_bot_1(answers_input_file);
                i_bot bot = new c_bot_2(hints_input_file, answers_input_file);

                string[] guesses     = solve(bot, answer, false);
                int      guess_count = guesses.Length;

                if (totals.ContainsKey(guess_count))
                {
                    totals[guess_count] = totals[guess_count] + 1;
                }
                else
                {
                    totals.Add(guess_count, 1);
                }

                output_lines.Add(String.Join(',', guesses));
            }

            stopwatch.Stop();
            Console.WriteLine("Time taken = {0}", stopwatch.Elapsed);

            Console.WriteLine();

            foreach (int key in totals.Keys)
            {
                Console.WriteLine("[{0}] = {1}", key, totals[key]);
            }

            File.WriteAllLines(output_file, output_lines);
        }