Пример #1
0
        /// <summary>
        /// 用途例:持ち駒を確認するために使います。
        /// </summary>
        /// <param name="hkomas_gen_MOTI"></param>
        /// <returns></returns>
        public static string JsonElements_KomaHandles(bool enableLog, SkyConst src_Sky, List <int> hKomas, string comment)
        {
            StringBuilder sb = new StringBuilder();

            if (!enableLog)
            {
                goto gt_EndMethod;
            }

            //sb.AppendLine("            [");
            sb.AppendLine("                { act:\"colorMasu\", style:\"rgba(100,240,100,0.5)\" },");


            foreach (int hKoma in hKomas)
            {
                RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(hKoma).Now);


                string komaImg = Util_Converter_LogGraphicEx.Finger_ToString(src_Sky, hKoma, "");
                sb.AppendLine($"                {{ act:\"drawImg\", img:\"{komaImg}\", masu: {Conv_SyElement.ToMasuNumber(koma.Masu)} }},");//FIXME:おかしい?
            }



            sb.AppendLine($"                {{ act:\"drawText\", text:\"{comment}\"  , x:0, y:20 }},");

            //sb.AppendLine("            ],");

gt_EndMethod:
            return(sb.ToString());
        }
Пример #2
0
        public void Log3(
            SkyConst src_Sky,
            Playerside tebanKurau,       //手番(喰らう側)
            Playerside tebanSeme,        //手番(利きを調べる側)
            Fingers fingers_kurau_IKUSA, //戦駒(喰らう側)
            Fingers fingers_kurau_MOTI,  // 持駒(喰らう側)
            Fingers fingers_seme_IKUSA,  //戦駒(利きを調べる側)
            Fingers fingers_seme_MOTI    // 持駒(利きを調べる側)
            )
        {
            // 攻め手の駒の位置
            KaisetuBoard boardLog_clone = new KaisetuBoard(this.BrdMove);

            foreach (Finger finger in fingers_seme_IKUSA.Items)
            {
                RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now);

                Gkl_KomaMasu km = new Gkl_KomaMasu(
                    Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""),
                    Conv_SyElement.ToMasuNumber(koma.Masu)
                    );
                boardLog_clone.KomaMasu1.Add(km);
            }

            foreach (Finger finger in fingers_kurau_IKUSA.Items)
            {
                RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now);

                this.BrdMove.KomaMasu2.Add(new Gkl_KomaMasu(
                                               Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanKurau, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""),
                                               Conv_SyElement.ToMasuNumber(koma.Masu)
                                               ));
            }

            foreach (Finger finger in fingers_seme_MOTI.Items)
            {
                RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now);

                Gkl_KomaMasu km = new Gkl_KomaMasu(
                    Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""),
                    Conv_SyElement.ToMasuNumber(koma.Masu)
                    );
                this.BrdMove.KomaMasu3.Add(km);
            }

            foreach (Finger finger in fingers_kurau_MOTI.Items)
            {
                RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now);

                this.BrdMove.KomaMasu4.Add(new Gkl_KomaMasu(
                                               Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanKurau, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""),
                                               Conv_SyElement.ToMasuNumber(koma.Masu)
                                               ));
            }
            this.BrdMove = boardLog_clone;
        }
Пример #3
0
        /// <summary>
        /// ハブ・ノードの次ノード・リストをJSON化します。
        /// </summary>
        /// <param name="enableLog"></param>
        /// <param name="src_Sky_base"></param>
        /// <param name="hubNode"></param>
        /// <param name="comment"></param>
        /// <param name="logTag"></param>
        /// <returns></returns>
        public static string JsonKyokumens_NextNodes(bool enableLog, SkyConst src_Sky_base, Node <IMove, KyokumenWrapper> hubNode, string comment)
        {
            StringBuilder sb = new StringBuilder();

            if (!enableLog)
            {
                goto gt_EndMethod;
            }

            hubNode.Foreach_ChildNodes((string key, Node <IMove, KyokumenWrapper> node, ref bool toBreak) =>
            {
                IMove move = node.Key;

                RO_Star srcKoma1 = Util_Starlightable.AsKoma(move.LongTimeAgo);
                RO_Star dstKoma  = Util_Starlightable.AsKoma(move.Now);


                Finger srcKoma2 = Util_Sky_FingersQuery.InMasuNow(src_Sky_base, srcKoma1.Masu).ToFirst();

                // 駒1つ
                PieceType ks14 = Util_Komahaiyaku184.Syurui(dstKoma.Haiyaku);

                sb.AppendLine("            [");

                // マスの色
                sb.AppendLine("                { act:\"colorMasu\", style:\"rgba(100,240,100,0.5)\" },");

                // マス
                sb.AppendLine($"                {{ act:\"drawMasu\" , masu:{Conv_SyElement.ToMasuNumber(dstKoma.Masu)} }},");


                string komaImg = Util_Converter_LogGraphicEx.Finger_ToString(src_Sky_base, srcKoma2, "");
                sb.AppendLine($"                {{ act:\"drawImg\", img:\"{komaImg}\", masu: {Conv_SyElement.ToMasuNumber(dstKoma.Masu)} }},");//FIXME:おかしい?

                // コメント
                sb.AppendLine($"                {{ act:\"drawText\", text:\"{comment}\"  , x:0, y:20 }},");

                sb.AppendLine("            ],");
            });

gt_EndMethod:
            return(sb.ToString());
        }
Пример #4
0
        /// <summary>
        /// 駒画像のファイル名。
        /// </summary>
        /// <param name="src_Sky"></param>
        /// <param name="finger"></param>
        /// <param name="extentionWithDot"></param>
        /// <returns></returns>
        public static string Finger_ToString(SkyConst src_Sky, Finger finger, string extentionWithDot)
        {
            string komaImg = "";

            if ((int)finger < Finger_Honshogi.Items_KomaOnly.Length)
            {
                RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now);

                Playerside pside = koma.Pside;
                PieceType  ks14  = Util_Komahaiyaku184.Syurui(koma.Haiyaku);

                komaImg = Util_Converter_LogGraphicEx.PsideKs14_ToString(pside, ks14, extentionWithDot);
            }
            else
            {
                komaImg = Util_Converter_LogGraphicEx.PsideKs14_ToString(Playerside.Empty, PieceType.None, extentionWithDot);
            }

            return(komaImg);
        }
Пример #5
0
        /// <summary>
        /// 駒別マスをJSON化します。
        /// </summary>
        /// <param name="enableLog"></param>
        /// <param name="src_Sky_base"></param>
        /// <param name="km_move"></param>
        /// <param name="comment"></param>
        /// <returns></returns>
        public static string JsonKyokumens_MultiKomabetuMasus(bool enableLog, SkyConst src_Sky_base, Maps_OneAndOne <Finger, SySet <SyElement> > km_move, string comment)
        {
            StringBuilder sb = new StringBuilder();

            if (!enableLog)
            {
                goto gt_EndMethod;
            }

            km_move.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) =>
            {
                // 駒1つ
                RO_Star koma = Util_Starlightable.AsKoma(src_Sky_base.StarlightIndexOf(key).Now);

                PieceType ks14 = Util_Komahaiyaku184.Syurui(koma.Haiyaku);

                sb.AppendLine("            [");

                // マスの色
                sb.AppendLine("                { act:\"colorMasu\", style:\"rgba(100,240,100,0.5)\" },");

                // 全マス
                foreach (New_Basho masu in value.Elements)
                {
                    sb.AppendLine($"                {{ act:\"drawMasu\" , masu:{masu.MasuNumber} }},");
                }


                string komaImg = Util_Converter_LogGraphicEx.Finger_ToString(src_Sky_base, key, "");
                sb.AppendLine($"                {{ act:\"drawImg\", img:\"{komaImg}\", masu: {Conv_SyElement.ToMasuNumber(koma.Masu)} }},");//FIXME:おかしい?

                // コメント
                sb.AppendLine($"                {{ act:\"drawText\", text:\"{comment}\"  , x:0, y:20 }},");

                sb.AppendLine("            ],");
            });

gt_EndMethod:
            return(sb.ToString());
        }
Пример #6
0
        public void Log4(
            SkyConst src_Sky,
            Playerside tebanSeme,//手番(利きを調べる側)
            Maps_OneAndOne <Finger, SySet <SyElement> > kmMove_seme_IKUSA
            )
        {
            // 戦駒の移動可能場所
            KaisetuBoard boardLog_clone = new KaisetuBoard(this.BrdMove);

            kmMove_seme_IKUSA.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) =>
            {
                RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(key).Now);

                string komaImg = Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), "");

                foreach (New_Basho masu in value.Elements)
                {
                    boardLog_clone.Masu_theMove.Add((int)masu.MasuNumber);
                }
            });

            this.BrdMove = boardLog_clone;
        }
Пример #7
0
        /// <summary>
        /// 「グラフィカル局面ログ」出力用だぜ☆
        /// </summary>
        public static string Json_1Sky(
            SkyConst src_Sky,
            string memo,
            string hint,
            int temezumi_yomiGenTeban_forLog//読み進めている現在の手目済

            //[CallerMemberName] string memberName = "",
            //[CallerFilePath] string sourceFilePath = "",
            //[CallerLineNumber] int sourceLineNumber = 0
            )
        {
            //...(^▽^)さて、局面は☆?
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("[");

            // コメント
            string comment;

            {
                StringBuilder cmt = new StringBuilder();

                // メモ
                cmt.Append(memo);

                comment = cmt.ToString();
            }

            sb.AppendLine($"    {{ act:\"drawText\", text:\"{comment}\", x: 20, y:20 }},");//FIXME: \記号が入ってなければいいが☆

            int hKoma       = 0;
            int hMasu_sente = 81;
            int hMasu_gote  = 121;

            // 全駒
            src_Sky.Foreach_Starlights((Finger finger, IMoveHalf light, ref bool toBreak) =>
            {
                RO_Star koma = Util_Starlightable.AsKoma(light.Now);

                if (Conv_SyElement.ToOkiba(koma.Masu) == Okiba.Gote_Komadai)
                {
                    // 後手持ち駒
                    sb.AppendLine($"    {{ act:\"drawImg\", img:\"{Util_Converter_LogGraphicEx.PsideKs14_ToString(koma.Pside, koma.Komasyurui, "")}\", masu: {hMasu_gote} }},");//FIXME: \記号が入ってなければいいが☆
                    hMasu_gote++;
                }
                else if (Conv_SyElement.ToOkiba(koma.Masu) == Okiba.Sente_Komadai)
                {
                    // 先手持ち駒
                    sb.AppendLine($"    {{ act:\"drawImg\", img:\"{Util_Converter_LogGraphicEx.PsideKs14_ToString(koma.Pside, koma.Komasyurui, "")}\", masu: {hMasu_sente} }},");//FIXME: \記号が入ってなければいいが☆
                    hMasu_sente++;
                }
                else if (Conv_SyElement.ToOkiba(koma.Masu) == Okiba.ShogiBan)
                {
                    // 盤上
                    sb.AppendLine($"    {{ act:\"drawImg\", img:\"{Util_Converter_LogGraphicEx.PsideKs14_ToString(koma.Pside, koma.Komasyurui, "")}\", masu: {Conv_SyElement.ToMasuNumber(koma.Masu)} }},");//FIXME: \記号が入ってなければいいが☆
                }

                hKoma++;
            });

            sb.AppendLine("],");

            // ...(^▽^)ドウダッタカナ~☆
            return(sb.ToString());
        }
Пример #8
0
        /// <summary>
        /// 指定された局面で、指定された手番の駒の、利きマスを算出します。
        /// 持ち駒は盤上にないので、利きを調べる必要はありません。
        ///
        /// 「手目」は判定できません。
        ///
        /// </summary>
        /// <param name="kouho"></param>
        /// <param name="sbGohosyu"></param>
        /// <param name="logger"></param>
        public static List_OneAndMulti <Finger, SySet <SyElement> > LAAAA_GetEffect(
            int yomikaisiTemezumi,
            bool isHonshogi,
            SkyConst src_Sky,
            Playerside pside_genTeban3,
            bool isAiteban,
#if DEBUG
            KaisetuBoards logF_kiki,
#endif
            string logBrd_caption,
            int temezumi_yomiCur_forLog,
            IMove move_forLog
            )
        {
#if DEBUG
            KaisetuBoard logBrd_kiki = new KaisetuBoard();
            logBrd_kiki.Caption           = logBrd_caption;// "利き_"
            logBrd_kiki.Temezumi          = temezumi_yomiCur_forLog;
            logBrd_kiki.YomikaisiTemezumi = yomikaisiTemezumi;
            //logBrd_kiki.Score = 0.0d;
            logBrd_kiki.GenTeban = pside_genTeban3;// 現手番
            logF_kiki.boards.Add(logBrd_kiki);
#endif

            // 《1》
            List_OneAndMulti <Finger, SySet <SyElement> > sMs_effect = new List_OneAndMulti <Finger, SySet <SyElement> >();//盤上の駒の利き
            {
                // 《1.1》
                Playerside tebanSeme;  //手番(利きを調べる側)
                Playerside tebanKurau; //手番(喰らう側)
                {
                    if (isAiteban)
                    {
                        tebanSeme  = Conv_Playerside.Reverse(pside_genTeban3);
                        tebanKurau = pside_genTeban3;
                    }
                    else
                    {
                        tebanSeme  = pside_genTeban3;
                        tebanKurau = Conv_Playerside.Reverse(pside_genTeban3);
                    }

#if DEBUG
                    if (Playerside.P1 == tebanSeme)
                    {
                        logBrd_kiki.NounaiSeme = Gkl_NounaiSeme.Sente;
                    }
                    else if (Playerside.P2 == tebanSeme)
                    {
                        logBrd_kiki.NounaiSeme = Gkl_NounaiSeme.Gote;
                    }
#endif
                }


                // 《1.2》
                Fingers fingers_seme_BANJO;  //盤上駒(利きを調べる側)
                Fingers fingers_kurau_BANJO; //盤上駒(喰らう側)
                Fingers dust1;
                Fingers dust2;

                Util_Sky_FingersQueryFx.Split_BanjoSeme_BanjoKurau_MotiSeme_MotiKurau(
                    out fingers_seme_BANJO,
                    out fingers_kurau_BANJO,
                    out dust1,
                    out dust2,
                    src_Sky,
                    tebanSeme,
                    tebanKurau
                    );


                // 攻め手の駒の位置
#if DEBUG
                KaisetuBoard boardLog_clone = new KaisetuBoard(logBrd_kiki);
                foreach (Finger finger in fingers_seme_BANJO.Items)
                {
                    RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now);


                    Gkl_KomaMasu km = new Gkl_KomaMasu(
                        Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""),
                        Conv_SyElement.ToMasuNumber(koma.Masu)
                        );
                    boardLog_clone.KomaMasu1.Add(km);
                }
                foreach (Finger finger in fingers_kurau_BANJO.Items)
                {
                    RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now);


                    logBrd_kiki.KomaMasu2.Add(new Gkl_KomaMasu(
                                                  Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanKurau, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""),
                                                  Conv_SyElement.ToMasuNumber(koma.Masu)
                                                  ));
                }
                logBrd_kiki = boardLog_clone;
#endif



                // 《1.3》
                SySet <SyElement> masus_seme_BANJO  = Conv_Fingers.ToMasus(fingers_seme_BANJO, src_Sky);  // 盤上のマス(利きを調べる側の駒)
                SySet <SyElement> masus_kurau_BANJO = Conv_Fingers.ToMasus(fingers_kurau_BANJO, src_Sky); // 盤上のマス(喰らう側の駒)

                // 駒のマスの位置は、特にログに取らない。

                // 《1.4》
                Maps_OneAndOne <Finger, SySet <SyElement> > kmEffect_seme_BANJO = Query_FingersMasusSky.To_KomabetuKiki_OnBanjo(
                    fingers_seme_BANJO,//この中身がおかしい。
                    masus_seme_BANJO,
                    masus_kurau_BANJO,
                    src_Sky
                    //Conv_Move.Move_To_KsString_ForLog(move_forLog, pside_genTeban3),
                    );// 利きを調べる側の利き(戦駒)

                // 盤上駒の利き
#if DEBUG
                logBrd_kiki = new KaisetuBoard(logBrd_kiki);
                kmEffect_seme_BANJO.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) =>
                {
                    RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(key).Now);


                    string komaImg = Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), "");

                    foreach (New_Basho masu in value.Elements)
                    {
                        boardLog_clone.Masu_theEffect.Add(masu.MasuNumber);
                    }
                });
                logBrd_kiki = boardLog_clone;
#endif


                // 《1》 = 《1.4》の盤上駒+持駒
                sMs_effect.AddRange_New(kmEffect_seme_BANJO);
            }

            return(sMs_effect);
        }