Пример #1
0
        static List<string> AnalyzeTournier(string Argument, List<Argument> ArgList, List<Search.Result> Results)
        {
            Tournier.Tournier T = new Tournier.Tournier(Results);
            List<Tournier.Result> ResultList = T.Analyze();

            Tournier.Plotter Plotter = new Tournier.Plotter(ResultList);

            // Fields analyze
            for (int i = 0; i < ArgList.Count; i++) Plotter.Fields.Add(ArgList[i].Name);

            // Parse options
            foreach (Argument A in ArgList)
            {
                int TempValue;

                switch (A.Name)
                {
                    case "mingames":
                        TempValue = ParseIntArg(A.Value, 0, 1000, "mingames");
                        if (TempValue != -1)
                        {
                            Plotter.MinimalGamesCount = TempValue;
                            Console.WriteLine(String.Format("Filter: players, who has at least {0:d} games;", TempValue));
                        }
                        break;
                    case "sort":
                        Plotter.Sort(A.Value);
                        break;
                    case "sortdesc":
                        Plotter.SortDescending(A.Value);
                        break;
                }
            }

            return Plotter.GamesGraph();
        }
Пример #2
0
        static List<string> YakuList(string Argument, List<Argument> ArgList, List<Search.Result> Results)
        {
            string Lang = "en";

            Tournier.Tournier T = new Tournier.Tournier(Results);
            List<Tournier.Result> ResultList = T.Analyze();

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

            int[] Yaku = new int[55];
            for(int j = 0; j < 55; j++) Yaku[j] = 0;

            // Calc yaku
            for (int i = 0; i < ResultList.Count; i++)
            {
                Tournier.Result R = ResultList[i];

                for (int j = 0; j < 55; j++) Yaku[j] += R.Yaku[j];
            }

            // Parse options
            foreach (Argument A in ArgList)
            {
                switch (A.Name)
                {
                    case "lang":
                        Lang = A.Value;
                        break;
                }

            }

            // Print
            for (int j = 0; j < 55; j++)
            {
                if (Yaku[j] == 0) continue;

                string Name = Mahjong.YakuName.GetYakuName(Lang, j);

                string Line = String.Format("{0:s}\t{1:d}", Name, Yaku[j]);
                Output.Add(Line);
            }

            return Output;
        }