示例#1
0
        /// <summary>
        /// 解の情報を受け取り標準出力に出力する
        /// </summary>
        /// <param name="solution"></param>
        public static void OutputSolutionToConsole(Solution solution)
        {
            var answer_list       = new List <Tuple <short, short, short> >();
            var stamp_answer_list = solution.GetStampAnswerList();

            foreach (var stamp_answer in stamp_answer_list)
            {
                Stamp stamp   = stamp_answer.Item1;
                short slide_x = stamp_answer.Item2;
                short slide_y = stamp_answer.Item3;
                answer_list.Add(new Tuple <short, short, short>(stamp.GetOriginStampIndex(), slide_x, slide_y));
            }

            // スタンプを押す回数を出力
            //! @note ここはintにしないとオーバーフローする
            int len_answer_list = answer_list.Count();

            Console.WriteLine(len_answer_list);

            // スタンプの押し方を出力
            for (int i = 0; i < len_answer_list; ++i)
            {
                short  stamp_number = answer_list[i].Item1;
                short  slide_x      = answer_list[i].Item2;
                short  slide_y      = answer_list[i].Item3;
                string end_line     = "";
                if (i == len_answer_list - 1)
                {
                    end_line = "\n";
                }
                Console.WriteLine(stamp_number + ";" + slide_x + "," + slide_y + end_line);
            }
        }