public static Motigoma Yomu_Motikoma(FenSyurui f, string line, ref int caret, ref bool sippai, StringBuilder hyoji) { if (sippai) { hyoji.AppendLine("failure 持ち駒"); return(Motigoma.Yososu); } foreach (Motigoma mk in Conv_Motigoma.itiran) { if (Util_String.MatchAndNext(SpkMotiKoma.GetFen(f, mk), line, ref caret)) { return(mk); } } sippai = true; hyoji.AppendLine("failure 持ち駒"); return(Motigoma.Yososu); }
/// <summary> /// 改造Fen /// 例: fen kr1/1h1/1H1/1R1 K2z 1 /// 盤上の駒配置、持ち駒の数、手番の対局者 /// </summary> public static void AppendFenTo( FenSyurui f, StringBuilder syuturyoku) { syuturyoku.Append(f == FenSyurui.sfe_n ? "sfen " : "fen "); // 盤上 { int space = 0; for (int iDan = 0; iDan < PureSettei.banTateHaba; iDan++) { for (int iSuji = 0; iSuji < PureSettei.banYokoHaba; iSuji++) { Masu ms = (Masu)(iDan * PureSettei.banYokoHaba + iSuji); Taikyokusya tai; if (PureMemory.gky_ky.yomiKy.yomiShogiban.yomiIbashoBan.ExistsKomaZenbu(ms, out tai)) { if (0 < space) { syuturyoku.Append(space.ToString()); space = 0; } Komasyurui ks; PureMemory.gky_ky.yomiKy.yomiShogiban.yomiIbashoBan.ExistsKoma(tai, ms, out ks); SpkKoma.AppendFenTo(f, Med_Koma.KomasyuruiAndTaikyokusyaToKoma(ks, tai), syuturyoku); } else { space++; } } if (0 < space) { syuturyoku.Append(space.ToString()); space = 0; } if (iDan + 1 < PureSettei.banTateHaba) { syuturyoku.Append("/"); } } } syuturyoku.Append(" "); // 持駒 if (PureMemory.gky_ky.yomiKy.yomiMotigomaItiran.IsEmpty()) { syuturyoku.Append("-"); } else { for (int iMk = 0; iMk < Conv_Motigoma.itiran.Length; iMk++) { int cnt = PureMemory.gky_ky.yomiKy.yomiMotigomaItiran.Count((Motigoma)iMk); if (0 < cnt) { syuturyoku.Append( cnt == 1 ? SpkMotiKoma.GetFen(f, (Motigoma)iMk)// 1個の時は数字は付かないぜ☆(^~^) : cnt.ToString() + SpkMotiKoma.GetFen(f, (Motigoma)iMk) ); } } } // 手番 syuturyoku.Append(" "); syuturyoku.Append(SpkTaikyokusya.ToFen(f, PureMemory.kifu_teban)); //// moves //if (syuturyokuMoves) //{ //} }