public KaisetuBoard(KaisetuBoard src) { this.Caption = src.Caption; this.NounaiSeme = src.NounaiSeme; this.KomaMasu1 = src.KomaMasu1; this.KomaMasu2 = src.KomaMasu2; this.KomaMasu3 = src.KomaMasu3; this.KomaMasu4 = src.KomaMasu4; this.Temezumi = src.Temezumi; this.GenTeban = src.GenTeban; this.YomikaisiTemezumi = src.YomikaisiTemezumi; this.Score = src.Score; this.Masu_theMove = src.Masu_theMove; this.Masu_theEffect = src.Masu_theEffect; this.Masu_3 = src.Masu_3; this.Masu_4 = src.Masu_4; this.MarkMasu1 = src.MarkMasu1; this.MarkMasu2 = src.MarkMasu2; this.MarkMasu3 = src.MarkMasu3; this.MarkMasu4 = src.MarkMasu4; this.Arrow = src.Arrow; }
public void Log3( SkyConst src_Sky, Playerside tebanKurau, //手番(喰らう側) Playerside tebanSeme, //手番(利きを調べる側) Fingers fingers_kurau_IKUSA, //戦駒(喰らう側) Fingers fingers_kurau_MOTI, // 持駒(喰らう側) Fingers fingers_seme_IKUSA, //戦駒(利きを調べる側) Fingers fingers_seme_MOTI // 持駒(利きを調べる側) ) { // 攻め手の駒の位置 KaisetuBoard boardLog_clone = new KaisetuBoard(this.BrdMove); foreach (Finger finger in fingers_seme_IKUSA.Items) { RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now); Gkl_KomaMasu km = new Gkl_KomaMasu( Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""), Conv_SyElement.ToMasuNumber(koma.Masu) ); boardLog_clone.KomaMasu1.Add(km); } foreach (Finger finger in fingers_kurau_IKUSA.Items) { RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now); this.BrdMove.KomaMasu2.Add(new Gkl_KomaMasu( Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanKurau, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""), Conv_SyElement.ToMasuNumber(koma.Masu) )); } foreach (Finger finger in fingers_seme_MOTI.Items) { RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now); Gkl_KomaMasu km = new Gkl_KomaMasu( Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""), Conv_SyElement.ToMasuNumber(koma.Masu) ); this.BrdMove.KomaMasu3.Add(km); } foreach (Finger finger in fingers_kurau_MOTI.Items) { RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now); this.BrdMove.KomaMasu4.Add(new Gkl_KomaMasu( Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanKurau, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""), Conv_SyElement.ToMasuNumber(koma.Masu) )); } this.BrdMove = boardLog_clone; }
public MmLogGenjoImpl( int yomikaisiTemezumi, KaisetuBoard brdMove, int temezumi_yomiCur, IMove move ) { this.BrdMove = brdMove; this.yomikaisiTemezumi = yomikaisiTemezumi; this.temezumi_yomiCur = temezumi_yomiCur; this.move = move; }
public void Log4( SkyConst src_Sky, Playerside tebanSeme,//手番(利きを調べる側) Maps_OneAndOne <Finger, SySet <SyElement> > kmMove_seme_IKUSA ) { // 戦駒の移動可能場所 KaisetuBoard boardLog_clone = new KaisetuBoard(this.BrdMove); kmMove_seme_IKUSA.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) => { RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(key).Now); string komaImg = Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""); foreach (New_Basho masu in value.Elements) { boardLog_clone.Masu_theMove.Add((int)masu.MasuNumber); } }); this.BrdMove = boardLog_clone; }
public KaisetuBoard Clone() { KaisetuBoard clone = new KaisetuBoard(this); return(clone); }
/// <summary> /// 棋譜ログをJSON形式で出力します。 /// </summary> /// <returns></returns> public static string ToJsonStr(KaisetuBoard board) { StringBuilder sb = new StringBuilder(); sb.AppendLine("["); // 色つきマス { // 青 { sb.AppendLine("{ \"act\":\"colorMasu\", \"style\":\"rgba(100,100,240,0.5)\" },"); foreach (int masu in board.Masu_theMove) { sb.AppendLine($"{{ \"act\":\"drawMasu\" , \"masu\":{masu} }},"); } } // 赤 { sb.AppendLine("{ \"act\":\"colorMasu\", \"style\":\"rgba(240,100,100,0.5)\" },"); foreach (int masu in board.Masu_theEffect) { sb.AppendLine($"{{ \"act\":\"drawMasu\" , \"masu\":{masu} }},"); } } // 水色 { sb.AppendLine("{ \"act\":\"colorMasu\", \"style\":\"rgba(100,240,240,0.5)\" },"); foreach (int masu in board.Masu_3) { sb.AppendLine($"{{ \"act\":\"drawMasu\" , \"masu\":{masu} }},"); } } // 緑 { sb.AppendLine("{ \"act\":\"colorMasu\", \"style\":\"rgba(100,240,100,0.5)\" },"); foreach (int masu in board.Masu_4) { sb.AppendLine($"{{ \"act\":\"drawMasu\" , \"masu\":{masu} }},"); } } } // マークがあるマス { // 赤駒 { sb.AppendLine("{"); sb.AppendLine(" \"act\":\"begin_imgColor\","); sb.AppendLine(" \"colors\":["); sb.AppendLine(" { \"sR\":255, \"sG\":255, \"sB\":255, \"sA\":255, \"dR\":0, \"dG\":0, \"dB\":200, \"dA\":255 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); foreach (int masu in board.MarkMasu1) { sb.AppendLine($"{{ \"act\":\"drawImg\", \"img\":\"mark1\", \"masu\":{masu} }},"); } sb.AppendLine("{ \"act\":\"end_imgColor\", },"); } // 青駒 { sb.AppendLine("{"); sb.AppendLine(" \"act\":\"begin_imgColor\","); sb.AppendLine(" \"colors\":["); sb.AppendLine(" { \"sR\":255, \"sG\":255, \"sB\":255, \"sA\":255, \"dR\":200, \"dG\":0, \"dB\":0, \"dA\":255 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); foreach (int masu in board.MarkMasu2) { sb.AppendLine($"{{ \"act\":\"drawImg\", \"img\":\"mark1\", \"masu\":{masu} }},"); } sb.AppendLine("{ \"act\":\"end_imgColor\", },"); } // 水色 { sb.AppendLine("{"); sb.AppendLine(" \"act\":\"begin_imgColor\","); sb.AppendLine(" \"colors\":["); sb.AppendLine(" { \"sR\":255, \"sG\":255, \"sB\":255, \"sA\":255, \"dR\":0, \"dG\":200, \"dB\":200, \"dA\":255 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); foreach (int masu in board.MarkMasu3) { sb.AppendLine($"{{ \"act\":\"drawImg\", \"img\":\"mark1\", \"masu\":{masu} }},"); } sb.AppendLine("{ \"act\":\"end_imgColor\", },"); } // 緑駒 { sb.AppendLine("{"); sb.AppendLine(" \"act\":\"begin_imgColor\","); sb.AppendLine(" \"colors\":["); sb.AppendLine(" { \"sR\":255, \"sG\":255, \"sB\":255, \"sA\":255, \"dR\":0, \"dG\":200, \"dB\":0, \"dA\":255 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); foreach (int masu in board.MarkMasu4) { sb.AppendLine($"{{ \"act\":\"drawImg\", \"img\":\"mark1\", \"masu\":{masu} }},"); } sb.AppendLine("{ \"act\":\"end_imgColor\", },"); } } // 脳内攻め手 switch (board.NounaiSeme) { case Gkl_NounaiSeme.Sente: { sb.AppendLine("{"); sb.AppendLine(" \"act\":\"begin_imgColor\","); sb.AppendLine(" \"colors\":["); sb.AppendLine(" { \"sR\":255, \"sG\":255, \"sB\":255, \"sA\":255, \"dR\": 0, \"dG\": 0, \"dB\":200, \"dA\":255 },"); sb.AppendLine(" { \"sR\":238, \"sG\":238, \"sB\":238, \"sA\":255, \"dR\":128, \"dG\":128, \"dB\": 0, \"dA\":128 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); sb.AppendLine("{ \"act\":\"drawImg\", \"img\":\"nounaiSeme\", \"masu\": 118 },"); sb.AppendLine("{ \"act\":\"end_imgColor\", },"); } break; case Gkl_NounaiSeme.Gote: { sb.AppendLine("{"); sb.AppendLine(" \"act\":\"begin_imgColor\","); sb.AppendLine(" \"colors\":["); sb.AppendLine(" { \"sR\":255, \"sG\":255, \"sB\":255, \"sA\":255, \"dR\": 0, \"dG\": 0, \"dB\":200, \"dA\":255 },"); sb.AppendLine(" { \"sR\":238, \"sG\":238, \"sB\":238, \"sA\":255, \"dR\":128, \"dG\":128, \"dB\": 0, \"dA\":128 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); sb.AppendLine("{ \"act\":\"drawImg\", \"img\":\"nounaiSemeV\", \"masu\": 151 },"); sb.AppendLine("{ \"act\":\"end_imgColor\", },"); } break; default: break; } // 赤駒 { sb.AppendLine("{"); sb.AppendLine(" \"act\":\"begin_imgColor\","); sb.AppendLine(" \"colors\":["); sb.AppendLine(" { \"sR\":255, \"sG\":255, \"sB\":255, \"sA\":255, \"dR\":0, \"dG\":0, \"dB\":200, \"dA\":255 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); foreach (Gkl_KomaMasu km in board.KomaMasu1) { sb.AppendLine($"{{ act:\"drawImg\", img:\"{km.KomaImg}\", masu:{km.Masu} }},"); } sb.AppendLine("{ act:\"end_imgColor\", },"); } // 青駒 { sb.AppendLine("{"); sb.AppendLine(" \"act\":\"begin_imgColor\","); sb.AppendLine(" \"colors\":["); sb.AppendLine(" { \"sR\":255, \"sG\":255, \"sB\":255, \"sA\":255, \"dR\":200, \"dG\":0, \"dB\":0, \"dA\":255 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); foreach (Gkl_KomaMasu km in board.KomaMasu2) { sb.AppendLine($"{{ act:\"drawImg\", img:\"{km.KomaImg}\", masu:{km.Masu} }},"); } sb.AppendLine("{ act:\"end_imgColor\", },"); } // 水色 { sb.AppendLine("{"); sb.AppendLine(" act:\"begin_imgColor\","); sb.AppendLine(" colors:["); sb.AppendLine(" { sR:255, sG:255, sB:255, sA:255, dR:0, dG:200, dB:200, dA:255 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); foreach (Gkl_KomaMasu km in board.KomaMasu3) { sb.AppendLine($"{{ act:\"drawImg\", img:\"{km.KomaImg}\", masu:{km.Masu} }},"); } sb.AppendLine("{ act:\"end_imgColor\", },"); } // 緑駒 { sb.AppendLine("{"); sb.AppendLine(" act:\"begin_imgColor\","); sb.AppendLine(" colors:["); sb.AppendLine(" { sR:255, sG:255, sB:255, sA:255, dR:0, dG:200, dB:0, dA:255 },"); sb.AppendLine(" ],"); sb.AppendLine("},"); foreach (Gkl_KomaMasu km in board.KomaMasu4) { sb.AppendLine($"{{ act:\"drawImg\", img:\"{km.KomaImg}\", masu:{km.Masu} }},"); } sb.AppendLine("{ act:\"end_imgColor\", },"); } // 矢印 { // 赤色 sb.AppendLine("{ act:\"colorArrow\", style:\"rgba(240,100,100,0.8)\" },"); foreach (Gkl_Arrow a in board.Arrow) { sb.AppendLine($"{{ act:\"drawArrow\", from:\"{a.From}\", to:{a.To} }},"); } } // テキスト { sb.AppendLine(); sb.Append("\"テキスト\","); // キャプション if (board.Caption != "") { sb.Append("{ act:\"drawText\", text:\""); sb.Append(board.Caption); sb.Append("\" , x:0, y:20 },"); sb.AppendLine(); } // 例:「3手済 先手番/脳内 1手先」 { sb.Append("{ act:\"drawText\", text:\""); if (board.Temezumi != int.MinValue) { sb.Append($"{board.Temezumi}手済"); } switch (board.GenTeban) { case Playerside.P1: sb.Append(" 先手番"); break; case Playerside.P2: sb.Append(" 後手番"); break; default: break; } if (board.YomikaisiTemezumi != int.MinValue) { sb.Append("/脳内 "); sb.Append((board.Temezumi - board.YomikaisiTemezumi + 1).ToString()); sb.Append("手先"); } if (board.Score != float.MinValue) { sb.Append(" 評価"); sb.Append(((float)board.Score).ToString()); } sb.Append("\" , x:120, y:270 },"); sb.AppendLine(); } } sb.AppendLine("],"); return(sb.ToString()); }
/// <summary> /// 指定された局面で、指定された手番の駒の、利きマスを算出します。 /// 持ち駒は盤上にないので、利きを調べる必要はありません。 /// /// 「手目」は判定できません。 /// /// </summary> /// <param name="kouho"></param> /// <param name="sbGohosyu"></param> /// <param name="logger"></param> public static List_OneAndMulti <Finger, SySet <SyElement> > LAAAA_GetEffect( int yomikaisiTemezumi, bool isHonshogi, SkyConst src_Sky, Playerside pside_genTeban3, bool isAiteban, #if DEBUG KaisetuBoards logF_kiki, #endif string logBrd_caption, int temezumi_yomiCur_forLog, IMove move_forLog ) { #if DEBUG KaisetuBoard logBrd_kiki = new KaisetuBoard(); logBrd_kiki.Caption = logBrd_caption;// "利き_" logBrd_kiki.Temezumi = temezumi_yomiCur_forLog; logBrd_kiki.YomikaisiTemezumi = yomikaisiTemezumi; //logBrd_kiki.Score = 0.0d; logBrd_kiki.GenTeban = pside_genTeban3;// 現手番 logF_kiki.boards.Add(logBrd_kiki); #endif // 《1》 List_OneAndMulti <Finger, SySet <SyElement> > sMs_effect = new List_OneAndMulti <Finger, SySet <SyElement> >();//盤上の駒の利き { // 《1.1》 Playerside tebanSeme; //手番(利きを調べる側) Playerside tebanKurau; //手番(喰らう側) { if (isAiteban) { tebanSeme = Conv_Playerside.Reverse(pside_genTeban3); tebanKurau = pside_genTeban3; } else { tebanSeme = pside_genTeban3; tebanKurau = Conv_Playerside.Reverse(pside_genTeban3); } #if DEBUG if (Playerside.P1 == tebanSeme) { logBrd_kiki.NounaiSeme = Gkl_NounaiSeme.Sente; } else if (Playerside.P2 == tebanSeme) { logBrd_kiki.NounaiSeme = Gkl_NounaiSeme.Gote; } #endif } // 《1.2》 Fingers fingers_seme_BANJO; //盤上駒(利きを調べる側) Fingers fingers_kurau_BANJO; //盤上駒(喰らう側) Fingers dust1; Fingers dust2; Util_Sky_FingersQueryFx.Split_BanjoSeme_BanjoKurau_MotiSeme_MotiKurau( out fingers_seme_BANJO, out fingers_kurau_BANJO, out dust1, out dust2, src_Sky, tebanSeme, tebanKurau ); // 攻め手の駒の位置 #if DEBUG KaisetuBoard boardLog_clone = new KaisetuBoard(logBrd_kiki); foreach (Finger finger in fingers_seme_BANJO.Items) { RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now); Gkl_KomaMasu km = new Gkl_KomaMasu( Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""), Conv_SyElement.ToMasuNumber(koma.Masu) ); boardLog_clone.KomaMasu1.Add(km); } foreach (Finger finger in fingers_kurau_BANJO.Items) { RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(finger).Now); logBrd_kiki.KomaMasu2.Add(new Gkl_KomaMasu( Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanKurau, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""), Conv_SyElement.ToMasuNumber(koma.Masu) )); } logBrd_kiki = boardLog_clone; #endif // 《1.3》 SySet <SyElement> masus_seme_BANJO = Conv_Fingers.ToMasus(fingers_seme_BANJO, src_Sky); // 盤上のマス(利きを調べる側の駒) SySet <SyElement> masus_kurau_BANJO = Conv_Fingers.ToMasus(fingers_kurau_BANJO, src_Sky); // 盤上のマス(喰らう側の駒) // 駒のマスの位置は、特にログに取らない。 // 《1.4》 Maps_OneAndOne <Finger, SySet <SyElement> > kmEffect_seme_BANJO = Query_FingersMasusSky.To_KomabetuKiki_OnBanjo( fingers_seme_BANJO,//この中身がおかしい。 masus_seme_BANJO, masus_kurau_BANJO, src_Sky //Conv_Move.Move_To_KsString_ForLog(move_forLog, pside_genTeban3), );// 利きを調べる側の利き(戦駒) // 盤上駒の利き #if DEBUG logBrd_kiki = new KaisetuBoard(logBrd_kiki); kmEffect_seme_BANJO.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) => { RO_Star koma = Util_Starlightable.AsKoma(src_Sky.StarlightIndexOf(key).Now); string komaImg = Util_Converter_LogGraphicEx.PsideKs14_ToString(tebanSeme, Util_Komahaiyaku184.Syurui(koma.Haiyaku), ""); foreach (New_Basho masu in value.Elements) { boardLog_clone.Masu_theEffect.Add(masu.MasuNumber); } }); logBrd_kiki = boardLog_clone; #endif // 《1》 = 《1.4》の盤上駒+持駒 sMs_effect.AddRange_New(kmEffect_seme_BANJO); } return(sMs_effect); }