Пример #1
0
        /// <summary>
        /// 動かす駒を移動先へ。
        /// </summary>
        /// <param name="figMovedKoma"></param>
        /// <param name="move">棋譜に記録するために「指す前/指した後」を含めた手。</param>
        /// <param name="obsoluted_kifu_mutable"></param>
        /// <param name="isMakimodosi"></param>
        private static void Do25_UgokasuKoma_IdoSakiHe(
            out Finger figMovedKoma,
            IMove move,
            Playerside kaisi_tebanside,
            SkyConst kaisi_Sky
            ,
            [CallerMemberName] string memberName    = "",
            [CallerFilePath] string sourceFilePath  = "",
            [CallerLineNumber] int sourceLineNumber = 0
            )
        {
            figMovedKoma = Fingers.Error_1;

            //------------------------------------------------------------
            // 選択  :  動かす駒
            //------------------------------------------------------------
            // [巻戻し]のとき
            //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

            // 打った駒も、指した駒も、結局は将棋盤の上にあるはず。

            RO_Star koma = Util_Starlightable.AsKoma(move.Now);

            // 動かす駒
            figMovedKoma = Util_Sky_FingerQuery.InShogibanMasuNow(
                kaisi_Sky,
                koma.Pside,
                koma.Masu//[巻戻し]のときは、先位置が 駒の居場所。
                );
            Debug.Assert(figMovedKoma != Fingers.Error_1, "駒を動かせなかった?5");
        }
Пример #2
0
        /// <summary>
        /// 動かす駒を移動先へ。
        /// </summary>
        /// <param name="figMovedKoma"></param>
        /// <param name="move">棋譜に記録するために「指す前/指した後」を含めた手。</param>
        /// <param name="obsoluted_kifu_mutable"></param>
        /// <param name="isMakimodosi"></param>
        private static void Do24_UgokasuKoma_IdoSakiHe(
            out Finger figMovedKoma,
            IMove move,
            Playerside kaisi_tebanside,
            SkyConst kaisi_Sky,
            string hint
            ,
            [CallerMemberName] string memberName    = "",
            [CallerFilePath] string sourceFilePath  = "",
            [CallerLineNumber] int sourceLineNumber = 0
            )
        {
            figMovedKoma = Fingers.Error_1;

            //------------------------------------------------------------
            // 選択  :  動かす駒
            //------------------------------------------------------------
            // 進むとき
            //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

            //Debug.Assert(null != move, "Sasu24_UgokasuKoma_IdoSakiHe: 指し手がヌルでした。");
            if (Util_Sky_BoolQuery.IsDaAction(move))// 多分、ここで move がヌルになるエラーがある☆
            {
                //----------
                // 駒台から “打”
                //----------
                RO_Star srcKoma = Util_Starlightable.AsKoma(move.LongTimeAgo);
                RO_Star dstKoma = Util_Starlightable.AsKoma(move.Now);

                // FIXME: 駒台の、どの駒を拾うか?
                figMovedKoma = Util_Sky_FingerQuery.InOkibaSyuruiNowIgnoreCase(
                    kaisi_Sky,
                    Conv_SyElement.ToOkiba(srcKoma.Masu),
                    Util_Komahaiyaku184.Syurui(dstKoma.Haiyaku)
                    );
                Debug.Assert(figMovedKoma != Fingers.Error_1, "駒を動かせなかった?14");
            }
            else
            {
                //----------
                // 将棋盤から
                //----------

                RO_Star srcKoma = Util_Starlightable.AsKoma(move.LongTimeAgo);
                Debug.Assert(!Masu_Honshogi.IsErrorBasho(srcKoma.Masu), "srcKoma.Masuエラー。15");
                RO_Star dstKoma = Util_Starlightable.AsKoma(move.Now);

                figMovedKoma = Util_Sky_FingerQuery.InShogibanMasuNow(
                    kaisi_Sky,
                    dstKoma.Pside,
                    Util_Masu10.OkibaSujiDanToMasu(
                        Conv_SyElement.ToOkiba(Masu_Honshogi.Masus_All[Conv_SyElement.ToMasuNumber(dstKoma.Masu)]),
                        Conv_SyElement.ToMasuNumber(srcKoma.Masu)
                        )
                    );
                Debug.Assert(figMovedKoma != Fingers.Error_1, "駒を動かせなかった?13");
            }
        }
Пример #3
0
        /// <summary>
        /// ************************************************************************************************************************
        /// 軌道上の駒たち
        /// ************************************************************************************************************************
        /// </summary>
        /// <param name="km"></param>
        /// <returns></returns>
        public static void Fingers_EachSrcNow(out Fingers out_fingers, SySet <SyElement> srcList, SkyConst src_Sky, Playerside pside, IMoveHalf itaru)
        {
            out_fingers = new Fingers();

            foreach (SyElement masu in srcList.Elements)
            {
                Finger finger = Util_Sky_FingerQuery.InShogibanMasuNow(src_Sky, pside, masu);
                if (Util_Finger.ForHonshogi(finger))
                {
                    // 指定の升に駒がありました。
                    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                    out_fingers.Add(finger);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 含まれるか判定。
        /// </summary>
        /// <param name="masus"></param>
        /// <returns></returns>
        public static bool ExistsIn(IMoveHalf sl, SySet <SyElement> masus, SkyConst srcSky)
        {
            bool matched = false;

            foreach (SyElement masu in masus.Elements)
            {
                RO_Star koma = Util_Starlightable.AsKoma(sl.Now);


                Finger finger = Util_Sky_FingerQuery.InShogibanMasuNow(srcSky, koma.Pside, masu);

                if (
                    finger != Fingers.Error_1 && //2014-07-21 先後も見るように追記。
                    koma.Masu == masu
                    )
                {
                    matched = true;
                    break;
                }
            }

            return(matched);
        }