public void AddKoma(Basho masu, RO_Star_Koma koma)// Ks14 komaSyurui { if (Util_MasuNum.OnShogiban((int)masu.MasuNumber)) { this.ban81.Add(masu, koma); } else if (Util_MasuNum.OnSenteKomadai((int)masu.MasuNumber)) { if (this.motiBlack.ContainsKey(koma.Syurui)) { this.motiBlack[koma.Syurui] = this.motiBlack[koma.Syurui]; } else { this.motiBlack.Add(koma.Syurui, 0); } } else if (Util_MasuNum.OnGoteKomadai((int)masu.MasuNumber)) { if (this.motiWhite.ContainsKey(koma.Syurui)) { this.motiWhite[koma.Syurui] = this.motiWhite[koma.Syurui]; } else { this.motiWhite.Add(koma.Syurui, 0); } } }
private string CreateDanString(int leftestMasu) { StringBuilder sb = new StringBuilder(); List <RO_Star_Koma> list = new List <RO_Star_Koma>(); for (int i = leftestMasu; i >= 0; i -= 9) { Basho masu = new Basho(i); if (this.ban81.ContainsKey(masu)) { list.Add(this.ban81[masu]); } else { list.Add(null); } } foreach (RO_Star_Koma koma in list) { } return(sb.ToString()); }
public string CreateDanString(int leftestMasu) { StringBuilder sb = new StringBuilder(); List <RO_Star_Koma> list = new List <RO_Star_Koma>(); for (int i = leftestMasu; i >= 0; i -= 9) { Basho masu = new Basho(i); if (this.BanObject201.ContainsKey((int)masu.MasuNumber)) { list.Add(this.BanObject201[(int)masu.MasuNumber]); } else { list.Add(null); } } int spaceCount = 0; foreach (RO_Star_Koma koma in list) { if (koma == null) { spaceCount++; } else { if (0 < spaceCount) { sb.Append(spaceCount.ToString()); spaceCount = 0; } // 駒の種類だけだと先手ゴマになってしまう。先後も判定した。 switch (koma.Pside) { case Playerside.P1: sb.Append(KomaSyurui14Array.Sfen1P[(int)koma.Syurui]); break; case Playerside.P2: sb.Append(KomaSyurui14Array.Sfen2P[(int)koma.Syurui]); break; default: throw new Exception("ない手番"); } } } if (0 < spaceCount) { sb.Append(spaceCount.ToString()); spaceCount = 0; } return(sb.ToString()); }