Пример #1
0
        public static KifuParserA_StateA2_SfenMoves GetInstance()
        {
            if (null == instance)
            {
                instance = new KifuParserA_StateA2_SfenMoves();
            }

            return(instance);
        }
Пример #2
0
        public string Execute(
            ref KifuParserA_Result result,
            Model_Taikyoku model_Taikyoku,
            out KifuParserA_State nextState,
            KifuParserA owner,
            KifuParserA_Genjo genjo
            )
        {
            nextState = this;

            Logger.Error($"(^△^)「{genjo.InputLine}」vs【{this.GetType().Name}】 : さて、どんな内容なんだぜ☆?");

            StartposImporter startposImporter1;
            string           restText;

            bool successful = StartposImporter.TryParse(
                genjo.InputLine,
                out startposImporter1,
                out restText
                );

            genjo.StartposImporter_OrNull = startposImporter1;
            Logger.Error($"(^△^)restText=「{restText}」 successful=【{successful}】");

            if (successful)
            {
                genjo.InputLine = restText;

                //if(null!=genjo.StartposImporter_OrNull)
                //{
                //    // SFENの解析結果を渡すので、
                //    // その解析結果をどう使うかは、委譲します。
                //    owner.Delegate_OnChangeSky_Im(
                //        model_PnlTaikyoku,
                //        genjo,
                //        logTag
                //        );
                //}

                nextState = KifuParserA_StateA2_SfenMoves.GetInstance();
            }
            else
            {
                // 解析に失敗しました。
                //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                genjo.ToBreak_Abnormal();
            }

            return(genjo.InputLine);
        }
Пример #3
0
        public string Execute(
            ref KifuParserA_Result result,
            Model_Taikyoku model_Taikyoku,
            out KifuParserA_State nextState,
            KifuParserA owner,
            KifuParserA_Genjo genjo
            )
        {
            nextState = this;

            if (genjo.InputLine.StartsWith("position"))
            {
                // SFEN形式の「position」コマンドが、入力欄に入っていました。
                //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                //------------------------------------------------------------
                // まずこのブロックで「position ~ moves 」まで(*1)を処理します。
                //------------------------------------------------------------
                //
                //          *1…初期配置を作るということです。
                //

#if DEBUG
                Logger.Trace($"(^△^)「{genjo.InputLine}」vs【{this.GetType().Name}】 : フムフム... SFEN形式か...☆");
#endif
                genjo.InputLine = genjo.InputLine.Substring("position".Length);
                genjo.InputLine = genjo.InputLine.Trim();


                nextState = KifuParserA_StateA1_SfenPosition.GetInstance();
            }
            else if ("" == genjo.InputLine)
            {
                // 異常時。
                Logger.Error($"\(^o^)/「{genjo.InputLine}」入力がない2☆! 終わるぜ☆");
                genjo.ToBreak_Abnormal();
            }
            else
            {
#if DEBUG
                Playerside pside = model_Taikyoku.Kifu.CurNode.Value.KyokumenConst.KaisiPside;
                Logger.Trace($"(^△^)「{genjo.InputLine}」vs【{this.GetType().Name}】 : フムフム... positionじゃなかったぜ☆ 日本式か☆? SFENでmovesを読んだあとのプログラムに合流させるぜ☆ : 先後=[{pside}]");
#endif
                nextState = KifuParserA_StateA2_SfenMoves.GetInstance();
            }

            return(genjo.InputLine);
        }
Пример #4
0
        public string Execute(
            ref KifuParserA_Result result,
            Model_Taikyoku model_Taikyoku,
            out KifuParserA_State nextState,
            KifuParserA owner,
            KifuParserA_Genjo genjo
            )
        {
            nextState = this;

            if (genjo.InputLine.StartsWith("moves"))
            {
                //>>>>> 棋譜が始まります。
                Logger.Trace($"(^△^)「{genjo.InputLine}」vs【{this.GetType().Name}】 : ウム☆ moves 分かるぜ☆");

                genjo.InputLine = genjo.InputLine.Substring("moves".Length);
                genjo.InputLine = genjo.InputLine.Trim();


                nextState = KifuParserA_StateA2_SfenMoves.GetInstance();
            }
            else if ("" == genjo.InputLine)
            {
                // FIXME: コンピューターが先手のとき、ここにくる?

                // 異常時。
                Logger.Error($"\(^o^)/「{genjo.InputLine}」入力がない1☆! 終わるぜ☆");
                genjo.ToBreak_Abnormal();
            }
            else
            {
                // 異常時。
                Logger.Error($"\(^o^)/「{genjo.InputLine}」vs【{this.GetType().Name}】 : movesがない☆! 終わるぜ☆");
                genjo.ToBreak_Abnormal();
            }

            return(genjo.InputLine);
        }