标题:谁能帮忙翻成C语言
取消只看楼主
chaw899
Rank: 2
等 级:禁止访问
帖 子:48
专家分:11
注 册:2018-11-29
结帖率:88.89%
 问题点数:0 回复次数:0 
谁能帮忙翻成C语言
解析sgf棋谱

(;CA[gb2312]SZ[19]AP[MultiGo:4.4.4]MULTIGOGM[1]
;B[qd];W[dp];B[dc];W[ce];B[pq];W[qo];B[pl];W[oc];

解析成r16,d4,d17,c15,q3,r5......

把下面的代码翻译一成C语言,谢谢!

private void Window_Loaded(object sender, RoutedEventArgs e)
{

SGFFile.Text = sgf_string = File.ReadAllText("1.sgf");
}

private void Button_Click(object sender, RoutedEventArgs e)
{
string[] lines = sgf_string.Split(';') ;
foreach (var i in lines)
{
if(i.StartsWith("B") || i.StartsWith("W") )
{
string a = i.Substring(2).Remove(2);
string x = a.Remove(1);
if(System.Text.Encoding.ASCII.GetBytes(x)[0]> System.Text.Encoding.ASCII.GetBytes

("l")[0])
{
byte[] array = new byte[1];
array[0] = (byte)(Convert.ToInt32(System.Text.Encoding.ASCII.GetBytes(x)[0] 1));
x = Convert.ToString(System.Text.Encoding.ASCII.GetString(array));
}
string y = a.Substring(1);
y = (System.Text.Encoding.ASCII.GetBytes("s")[0] -

System.Text.Encoding.ASCII.GetBytes(y)[0] 1).ToString();

decode = decode x y ",";
}

}
decode = decode.Remove(decode.Length-1,1);

SGFDecode.Text = decode;
}
}
搜索更多相关主题的帖子: C语言 Text string System ASCII 
2019-01-09 15:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-492597-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.338705 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved