/// <summary> /// 角道を想定しています。 /// 「8八」を指定すれば、答えは「7七,6六,5五,4四,3三,2二,1一」を返すことを想定しています。 /// /// TODO:先後 /// </summary> /// <param name="prm1"></param> /// <returns></returns> public static string func右上一直線升たち(string prm1) { StringBuilder sb = new StringBuilder(); // 例「8八」 int suji = ConverterKnSh.Suji_ToInt(prm1.Trim().ToCharArray()[0].ToString()); //8→8 int dan = ConverterKnSh.Suji_ToInt(prm1.Trim().ToCharArray()[1].ToString()); //八→8 bool first = true; suji--; dan--; while (0 < suji && 0 < dan)//本将棋盤という前提がある { if (first) { first = false; } else { sb.Append(","); } sb.Append(ConverterKnSh.Int_ToArabiaSuji(suji)); sb.Append(ConverterKnSh.Int_ToKanSuji(dan)); suji--; dan--; } return(sb.ToString()); }
/// <summary> /// ************************************************************************************************************************ /// 将棋盤の描画はここに書きます。 /// ************************************************************************************************************************ /// </summary> /// <param name="g"></param> public void Paint(Graphics g) { if (!this.Visible) { goto gt_EndMethod; } //---------- // 筋の数字 //---------- for (int i = 0; i < 9; i++) { g.DrawString(ConverterKnSh.Int_ToArabiaSuji(i + 1), new Font("MS ゴシック", 25.0f), Brushes.Black, new Point((8 - i) * this.MasuWidth + this.Bounds.X - 8, -1 * this.MasuHeight + this.Bounds.Y)); } //---------- // 段の数字 //---------- for (int i = 0; i < 9; i++) { g.DrawString(ConverterKnSh.Int_ToKanSuji(i + 1), new Font("MS ゴシック", 23.0f), Brushes.Black, new Point(9 * this.MasuWidth + this.Bounds.X, i * this.MasuHeight + this.Bounds.Y)); g.DrawString(Converter04.Int_ToAlphabet(i + 1), new Font("MS ゴシック", 11.0f), Brushes.Black, new Point(9 * this.MasuWidth + this.Bounds.X, i * this.MasuHeight + this.Bounds.Y)); } //---------- // 水平線 //---------- for (int i = 0; i < 10; i++) { g.DrawLine(Pens.Black, 0 * this.MasuWidth + this.Bounds.X, i * this.MasuHeight + this.Bounds.Y, 9 * this.MasuHeight + this.Bounds.X, i * this.MasuHeight + this.Bounds.Y ); } //---------- // 垂直線 //---------- for (int i = 0; i < 10; i++) { g.DrawLine(Pens.Black, i * this.MasuWidth + this.Bounds.X, 0 * this.MasuHeight + this.Bounds.Y, i * this.MasuHeight + this.Bounds.X, 9 * this.MasuHeight + this.Bounds.Y ); } //---------- // 升目 //---------- foreach (UserWidget widget in this.Owner.Widgets.Values) { if ("Masu" == widget.Type && Okiba.ShogiBan == widget.Okiba) { Shape_BtnMasuImpl cell = (Shape_BtnMasuImpl)widget.Object; SySet <SyElement> masus2 = new SySet_Default <SyElement>("何かの升"); masus2.AddElement(Masu_Honshogi.Items_All[widget.MasuHandle]); cell.Kiki = this.KikiBan.ContainsAll(masus2); cell.KikiSu = this.HMasu_KikiKomaList[widget.MasuHandle].Count; cell.Paint(g); } } gt_EndMethod: ; }
/// <summary> /// 角道を想定しています。 /// 「8八」を指定すれば、答えは「7九」を返すことを想定しています。 /// /// TODO:先後 /// </summary> /// <param name="prmList_Str">引数のドット区切りリスト</param> /// <returns></returns> public static string func右下一直線升たち(string prmList_Str) { StringBuilder sb = new StringBuilder(); List <string> prmList = new List <string>(); if (-1 != prmList_Str.IndexOf('.')) { string[] prmArray = prmList_Str.Split('.'); prmList.AddRange(prmArray); } else { prmList.Add(prmList_Str); } int prmIx = 0; foreach (string prm in prmList) { switch (prmIx) { case 0: { // 例「8八」 int suji = ConverterKnSh.Suji_ToInt(prmList_Str.Trim().ToCharArray()[0].ToString()); //8→8 int dan = ConverterKnSh.Suji_ToInt(prmList_Str.Trim().ToCharArray()[1].ToString()); //八→8 bool first = true; suji--; dan++; while (0 < suji && dan <= 9) //本将棋盤という前提がある { if (first) { first = false; } else { sb.Append(","); } sb.Append(ConverterKnSh.Int_ToArabiaSuji(suji)); sb.Append(ConverterKnSh.Int_ToKanSuji(dan)); suji--; dan++; } } break; default: { } break; } prmIx++; } return(sb.ToString()); }