Пример #1
0
        private static void Test()
        {
            int threshold = 400 * 1000 * 1000;

            while (true)
            {
                var           gsc     = new GameServerClient();
                TrainResponse problem = gsc.Train(TrainProblemType.Any, 15);
                Console.Out.WriteLine("==== TrainProblem: {0}", problem);

                Task <int> countTask = Task.Run(() =>
                {
                    IEnumerable <byte[]> trees = new BinaryBruteForcer(problem.operators).Enumerate(problem.size - 1);
                    return(trees.TakeWhile((t, i) => i < threshold).Count());
                });
                Stopwatch sw     = Stopwatch.StartNew();
                string    answer = ConcurrentWithoutShitAlphaProtocol.PostSolution(problem.id, problem.size,
                                                                                   problem.operators);
                sw.Stop();
                Console.Out.WriteLine("==== Solved, waiting for TreeSize...");
                countTask.Wait();
                Console.Out.WriteLine("==== SolvedIn: {0} ms, Answer: {1}, TreeSize: {2}", sw.ElapsedMilliseconds,
                                      answer,
                                      countTask.Result);
            }
        }
Пример #2
0
        private static void Run(int size, int skip, int take)
        {
            var whitelist = new[]
            {
                "LqUJiqwGnrvvcoYmP70sawHu",
                "Ni6aU05uJlbmMwl2P7uvPwtD",
                "PCKOdSBp1FBfQaOhHB5gBATf"
            };

            foreach (Problem problem in UnsolvedProblemsWithSize(size).Skip(skip).Take(take))
            {
//                if (whitelist == null || whitelist.Any(v => v == problem.Id))
//                {
                try
                {
                    ConcurrentWithoutShitAlphaProtocol.PostSolution(problem.Id, problem.Size, problem.Operations).ToArray();
                }
                catch (Exception e)
                {
                    log.Debug(string.Format("FAILED: {0}", e));
                }

//                }
            }

            Console.WriteLine("Press any key...");
            Console.ReadKey();
        }
Пример #3
0
 private static void RunManual()
 {
     ConcurrentWithoutShitAlphaProtocol.PostSolution("ECDMQ7dNtWCSuNz95FKfFLpY", 17,
                                                     "and,fold,if0,not,shl1,xor".Split(','));
     Console.WriteLine("Press any key...");
     Console.ReadKey();
 }