Example #1
0
        /// <summary>
        /// 指したあとの、次の局面を作るだけ☆
        /// </summary>
        /// <param name="src_Sky"></param>
        /// <param name="finger"></param>
        /// <param name="masu"></param>
        /// <param name="pside_genTeban"></param>
        /// <param name="logTag"></param>
        /// <returns></returns>
        public static SkyConst Sasu(
            SkyConst src_Sky, //指定局面
            Finger finger,    //動かす駒
            SyElement masu,   //移動先マス
            bool toNaru       //成るなら真
            )
        {
            SkyBuffer sky_buf = new SkyBuffer(src_Sky);                         // 現局面を元に、新規局面を書き換えます。

            sky_buf.SetKaisiPside(Conv_Playerside.Reverse(src_Sky.KaisiPside)); // 開始先後を逆転させます。
            sky_buf.SetTemezumi(sky_buf.Temezumi + 1);                          // 1手進めます。
            SkyConst src_Sky2 = SkyConst.NewInstance(sky_buf,
                                                     -1                         //sky_bufでもう変えてあるので、そのまま。
                                                     );

            // 移動先に相手の駒がないか、確認します。
            Finger tottaKoma = Util_Sky_FingersQuery.InMasuNow(src_Sky2, masu).ToFirst();

            if (tottaKoma != Fingers.Error_1)
            {
                // なにか駒を取ったら
                SyElement akiMasu;

                if (src_Sky.KaisiPside == Playerside.P1)
                {
                    akiMasu = Util_IttesasuRoutine.GetKomadaiKomabukuroSpace(Okiba.Sente_Komadai, src_Sky2);
                }
                else
                {
                    akiMasu = Util_IttesasuRoutine.GetKomadaiKomabukuroSpace(Okiba.Gote_Komadai, src_Sky2);
                }


                RO_Star koma = Util_Starlightable.AsKoma(sky_buf.StarlightIndexOf(tottaKoma).Now);

                // FIXME:配役あってるか?
                sky_buf.PutOverwriteOrAdd_Starlight(tottaKoma, new RO_Starlight(new RO_Star(src_Sky.KaisiPside, akiMasu, koma.Komasyurui)));//tottaKoma,
            }

            // 駒を1個動かします。
            // FIXME: 取った駒はどうなっている?
            {
                RO_Star   koma       = Util_Starlightable.AsKoma(sky_buf.StarlightIndexOf(finger).Now);
                PieceType komaSyurui = koma.Komasyurui;

                if (toNaru)
                {
                    komaSyurui = Util_Komasyurui14.ToNariCase(komaSyurui);
                }

                sky_buf.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(src_Sky.KaisiPside, masu, komaSyurui)));
            }

            return(SkyConst.NewInstance(sky_buf,
                                        -1//sky_bufでもう進めてあるので、そのまま。
                                        ));
        }
Example #2
0
        public static SkyConst New_Komabukuro(Playerside kaisiPside)
        {
            SkyBuffer buf_Sky = new SkyBuffer(kaisiPside,
                                              0// 初期局面扱いで、 0手目済みとしておく。
                                              );

            buf_Sky.Clear();

            Finger finger = 0;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(/*finger,*/ new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro01), PieceType.K)));// Kh185.n051_底奇王
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro02), PieceType.K)));// Kh185.n051_底奇王
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro03), PieceType.R)));// Kh185.n061_飛
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro04), PieceType.R)));// Kh185.n061_飛
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro05), PieceType.B)));// Kh185.n072_奇角
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro06), PieceType.B)));// Kh185.n072_奇角
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro07), PieceType.G)));// Kh185.n038_底偶金
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro08), PieceType.G)));// Kh185.n038_底偶金
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro09), PieceType.G)));// Kh185.n038_底偶金
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro10), PieceType.G)));// Kh185.n038_底偶金
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro11), PieceType.S)));// Kh185.n023_底奇銀
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro12), PieceType.S)));// Kh185.n023_底奇銀
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro13), PieceType.S)));// Kh185.n023_底奇銀
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro14), PieceType.S)));// Kh185.n023_底奇銀
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro15), PieceType.N)));// Kh185.n007_金桂
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro16), PieceType.N)));// Kh185.n007_金桂
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro17), PieceType.N)));// Kh185.n007_金桂
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro18), PieceType.N)));// Kh185.n007_金桂
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro19), PieceType.L)));// Kh185.n002_香
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro20), PieceType.L)));// Kh185.n002_香
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro21), PieceType.L)));// Kh185.n002_香
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro22), PieceType.L)));// Kh185.n002_香
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro23), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro24), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro25), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro26), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro27), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro28), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro29), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro30), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro31), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro32), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro33), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro34), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro35), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro36), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro37), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro38), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro39), PieceType.P)));// Kh185.n001_歩
            finger++;

            buf_Sky.PutOverwriteOrAdd_Starlight(finger, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nfukuro40), PieceType.P)));// Kh185.n001_歩
            finger++;

            // 以上、全40駒。
            Debug.Assert(buf_Sky.Starlights.Count == 40);

            return(SkyConst.NewInstance(buf_Sky,
                                        -1//buf_skyで設定済みなのでそのまま。
                                        ));
        }
Example #3
0
        /// <summary>
        /// ************************************************************************************************************************
        /// 駒を、平手の初期配置に並べます。
        /// ************************************************************************************************************************
        /// </summary>
        public static SkyConst New_Hirate(Playerside kaisiPside)
        {
            SkyBuffer dst_Sky = new SkyBuffer(kaisiPside,
                                              0//初期局面は 0手目済み
                                              );
            Finger figKoma;

            figKoma = Finger_Honshogi.SenteOh;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban59_5九), PieceType.K))); //先手王
            figKoma = (int)Finger_Honshogi.GoteOh;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban51_5一), PieceType.K))); //後手王

            figKoma = (int)Finger_Honshogi.Hi1;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban28_2八), PieceType.R)));//飛
            figKoma = (int)Finger_Honshogi.Hi2;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban82_8二), PieceType.R)));

            figKoma = (int)Finger_Honshogi.Kaku1;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban88_8八), PieceType.B)));//角
            figKoma = (int)Finger_Honshogi.Kaku2;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban22_2二), PieceType.B)));

            figKoma = (int)Finger_Honshogi.Kin1;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban49_4九), PieceType.G)));//金
            figKoma = (int)Finger_Honshogi.Kin2;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban69_6九), PieceType.G)));
            figKoma = (int)Finger_Honshogi.Kin3;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban41_4一), PieceType.G)));
            figKoma = (int)Finger_Honshogi.Kin4;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban61_6一), PieceType.G)));

            figKoma = (int)Finger_Honshogi.Gin1;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban39_3九), PieceType.S)));//銀
            figKoma = (int)Finger_Honshogi.Gin2;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban79_7九), PieceType.S)));
            figKoma = (int)Finger_Honshogi.Gin3;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban31_3一), PieceType.S)));
            figKoma = (int)Finger_Honshogi.Gin4;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban71_7一), PieceType.S)));

            figKoma = (int)Finger_Honshogi.Kei1;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban29_2九), PieceType.N)));//桂
            figKoma = (int)Finger_Honshogi.Kei2;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban89_8九), PieceType.N)));
            figKoma = (int)Finger_Honshogi.Kei3;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban21_2一), PieceType.N)));
            figKoma = (int)Finger_Honshogi.Kei4;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban81_8一), PieceType.N)));

            figKoma = (int)Finger_Honshogi.Kyo1;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban19_1九), PieceType.L)));//香
            figKoma = (int)Finger_Honshogi.Kyo2;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban99_9九), PieceType.L)));
            figKoma = (int)Finger_Honshogi.Kyo3;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban11_1一), PieceType.L)));
            figKoma = (int)Finger_Honshogi.Kyo4;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban91_9一), PieceType.L)));

            figKoma = (int)Finger_Honshogi.Fu1;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban17_1七), PieceType.P)));//歩
            figKoma = (int)Finger_Honshogi.Fu2;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban27_2七), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu3;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban37_3七), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu4;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban47_4七), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu5;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban57_5七), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu6;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban67_6七), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu7;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban77_7七), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu8;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban87_8七), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu9;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P1, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban97_9七), PieceType.P)));

            figKoma = (int)Finger_Honshogi.Fu10;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban13_1三), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu11;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban23_2三), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu12;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban33_3三), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu13;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban43_4三), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu14;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban53_5三), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu15;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban63_6三), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu16;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban73_7三), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu17;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban83_8三), PieceType.P)));
            figKoma = (int)Finger_Honshogi.Fu18;
            dst_Sky.PutOverwriteOrAdd_Starlight(figKoma, new RO_Starlight(new RO_Star(Playerside.P2, Masu_Honshogi.Query_Basho(Masu_Honshogi.nban93_9三), PieceType.P)));


            //LarabeLogger.GetInstance().WriteAddMemo(logTag, "平手局面にセットしたぜ☆");

            return(SkyConst.NewInstance(dst_Sky,
                                        -1//dst_skyでもう変えてあるのでそのまま。
                                        ));
        }
Example #4
0
        public SkyConst ToSky(Playerside kaisiPside, int temezumi)
        {
            // 駒40個に、Finger番号を割り当てておきます。
            SkyBuffer dst_Sky = new SkyBuffer(kaisiPside, temezumi);// 駒数0。
            //SkyBuffer dst_Sky = new SkyBuffer(Util_Sky.New_Komabukuro());// SFENインポート時


            Dictionary <Finger, RO_Star> komaDic = new Dictionary <Finger, RO_Star>();


            // ・インクリメントするので、Finger型ではなく int型で。
            // ・駒を取ったときに、先手後手は浮動するので区別できない。
            // 王 0~1
            int int_fingerK1 = 0;
            int int_fingerK2 = 1;
            // 飛車 2~3
            int int_fingerR1 = 2;
            int int_fingerR2 = 3;
            // 角 4~5
            int int_fingerB1 = 4;
            int int_fingerB2 = 5;
            // 金 6~9
            int int_fingerG1 = 6;
            int int_fingerG2 = 8;
            // 銀 10~13
            int int_fingerS1 = 10;
            int int_fingerS2 = 12;
            // 桂 14~17
            int int_fingerN1 = 14;
            int int_fingerN2 = 16;
            // 香 18~21
            int int_fingerL1 = 18;
            int int_fingerL2 = 20;
            // 歩 22~30,31~39
            int int_fingerP1 = 22;
            int int_fingerP2 = 31;

            //
            // どの升に、どの駒がいるか
            //
            foreach (KeyValuePair <int, RO_Star> entry in this.masubetuKoma_banjo)
            {
                int int_finger;

                // 今回のカウント
                switch (entry.Value.Komasyurui)
                {
                case PieceType.P:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerP1; break;

                    case Playerside.P2: int_finger = int_fingerP2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.L:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerL1; break;

                    case Playerside.P2: int_finger = int_fingerL2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.N:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerN1; break;

                    case Playerside.P2: int_finger = int_fingerN2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.S:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerS1; break;

                    case Playerside.P2: int_finger = int_fingerS2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.G:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerG1; break;

                    case Playerside.P2: int_finger = int_fingerG2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.K:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerK1; break;

                    case Playerside.P2: int_finger = int_fingerK2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.R:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerR1; break;

                    case Playerside.P2: int_finger = int_fingerR2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.B:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerB1; break;

                    case Playerside.P2: int_finger = int_fingerB2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PR:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerR1; break;

                    case Playerside.P2: int_finger = int_fingerR2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PB:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerB1; break;

                    case Playerside.P2: int_finger = int_fingerB2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PP:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerP1; break;

                    case Playerside.P2: int_finger = int_fingerP2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PL:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerL1; break;

                    case Playerside.P2: int_finger = int_fingerL2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PN:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerN1; break;

                    case Playerside.P2: int_finger = int_fingerN2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PS:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_finger = int_fingerS1; break;

                    case Playerside.P2: int_finger = int_fingerS2; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                default: throw new Exception($"未対応の駒種類=[{entry.Value.Komasyurui}]");
                }

                Debug.Assert(0 <= int_finger && int_finger <= 39, $"finger=[{int_finger}]");

                Debug.Assert(!komaDic.ContainsKey(int_finger), $"finger=[{int_finger}]");

                komaDic.Add(int_finger, entry.Value);


                // カウントアップ
                switch (entry.Value.Komasyurui)
                {
                case PieceType.P:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerP1++; break;

                    case Playerside.P2: int_fingerP2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.L:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerL1++; break;

                    case Playerside.P2: int_fingerL2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.N:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerN1++; break;

                    case Playerside.P2: int_fingerN2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.S:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerS1++; break;

                    case Playerside.P2: int_fingerS2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.G:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerG1++; break;

                    case Playerside.P2: int_fingerG2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.K:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerK1++; break;

                    case Playerside.P2: int_fingerK2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.R:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerR1++; break;

                    case Playerside.P2: int_fingerR2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.B:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerB1++; break;

                    case Playerside.P2: int_fingerB2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PR:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerR1++; break;

                    case Playerside.P2: int_fingerR2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PB:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerB1++; break;

                    case Playerside.P2: int_fingerB2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PP:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerP1++; break;

                    case Playerside.P2: int_fingerP2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PL:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerL1++; break;

                    case Playerside.P2: int_fingerL2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PN:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerN1++; break;

                    case Playerside.P2: int_fingerN2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                case PieceType.PS:
                    switch (entry.Value.Pside)
                    {
                    case Playerside.P1: int_fingerS1++; break;

                    case Playerside.P2: int_fingerS2++; break;

                    default: throw new Exception("未対応のプレイヤー番号");
                    }
                    break;

                default:
                    throw new Exception($"未対応の駒種類=[{entry.Value.Komasyurui}]");
                }
            }

            //
            // 40個の駒が、どの升に居るか
            //
            {
                // finger の順に並べる。
                RO_Star[] komas = new RO_Star[40];

                foreach (KeyValuePair <Finger, RO_Star> entry in komaDic)
                {
                    Debug.Assert(0 <= (int)entry.Key && (int)entry.Key <= 39, $"entry.Key=[{(int)entry.Key}]");

                    komas[(int)entry.Key] = entry.Value;
                }

                // finger の順に追加。
                int komaHandle = 0;
                foreach (RO_Star koma in komas)
                {
                    dst_Sky.PutOverwriteOrAdd_Starlight(
                        komaHandle,
                        new RO_Starlight(
                            //komaHandle,
                            koma
                            )
                        );
                    komaHandle++;
                }
            }

            StartposImporter.Assert_HirateHonsyogi(dst_Sky, $"ToSkyの終了直前 this.InputLine=[{this.InputLine}]");

            return(SkyConst.NewInstance(dst_Sky,
                                        -1//dst_sky で設定済みなのでそのまま。
                                        ));
        }