コード例 #1
0
        /// <summary>
        /// 局面PNG画像書き出し。
        /// </summary>
        public void WritePng()
        {
            var profilePath = System.Configuration.ConfigurationManager.AppSettings["Profile"];
            var toml        = Toml.ReadFile(Path.Combine(profilePath, "Engine.toml"));

            int srcMasu_orMinusOne = -1;
            int dstMasu_orMinusOne = -1;

            if (null != this.Kifu.CurNode.Key)
            {
                srcMasu_orMinusOne = Conv_SyElement.ToMasuNumber(((RO_Star)this.Kifu.CurNode.Key.LongTimeAgo).Masu);
                dstMasu_orMinusOne = Conv_SyElement.ToMasuNumber(((RO_Star)this.Kifu.CurNode.Key.Now).Masu);
            }

            KyokumenPngArgs_FoodOrDropKoma foodKoma;

            if (null != this.Kifu.CurNode.Key.FoodKomaSyurui)
            {
                switch (Util_Komasyurui14.NarazuCaseHandle((PieceType)this.Kifu.CurNode.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(((KifuNode)this.Kifu.CurNode)),
                srcMasu_orMinusOne,
                dstMasu_orMinusOne,
                foodKoma,
                ConvMoveStrSfen.ToMoveStrSfen(this.Kifu.CurNode.Key),
                "",
                toml.Get <TomlTable>("Resources").Get <string>("LearningPositionLogPngBasename"),
                LearningDataImpl.REPORT_ENVIRONMENT
                );
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="line"></param>
        /// <param name="kifuNode"></param>
        public static void Log2_Png_Tyokkin(string line, KifuNode kifuNode)
        {
            var profilePath = System.Configuration.ConfigurationManager.AppSettings["Profile"];
            var toml        = Toml.ReadFile(Path.Combine(profilePath, "Engine.toml"));

            //Logger.Trace(
            //    Util_Sky307.Json_1Sky(this.Kifu.CurNode.Value.ToKyokumenConst, $"現局面になっているのかなんだぜ☆? line={line}] 棋譜={KirokuGakari.ToJsaKifuText(this.Kifu, OwataMinister.WARABE_ENGINE)}",
            //        "PgCS",
            //        this.Kifu.CurNode.Value.ToKyokumenConst.Temezumi
            //    )
            //);

            //
            // 局面画像ログ
            //
            {
                // 出力先
                string fileName = Path.Combine(profilePath, toml.Get <TomlTable>("Resources").Get <string>("ChokkinNoMoveLogPngBasename"));

                int srcMasu_orMinusOne = -1;
                int dstMasu_orMinusOne = -1;
                if (null != kifuNode.Key)
                {
                    srcMasu_orMinusOne = Conv_SyElement.ToMasuNumber(((RO_Star)kifuNode.Key.LongTimeAgo).Masu);
                    dstMasu_orMinusOne = Conv_SyElement.ToMasuNumber(((RO_Star)kifuNode.Key.Now).Masu);
                }

                KyokumenPngArgs_FoodOrDropKoma foodKoma;
                if (null != kifuNode.Key.FoodKomaSyurui)
                {
                    switch (Util_Komasyurui14.NarazuCaseHandle((Komasyurui14)kifuNode.Key.FoodKomaSyurui))
                    {
                    case Komasyurui14.H00_Null___: foodKoma = KyokumenPngArgs_FoodOrDropKoma.NONE; break;

                    case Komasyurui14.H01_Fu_____: foodKoma = KyokumenPngArgs_FoodOrDropKoma.FU__; break;

                    case Komasyurui14.H02_Kyo____: foodKoma = KyokumenPngArgs_FoodOrDropKoma.KYO_; break;

                    case Komasyurui14.H03_Kei____: foodKoma = KyokumenPngArgs_FoodOrDropKoma.KEI_; break;

                    case Komasyurui14.H04_Gin____: foodKoma = KyokumenPngArgs_FoodOrDropKoma.GIN_; break;

                    case Komasyurui14.H05_Kin____: foodKoma = KyokumenPngArgs_FoodOrDropKoma.KIN_; break;

                    case Komasyurui14.H07_Hisya__: foodKoma = KyokumenPngArgs_FoodOrDropKoma.HI__; break;

                    case Komasyurui14.H08_Kaku___: foodKoma = KyokumenPngArgs_FoodOrDropKoma.KAKU; break;

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

                // 直近の指し手。
                Util_KyokumenPng_Writer.Write1(
                    Conv_KifuNode.ToRO_Kyokumen1(kifuNode),
                    srcMasu_orMinusOne,
                    dstMasu_orMinusOne,
                    foodKoma,
                    ConvMoveStrSfen.ToMoveStrSfen(kifuNode.Key),//Conv_MoveStr_Jsa.ToMoveStr_Jsa(kifuNode, kifuNode.Value),
                    "",
                    fileName,
                    Util_KifuTreeLogWriter.REPORT_ENVIRONMENT
                    );
            }
        }