Esempio n. 1
0
        /// <summary>
        /// SFEN文字列と、出力ファイル名を指定することで、局面の画像ログを出力します。
        /// </summary>
        /// <param name="sfenstring"></param>
        /// <param name="outFile"></param>
        /// <param name="reportEnvironment"></param>
        /// <returns></returns>
        public static bool Write_ForTest(
            string sfenstring,
            string relFolder,
            string outFile,
            KyokumenPngEnvironment reportEnvironment
            )
        {
            bool successful = true;


            //System.Windows.Forms.MessageBox.Show($@"{sfenstring}
            //{outFile}", "局面PNG書き出し");

            //
            // SFEN → RO_SfenStartpos
            //
            ISfenPosition2 ro_SfenStartpos;
            string         rest;

            if (!Sfenstring146Conv.ToKyokumen2(sfenstring, out rest, out ro_SfenStartpos))
            {
                //System.Windows.Forms.MessageBox.Show(sfenstring,"sfenstringパース失敗");
                successful = false;
                goto gt_EndMethod;
            }

            // テスト・プログラム用
            Util_KyokumenPng_Writer.Write1(
                ro_SfenStartpos.ToKyokumen1(),
                -1,                                     //移動元升不明
                -1,                                     //移動先升不明
                KyokumenPngArgs_FoodOrDropKoma.UNKNOWN, //取った駒不明
                "",                                     //指し手SFEN
                relFolder,
                outFile,
                reportEnvironment
                );

gt_EndMethod:
            return(successful);
        }
Esempio n. 2
0
        /// <summary>
        /// 盤1個分のログ。
        /// </summary>
        private static void AAA_Write_Node(
            IEngineConf engineConf,
            ref int logFileCounter,
            string nodePath,
            KifuNode node,
            KifuTree kifu,
            string relFolder,
            KyokumenPngEnvironment reportEnvironment
            )
        {
            string fileName = "";


            // 出力先
            fileName  = Conv_Filepath.ToEscape($"_log_{((int)node.Score)}点_{logFileCounter}_{nodePath}.png");
            relFolder = Conv_Filepath.ToEscape(relFolder);
            //
            // 画像ログ
            //
            if (true)
            {
                int srcMasu_orMinusOne = -1;
                int dstMasu_orMinusOne = -1;
                if (null != node.Key)
                {
                    srcMasu_orMinusOne = Conv_SyElement.ToMasuNumber(((RO_Star)node.Key.LongTimeAgo).Masu);
                    dstMasu_orMinusOne = Conv_SyElement.ToMasuNumber(((RO_Star)node.Key.Now).Masu);
                }

                KyokumenPngArgs_FoodOrDropKoma foodKoma;
                if (null != node.Key.FoodKomaSyurui)
                {
                    switch (Util_Komasyurui14.NarazuCaseHandle((PieceType)node.Key.FoodKomaSyurui))
                    {
                    case PieceType.None: foodKoma = KyokumenPngArgs_FoodOrDropKoma.NONE; break;

                    case PieceType.P: foodKoma = KyokumenPngArgs_FoodOrDropKoma.FU__; break;

                    case PieceType.L: foodKoma = KyokumenPngArgs_FoodOrDropKoma.KYO_; break;

                    case PieceType.N: foodKoma = KyokumenPngArgs_FoodOrDropKoma.KEI_; break;

                    case PieceType.S: foodKoma = KyokumenPngArgs_FoodOrDropKoma.GIN_; break;

                    case PieceType.G: foodKoma = KyokumenPngArgs_FoodOrDropKoma.KIN_; break;

                    case PieceType.R: foodKoma = KyokumenPngArgs_FoodOrDropKoma.HI__; break;

                    case PieceType.B: foodKoma = KyokumenPngArgs_FoodOrDropKoma.KAKU; break;

                    default: foodKoma = KyokumenPngArgs_FoodOrDropKoma.UNKNOWN; break;
                    }
                }
                else
                {
                    foodKoma = KyokumenPngArgs_FoodOrDropKoma.NONE;
                }


                // 評価明細に添付
                Util_KyokumenPng_Writer.Write1(
                    Conv_KifuNode.ToRO_Kyokumen1(node),
                    srcMasu_orMinusOne,
                    dstMasu_orMinusOne,
                    foodKoma,
                    ConvMoveStrSfen.ToMoveStrSfen(node.Key),
                    relFolder,
                    fileName,
                    reportEnvironment
                    );
                logFileCounter++;
            }

            //
            // 評価明細
            //
            {
                Util_KifuTreeLogWriter.AAAA_Write_HyokaMeisai(engineConf, fileName, node, relFolder, reportEnvironment);
            }
        }