Ejemplo n.º 1
0
 private void analysis(string active)
 {
     if (active == JoinToken)
     {
         IMap map = Judges.JudgeUnit.GetMap();
         if (analyzer == null)
         {
             analyzer = new Analyzer.AlphaBetaMaxMinAnalyzer(JoinBodId, HostBodId);
         }
         Task.Run(async() =>
         {
             long delay = (new Random()).Next(200, 1000);
             var sw     = new Stopwatch();
             IntPoint p = default(IntPoint);
             sw.Start();
             p = analyzer.Analysis(map, deep);
             sw.Stop();
             long used = sw.ElapsedMilliseconds;
             if (used < delay)
             {
                 await Task.Delay((int)(delay - used));
             }
             Debug.WriteLine(p);
             Pass(JoinToken, ActionType.Input, p);
         });
     }
 }
Ejemplo n.º 2
0
        private async Task <IntPoint> analysisTips(int envId, int userId)
        {
            var map = Judges.JudgeUnit.GetMap();

            //User as environment, other part as user
            //Find a good result
            tipsAnalyzer = new Analyzer.AlphaBetaMaxMinAnalyzer(userId, envId);
            IntPoint p = default(IntPoint);
            await Task.Run(() =>
            {
                p = tipsAnalyzer.Analysis(map, deep);
            });

            return(p);
        }