コード例 #1
0
        public static bool ParseDoMove(Kyokumen ky, out Move out_sasite)
        {
            // コンソールからのキー入力を解析するぜ☆(^▽^)
            int caret    = Util_Commandline.Caret;
            int oldCaret = Util_Commandline.Caret;

            Util_String.TobasuTangoToMatubiKuhaku(Util_Commandline.Commandline, ref caret, "do ");

            // うしろに続く文字は☆(^▽^)
            if (!Med_Parser.TryFenMove(Option_Application.Optionlist.USI, Util_Commandline.Commandline, ref caret, ky.Sindan, out out_sasite))
            {
                Util_Commandline.Caret = oldCaret;

                //String2 str = new String2Impl();
                //str.Append("指し手のパースに失敗だぜ☆(^~^)! #鷺 commandline=[");
                //str.Append(commandline);
                //str.Append("] caret=[");
                //str.Append(caret);
                //str.Append("]");
                //syuturyoku.AppendLine(str.ToString());
                //Logger.Flush();
                //throw new Exception(str.ToString());
                return(false);
            }

            // do コマンドだった場合☆
            Util_Commandline.Caret = caret;
            Util_Commandline.CommentCommandline();// コマンドの誤発動防止
            return(true);
        }
コード例 #2
0
        public static void Undo(string commandline, Kyokumen ky, StringBuilder syuturyoku)
        {
            // うしろに続く文字は☆(^▽^)
            int caret = 0;

            Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "undo ");

            if (!Med_Parser.TryFenMove(Option_Application.Optionlist.USI, commandline, ref caret, ky.Sindan, out Move ss))
            {
                throw new Exception($"パースエラー [{ commandline }]");
            }
            ky.UndoMove(Option_Application.Optionlist.USI, ss, syuturyoku); // このムーブには取った駒は含まれないのでは。
        }
コード例 #3
0
        public static void Kiki(bool isSfen, string commandline, Kyokumen ky, out Masu out_ms, out Bitboard out_kikiBB)
        {
            //KomanoUgokikata komanoUgokikata,

            // うしろに続く文字は☆(^▽^)
            int caret = 0;

            Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "kiki ");
            string line = commandline.Substring(caret).TrimEnd();

            if (line.Length == 2)// kiki b3
            {
                out_kikiBB = null;

                // 升を返すぜ☆
                if (!Med_Parser.TryParseMs(isSfen, commandline, ky, ref caret, out out_ms))
                {
                    throw new Exception("パースエラー102");
                }
            }
            else// kiki b3 R 1
            {
                out_ms = ky.MASU_ERROR;

                // 盤面表示を返すぜ☆
                string moji1 = "";
                string moji2 = "";
                string moji3 = "";
                string moji4 = "";
                Match  m     = Itiran_FenParser.GetKikiCommandPattern(Option_Application.Optionlist.USI).Match(commandline, caret);
                if (m.Success)
                {
                    Util_String.SkipMatch(commandline, ref caret, m);

                    moji1 = m.Groups[1].Value;
                    moji2 = m.Groups[2].Value;
                    moji3 = m.Groups[3].Value;
                    moji4 = m.Groups[4].Value;

                    if (!Med_Parser.TryTaikyokusya(Option_Application.Optionlist.USI, moji4, out Option <Phase> phase))
                    {
                        throw new Exception($"対局者のパースエラー moji4=[{ moji4 }]");
                    }
                    out_kikiBB = Util_Application.Kiki_BB(Med_Koma.KomasyuruiAndTaikyokusyaToKoma(Med_Parser.Moji_Komasyurui(Option_Application.Optionlist.USI, moji3), phase), Med_Parser.FenSujiDan_Masu(Option_Application.Optionlist.USI, moji1, moji2), ky.Shogiban);// komanoUgokikata
                }
                else
                {
                    out_kikiBB = null;
                }
            }
        }
コード例 #4
0
        public static bool MoveCmd(string commandline, Kyokumen.Sindanyo kys, out Move out_sasite)
        {
            // うしろに続く文字は☆(^▽^)
            int caret = 0;

            Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "move ");
            string line = commandline.Substring(caret).Trim();

            // move 912 といった数字かどうか☆(^~^)
            if (int.TryParse(line, out int ssSuji))
            {
                out_sasite = (Move)ssSuji;
                return(true);
            }

            // 数字でなければ、 move B2B3 といった文字列か☆(^~^)
            if (Med_Parser.TryFenMove(Option_Application.Optionlist.USI, commandline, ref caret, kys, out out_sasite))
            {
                return(true);
            }

            out_sasite = Move.Toryo;
            return(false);
        }
コード例 #5
0
        public static MoveCharacter Parse(string commandline, ref int caret_1)
        {
            // うしろに続く文字は☆(^▽^)
            if (caret_1 == commandline.IndexOf("HyokatiYusen", caret_1))
            {
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret_1, "HyokatiYusen");
                return(MoveCharacter.HyokatiYusen);
            }
            else if (caret_1 == commandline.IndexOf("SyorituYusen", caret_1))
            {
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret_1, "SyorituYusen");
                return(MoveCharacter.SyorituYusen);
            }
            else if (caret_1 == commandline.IndexOf("SyorituNomi", caret_1))
            {
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret_1, "SyorituNomi");
                return(MoveCharacter.SinteYusen);
            }
            else if (caret_1 == commandline.IndexOf("SinteYusen", caret_1))
            {
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret_1, "SinteYusen");
                return(MoveCharacter.SinteYusen);
            }
            else if (caret_1 == commandline.IndexOf("SinteNomi", caret_1))
            {
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret_1, "SinteNomi");
                return(MoveCharacter.SinteNomi);
            }
            else if (caret_1 == commandline.IndexOf("TansakuNomi", caret_1))
            {
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret_1, "TansakuNomi");
                return(MoveCharacter.TansakuNomi);
            }

            return(MoveCharacter.Yososu);// パース・エラー☆(^▽^)
        }
コード例 #6
0
        public static void Set(string commandline, Kyokumen ky, StringBuilder syuturyoku)
        {
            int caret = 0;

            Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "set ");
            // うしろに続く文字は☆(^▽^)

            #region AspirationWindow
            if (caret == commandline.IndexOf("AspirationFukasa ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "AspirationFukasa ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    Option_Application.Optionlist.AspirationFukasa = val;
                }
            }
            #endregion
            #region AspirationWindow
            if (caret == commandline.IndexOf("AspirationWindow ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "AspirationWindow ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    if (val < 0)
                    {
                        val = -val;
                    }
                    else if ((int)Hyokati.TumeTesu_SeiNoSu_ReiTeDume < val)
                    {
                        val = (int)Hyokati.TumeTesu_SeiNoSu_ReiTeDume;
                    }
                    Option_Application.Optionlist.AspirationWindow = (Hyokati)val;
                }
            }
            #endregion
            #region BanTateHaba
            else if (caret == commandline.IndexOf("BanTateHaba ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "BanTateHaba ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    Option_Application.Optionlist.BanTateHabaOld = Option_Application.Optionlist.BanTateHaba;
                    Option_Application.Optionlist.BanTateHaba    = val;
                    ky.Tekiyo(true, syuturyoku);
                }
            }
            #endregion
            #region BanYokoHaba
            else if (caret == commandline.IndexOf("BanYokoHaba ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "BanYokoHaba ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    Option_Application.Optionlist.BanYokoHabaOld = Option_Application.Optionlist.BanYokoHaba;
                    Option_Application.Optionlist.BanYokoHaba    = val;
                    ky.Tekiyo(true, syuturyoku);
                }
            }
            #endregion

            #region BetaCutPer
            else if (caret == commandline.IndexOf("BetaCutPer ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "BetaCutPer ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    if (val < 0)
                    {
                        val = 0;
                    }
                    else if (100 < val)
                    {
                        val = 100;
                    }
                    Option_Application.Optionlist.BetaCutPer = val;
                }
            }
            #endregion
            #region HanpukuSinkaTansakuTukau
            else if (caret == commandline.IndexOf("HanpukuSinkaTansakuTukau ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "HanpukuSinkaTansakuTukau ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.HanpukuSinkaTansakuTukau = val;
                }
            }
            #endregion
            #region JohoJikan
            else if (caret == commandline.IndexOf("JohoJikan ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "JohoJikan ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    Option_Application.Optionlist.JohoJikan = val;
                }
            }
            #endregion
            #region JosekiPer
            else if (caret == commandline.IndexOf("JosekiPer ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "JosekiPer ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    if (val < 0)
                    {
                        val = 0;
                    }
                    else if (100 < val)
                    {
                        val = 100;
                    }
                    Option_Application.Optionlist.JosekiPer = val;
                }
            }
            #endregion
            #region JosekiRec
            else if (caret == commandline.IndexOf("JosekiRec ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "JosekiRec ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.JosekiRec = val;
                }
            }
            #endregion
            #region Learn
            else if (caret == commandline.IndexOf("Learn ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "Learn ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.Learn = val;
                }
            }
            #endregion
            #region NikomaHyokaKeisu
            else if (caret == commandline.IndexOf("NikomaHyokaKeisu ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "NikomaHyokaKeisu ");
                string line = commandline.Substring(caret);

                if (double.TryParse(line, out double val))
                {
                    Option_Application.Optionlist.NikomaHyokaKeisu = val;
                }
            }
            #endregion
            #region NikomaGakusyuKeisu
            else if (caret == commandline.IndexOf("NikomaGakusyuKeisu ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "NikomaGakusyuKeisu ");
                string line = commandline.Substring(caret);

                if (double.TryParse(line, out double val))
                {
                    Option_Application.Optionlist.NikomaGakusyuKeisu = val;
                }
            }
            #endregion
            // P1Char
            else if (caret == commandline.IndexOf("P1Char ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "P1Char ");
                Option_Application.Optionlist.PNChar[(int)Phase.Black] = AbstractConvMoveCharacter.Parse(commandline, ref caret);
            }
            #region P1Com
            else if (caret == commandline.IndexOf("P1Com ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "P1Com ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.P1Com = val;
                }
            }
            #endregion
            // P1Name
            else if (caret == commandline.IndexOf("P1Name ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "P1Name ");
                Option_Application.Optionlist.PNName[(int)Phase.Black] = commandline.Substring(caret);
            }
            else if (caret == commandline.IndexOf("P2Char ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "P2Char ");
                Option_Application.Optionlist.PNChar[(int)Phase.White] = AbstractConvMoveCharacter.Parse(commandline, ref caret);
            }
            #region P2Com
            else if (caret == commandline.IndexOf("P2Com ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "P2Com ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.P2Com = val;
                }
            }
            #endregion
            // P2Name
            else if (caret == commandline.IndexOf("P2Name ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "P2Name ");
                Option_Application.Optionlist.PNName[(int)Phase.White] = commandline.Substring(caret);
            }
            // RandomCharacter
            else if (caret == commandline.IndexOf("RandomCharacter ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "RandomCharacter ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.RandomCharacter = val;
                }
            }
            #region RandomNikoma
            else if (caret == commandline.IndexOf("RandomNikoma ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "RandomNikoma ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.RandomNikoma = val;
                }
            }
            #endregion
            // RandomSei は 廃止されたぜ☆(^▽^)www
            #region RandomStart
            else if (caret == commandline.IndexOf("RandomStart ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "RandomStart ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.RandomStart = val;
                }
            }
            #endregion
            #region RandomStartTaikyokusya
            else if (caret == commandline.IndexOf("RandomStartTaikyokusya ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "RandomStartTaikyokusya ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.RandomStartTaikyokusya = val;
                }
            }
            #endregion
            #region RenzokuRandomRule
            else if (caret == commandline.IndexOf("RenzokuRandomRule ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "RenzokuRandomRule ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.RenzokuRandomRule = val;
                }
            }
            #endregion
            #region RenzokuTaikyoku
            else if (caret == commandline.IndexOf("RenzokuTaikyoku ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "RenzokuTaikyoku ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.RenzokuTaikyoku = val;
                }
            }
            #endregion
            #region SagareruHiyoko
            else if (caret == commandline.IndexOf("SagareruHiyoko ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "SagareruHiyoko ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    // #仲ルール
                    if (
                        (!Option_Application.Optionlist.SagareruHiyoko && val) // さがれるひよこ モードにチェンジ☆
                        ||
                        (Option_Application.Optionlist.SagareruHiyoko && !val) // 普通のひよこ モードにチェンジ☆
                        )
                    {
                        Util_Machine.Flush_Joseki(syuturyoku);  // 定跡を書き出し(あとで読込むので、書き込み強制)
                        Util_Machine.Flush_Seiseki(syuturyoku); // 成績を書き出し(あとで読込むので、書き込み強制)
                        if (Option_Application.Optionlist.Learn)
                        {
                            Util_Machine.Flush_Nikoma(syuturyoku);   // 二駒関係を書き出し(あとで読込むので、書き込み強制)
                        }
                        Util_Application.Restart_SavefileTimeSpan(); // 保存間隔の再調整だぜ☆(^▽^)

                        // フラグ変更☆
                        Option_Application.Optionlist.SagareruHiyoko = val;

                        // 駒の動き方を作り直し
                        ky.Shogiban.Tukurinaosi_1_Clear_KomanoUgokikata(ky.Sindan.MASU_YOSOSU);
                        ky.Shogiban.Tukurinaosi_2_Input_KomanoUgokikata(ky.Sindan);

                        // 二駒関係の評価値を作り直し
                        //Util_NikomaKankei.Parameters = Util_NikomaKankei.CreateParameters();

                        Util_Machine.Load_Joseki(syuturyoku);  // 定跡を読込み
                        Util_Machine.Load_Seiseki(syuturyoku); // 成績を読込み
                        Util_Machine.Load_Nikoma(syuturyoku);  // 二駒関係を読込み
                    }
                    else
                    {
                        Option_Application.Optionlist.SagareruHiyoko = val;
                    }
                }
            }
            #endregion
            #region SaidaiEda
            else if (caret == commandline.IndexOf("SaidaiEda ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "SaidaiEda ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    Option_Application.Optionlist.SaidaiEda = val;
                }
            }
            #endregion
            #region SaidaiFukasa
            else if (caret == commandline.IndexOf("SaidaiFukasa ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "SaidaiFukasa ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    Option_Application.Optionlist.SaidaiFukasa = val;

                    if (AbstractUtilMoveGen.SAIDAI_SASITE_FUKASA - 1 < Option_Application.Optionlist.SaidaiFukasa)
                    {
                        Option_Application.Optionlist.SaidaiFukasa = AbstractUtilMoveGen.SAIDAI_SASITE_FUKASA - 1;
                        syuturyoku.AppendLine($"(^q^)実装の上限の [{ (AbstractUtilMoveGen.SAIDAI_SASITE_FUKASA - 1) }] に下げたぜ☆");
                    }
                }
            }
            #endregion
            #region SeisekiRec
            else if (caret == commandline.IndexOf("SeisekiRec ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "SeisekiRec ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.SeisekiRec = val;
                }
            }
            #endregion
            #region SennititeKaihi
            else if (caret == commandline.IndexOf("SennititeKaihi ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "SennititeKaihi ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.SennititeKaihi = val;
                }
            }
            #endregion
            #region SikoJikan
            else if (caret == commandline.IndexOf("SikoJikan ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "SikoJikan ");
                string line = commandline.Substring(caret);

                if (long.TryParse(line, out long val))
                {
                    Option_Application.Optionlist.SikoJikan = val;
                }
            }
            #endregion
            #region SikoJikanRandom
            else if (caret == commandline.IndexOf("SikoJikanRandom ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "SikoJikanRandom ");
                string line = commandline.Substring(caret);

                if (int.TryParse(line, out int val))
                {
                    Option_Application.Optionlist.SikoJikanRandom = val;
                }
            }
            #endregion
            #region TranspositionTableTukau
            else if (caret == commandline.IndexOf("TranspositionTableTukau ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "TranspositionTableTukau ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.TranspositionTableTukau = val;
                }
            }
            #endregion
            #region UseTimeOver
            else if (caret == commandline.IndexOf("UseTimeOver ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "UseTimeOver ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.UseTimeOver = val;
                }
            }
            #endregion
            #region USI
            else if (caret == commandline.IndexOf("USI ", caret))
            {
                // うしろに続く文字は☆(^▽^)
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "USI ");
                string line = commandline.Substring(caret);

                if (bool.TryParse(line, out bool val))
                {
                    Option_Application.Optionlist.USI = val;
                }
            }
            #endregion

            // 該当しないものは無視だぜ☆(^▽^)
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="commandline">B4B3、または toryo といった文字列を含む行☆</param>
        /// <param name="caret">文字カーソルの位置</param>
        /// <param name="ky">取られた駒を調べるために使う☆</param>
        /// <param name="out_sasite"></param>
        /// <returns></returns>
        public static bool TryFenMove(
            bool isSfen,
            string commandline,
            ref int caret,
            Kyokumen.Sindanyo kys,
            out Move out_sasite
            )
        {
            if ('n' == commandline[caret])
            {
                if (caret == commandline.IndexOf("none", caret))//定跡ファイルの応手が無いときに利用☆
                {
                    Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, "none");

                    out_sasite = Move.Toryo;
                    return(true);
                }
            }
            else
            //if ('t' == commandline[caret])
            //{
            if (caret == commandline.IndexOf(Itiran_FenParser.GetToryo(isSfen), caret))
            {
                Util_String.TobasuTangoToMatubiKuhaku(commandline, ref caret, Itiran_FenParser.GetToryo(isSfen));

                out_sasite = Move.Toryo;
                return(true);
            }
            //}

            // 「toryo」でも「none」でもなければ、「B4B3」形式と想定して、1手だけ読込み
            // テキスト形式の符号「A4A3 C1C2 …」の最初の1要素を、切り取ってトークンに分解します。

            Match m = Itiran_FenParser.GetMovePattern(isSfen).Match(commandline, caret);

            if (!m.Success)
            {
                //// 「B4B3」形式ではなかった☆(^△^)!? 次の一手が読めない☆
                //string msg = $"指し手のパースに失敗だぜ☆(^~^)! commandline=[{ commandline }] caret=[{ caret }] m.Groups.Count=[{ m.Groups.Count }]";
                //Util_Machine.AppendLine(msg);
                //Logger.Flush();
                //throw new Exception(msg);

                out_sasite = Move.Toryo;
                return(false);
            }

            // m.Groups[1].Value : ABCabc か、 ZKH
            // m.Groups[2].Value : 1234   か、 *
            // m.Groups[3].Value : ABCabc
            // m.Groups[4].Value : 1234
            // m.Groups[5].Value : +

            // カーソルを進めるぜ☆(^~^)
            Util_String.SkipMatch(commandline, ref caret, m);

            // 符号1「B4B3」を元に、move を作ります。
            out_sasite = TryFenMove2(
                isSfen,
                kys,
                m.Groups[1].Value,
                m.Groups[2].Value,
                m.Groups[3].Value,
                m.Groups[4].Value,
                m.Groups[5].Value
                );
            Debug.Assert((int)out_sasite != -1, "");

            return(true);
        }