コード例 #1
0
        public GraphicalLog_Board(GraphicalLog_Board src)
        {
            this.Caption = src.Caption;

            this.NounaiSeme = src.NounaiSeme;
            this.KomaMasu1  = src.KomaMasu1;
            this.KomaMasu2  = src.KomaMasu2;
            this.KomaMasu3  = src.KomaMasu3;
            this.KomaMasu4  = src.KomaMasu4;

            this.Tesumi         = src.Tesumi;
            this.GenTeban       = src.GenTeban;
            this.NounaiYomiDeep = src.NounaiYomiDeep;
            this.Score          = src.Score;

            this.Masu_theMove   = src.Masu_theMove;
            this.Masu_theEffect = src.Masu_theEffect;
            this.Masu_3         = src.Masu_3;
            this.Masu_4         = src.Masu_4;

            this.MarkMasu1 = src.MarkMasu1;
            this.MarkMasu2 = src.MarkMasu2;
            this.MarkMasu3 = src.MarkMasu3;
            this.MarkMasu4 = src.MarkMasu4;

            this.Arrow = src.Arrow;
        }
コード例 #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    // 持駒(利きを調べる側)
            )
        {
            // 攻め手の駒の位置
            GraphicalLog_Board boardLog_clone = new GraphicalLog_Board(this.BrdMove);

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

                Gkl_KomaMasu km = new Gkl_KomaMasu(
                    Util_GraphicalLog.PsideKs14_ToString(tebanSeme, Haiyaku184Array.Syurui(koma.Haiyaku), ""),
                    Util_Masu.AsMasuNumber(koma.Masu)
                    );
                boardLog_clone.KomaMasu1.Add(km);
            }

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

                this.BrdMove.KomaMasu2.Add(new Gkl_KomaMasu(
                                               Util_GraphicalLog.PsideKs14_ToString(tebanKurau, Haiyaku184Array.Syurui(koma.Haiyaku), ""),
                                               Util_Masu.AsMasuNumber(koma.Masu)
                                               ));
            }

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

                Gkl_KomaMasu km = new Gkl_KomaMasu(
                    Util_GraphicalLog.PsideKs14_ToString(tebanSeme, Haiyaku184Array.Syurui(koma.Haiyaku), ""),
                    Util_Masu.AsMasuNumber(koma.Masu)
                    );
                this.BrdMove.KomaMasu3.Add(km);
            }

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

                this.BrdMove.KomaMasu4.Add(new Gkl_KomaMasu(
                                               Util_GraphicalLog.PsideKs14_ToString(tebanKurau, Haiyaku184Array.Syurui(koma.Haiyaku), ""),
                                               Util_Masu.AsMasuNumber(koma.Masu)
                                               ));
            }
            this.BrdMove = boardLog_clone;
        }
コード例 #3
0
 public MmLogGenjoImpl(
     bool enable,
     GraphicalLog_Board brdMove,
     int yomuDeep,//脳内読み手数
     int tesumi_yomiCur,
     ShootingStarlightable move
     )
 {
     this.enable         = enable;
     this.BrdMove        = brdMove;
     this.yomuDeep       = yomuDeep;
     this.tesumi_yomiCur = tesumi_yomiCur;
     this.move           = move;
 }
コード例 #4
0
        private static void Log1(
            MoveGenGenjo genjo,
            Node <ShootingStarlightable, KyokumenWrapper> node_yomiCur,
            GraphicalLog_Board logBrd_move1
            )
        {
            logBrd_move1.moveOrNull = ((KifuNode)node_yomiCur).Key;


            RO_Star_Koma srcKoma = Util_Koma.AsKoma(logBrd_move1.moveOrNull.LongTimeAgo);
            RO_Star_Koma dstKoma = Util_Koma.AsKoma(logBrd_move1.moveOrNull.Now);


            // ログ試し
            logBrd_move1.Arrow.Add(new Gkl_Arrow(Util_Masu.AsMasuNumber(srcKoma.Masu), Util_Masu.AsMasuNumber(dstKoma.Masu)));
            genjo.Args.LogF_moveKiki.boards.Add(logBrd_move1);
        }
コード例 #5
0
        public void Log4(
            SkyConst src_Sky,
            Playerside tebanSeme,//手番(利きを調べる側)
            Maps_OneAndOne <Finger, SySet <SyElement> > kmMove_seme_IKUSA
            )
        {
            // 戦駒の移動可能場所
            GraphicalLog_Board boardLog_clone = new GraphicalLog_Board(this.BrdMove);

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

                string komaImg = Util_GraphicalLog.PsideKs14_ToString(tebanSeme, Haiyaku184Array.Syurui(koma.Haiyaku), "");

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

            this.BrdMove = boardLog_clone;
        }
コード例 #6
0
        /// <summary>
        /// 指定された局面で、指定された手番の駒の、利きマスを算出します。
        /// 持ち駒は盤上にないので、利きを調べる必要はありません。
        ///
        /// 「手目」は判定できません。
        ///
        /// </summary>
        /// <param name="kouho"></param>
        /// <param name="sbGohosyu"></param>
        /// <param name="logger"></param>
        public static List_OneAndMulti <Finger, SySet <SyElement> > LAAAA_GetEffect(
            bool enableLog,
            bool isHonshogi,
            SkyConst src_Sky,
            Playerside pside_genTeban3,
            bool isAiteban,
            GraphicalLog_File logF_kiki,
            string logBrd_caption,
            int yomuDeep_forLog,//脳内読み手数
            int tesumi_yomiCur_forLog,
            ShootingStarlightable move_forLog
            )
        {
            GraphicalLog_Board logBrd_kiki = new GraphicalLog_Board();

            logBrd_kiki.Caption        = logBrd_caption;// "利き_"
            logBrd_kiki.Tesumi         = tesumi_yomiCur_forLog;
            logBrd_kiki.NounaiYomiDeep = yomuDeep_forLog;
            //logBrd_kiki.Score = 0.0d;
            logBrd_kiki.GenTeban = pside_genTeban3;// 現手番
            logF_kiki.boards.Add(logBrd_kiki);

            // 《1》
            List_OneAndMulti <Finger, SySet <SyElement> > sMs_effect = new List_OneAndMulti <Finger, SySet <SyElement> >();//盤上の駒の利き

            {
                // 《1.1》
                Playerside tebanSeme;  //手番(利きを調べる側)
                Playerside tebanKurau; //手番(喰らう側)
                {
                    if (isAiteban)
                    {
                        tebanSeme  = Converter04.AlternatePside(pside_genTeban3);
                        tebanKurau = pside_genTeban3;
                    }
                    else
                    {
                        tebanSeme  = pside_genTeban3;
                        tebanKurau = Converter04.AlternatePside(pside_genTeban3);
                    }

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


                // 《1.2》
                Fingers fingers_seme_IKUSA;  //戦駒(利きを調べる側)
                Fingers fingers_kurau_IKUSA; //戦駒(喰らう側)
                Fingers dust1;
                Fingers dust2;

                Util_Things.AAABAAAA_SplitGroup(
                    out fingers_seme_IKUSA,
                    out fingers_kurau_IKUSA,
                    out dust1,
                    out dust2,
                    src_Sky,
                    tebanSeme,
                    tebanKurau
                    );


                // 攻め手の駒の位置
                GraphicalLog_Board boardLog_clone = new GraphicalLog_Board(logBrd_kiki);
                foreach (Finger finger in fingers_seme_IKUSA.Items)
                {
                    RO_Star_Koma koma = Util_Koma.AsKoma(src_Sky.StarlightIndexOf(finger).Now);


                    Gkl_KomaMasu km = new Gkl_KomaMasu(
                        Util_GraphicalLog.PsideKs14_ToString(tebanSeme, Haiyaku184Array.Syurui(koma.Haiyaku), ""),
                        Util_Masu.AsMasuNumber(koma.Masu)
                        );
                    boardLog_clone.KomaMasu1.Add(km);
                }

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


                    logBrd_kiki.KomaMasu2.Add(new Gkl_KomaMasu(
                                                  Util_GraphicalLog.PsideKs14_ToString(tebanKurau, Haiyaku184Array.Syurui(koma.Haiyaku), ""),
                                                  Util_Masu.AsMasuNumber(koma.Masu)
                                                  ));
                }

                logBrd_kiki = boardLog_clone;



                // 《1.3》
                SySet <SyElement> masus_seme_IKUSA  = Converter04.Fingers_ToMasus(fingers_seme_IKUSA, src_Sky);  // 盤上のマス(利きを調べる側の駒)
                SySet <SyElement> masus_kurau_IKUSA = Converter04.Fingers_ToMasus(fingers_kurau_IKUSA, src_Sky); // 盤上のマス(喰らう側の駒)

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

                // 《1.4》
                Maps_OneAndOne <Finger, SySet <SyElement> > kmEffect_seme_IKUSA = Util_Things.Get_KmEffect_seme_IKUSA(
                    fingers_seme_IKUSA,//この中身がおかしい。
                    masus_seme_IKUSA,
                    masus_kurau_IKUSA,
                    src_Sky,
                    enableLog,
                    Converter04.MoveToStringForLog(move_forLog, pside_genTeban3)
                    );// 利きを調べる側の利き(戦駒)

                // 戦駒の利き
                logBrd_kiki = new GraphicalLog_Board(logBrd_kiki);
                kmEffect_seme_IKUSA.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) =>
                {
                    RO_Star_Koma koma = Util_Koma.AsKoma(src_Sky.StarlightIndexOf(key).Now);


                    string komaImg = Util_GraphicalLog.PsideKs14_ToString(tebanSeme, Haiyaku184Array.Syurui(koma.Haiyaku), "");

                    foreach (Basho masu in value.Elements)
                    {
                        boardLog_clone.Masu_theEffect.Add((int)masu.MasuNumber);
                    }
                });

                logBrd_kiki = boardLog_clone;


                // 《1》 = 《1.4》の戦駒+持駒
                sMs_effect.AddRange_New(kmEffect_seme_IKUSA);
            }

            return(sMs_effect);
        }
コード例 #7
0
        public GraphicalLog_Board Clone()
        {
            GraphicalLog_Board clone = new GraphicalLog_Board(this);

            return(clone);
        }
コード例 #8
0
        /// <summary>
        /// まず前提として、
        /// 現手番の「被王手の局面」だけがピックアップされます。
        /// これはつまり、次の局面がないときは、その枝は投了ということです。
        /// </summary>
        /// <param name="enableLog"></param>
        /// <param name="isHonshogi"></param>
        /// <param name="yomuDeep"></param>
        /// <param name="tesumi_yomiCur"></param>
        /// <param name="pside_yomiCur"></param>
        /// <param name="node_yomiCur"></param>
        /// <param name="logF_moveKiki"></param>
        /// <param name="logTag"></param>
        /// <returns>複数のノードを持つハブ・ノード</returns>
        private static KifuNode WAAAA_CreateNextNodes(
            MoveGenGenjo genjo,
            KifuNode node_yomiCur,
            SsssLogGenjo log
            )
        {
            // 利きから、被王手の局面を除いたハブノード
            // このハブ・ノード自身は空っぽで、ハブ・ノードの次ノードが、次局面のリストになっています。
            KifuNode hubNode;

            {
                // ①現手番の駒の移動可能場所_被王手含む
                List_OneAndMulti <Finger, SySet <SyElement> > komaBETUSusumeruMasus;
                {
                    GraphicalLog_Board logBrd_move1 = new GraphicalLog_Board();// 盤1個分のログの準備

                    Util_MovableMove.LA_Get_KomaBETUSusumeruMasus(
                        out komaBETUSusumeruMasus,              //進めるマス
                        new MmGenjo_MovableMasuImpl(
                            genjo.Args.IsHonshogi,              //本将棋か
                            node_yomiCur.Value.ToKyokumenConst, //現在の局面
                            genjo.Pside_teban,                  //手番
                            false                               //相手番か
                            ),
                        new MmLogGenjoImpl(
                            log.EnableLog,        //ログを出力するかfalse,
                            logBrd_move1,         //ログ?
                            genjo.YomuDeep,       //読みの深さ
                            genjo.Tesumi_yomiCur, //手済み
                            node_yomiCur.Key      //指し手
                            )
                        );

                    MoveGenRoutine.Log1(genjo, node_yomiCur, logBrd_move1);//ログ試し
                }


                // ②利きから、被王手の局面を除いたハブノード
                if (genjo.Args.IsHonshogi)
                {
                    Maps_OneAndMulti <Finger, ShootingStarlightable> komaBETUAllMoves = Converter04.KomaBETUSusumeruMasusToKomaBETUAllMoves(komaBETUSusumeruMasus, node_yomiCur);
                    Converter04.AssertNariMove(komaBETUAllMoves, "#WAAAA_CreateNextNodes(1)");

                    // 本将棋の場合、王手されている局面は削除します。
                    hubNode = Util_LegalMove.LA_RemoveMate(
                        genjo.Args.IsHonshogi,
                        komaBETUAllMoves,
                        genjo.YomuDeep,
                        genjo.Tesumi_yomiCur,
                        genjo.Pside_teban,
                        node_yomiCur,
                        log.EnableLog,
                        genjo.Args.LogF_moveKiki,//利き用
                        "読みNextルーチン");

                    Converter04.AddNariMove(node_yomiCur, hubNode);


                    Converter04.AssertNariMove(hubNode, "#WAAAA_CreateNextNodes(2)");//ここで消えていた☆
                }
                else
                {
                    //そのまま変換
                    Dictionary <ShootingStarlightable, KyokumenWrapper> ss = Converter04.KomabetuMasusToMovebetuSky(
                        komaBETUSusumeruMasus,
                        node_yomiCur.Value.ToKyokumenConst,
                        genjo.Pside_teban);
                    hubNode = Converter04.MovebetuSky_ToHubNode(ss, KifuNodeImpl.GetReverseTebanside(genjo.Pside_teban));
                }
            }

            return(hubNode);
        }