大道五目棋谱格式转换
#1 大道五目棋谱格式转换 作者:有志青年 发表时间:2012-3-9 9:53:01
从电脑中搜出一个古董软件——renjup3.1(大道五目)。在Win2000下无法运行,就对棋谱进行分析,编了一个程序,将renjup的棋谱导了出来。可以到下面的网址下载原版的大道五目:
一、大道五目棋谱格式
棋谱文件:Renjup31.ren
棋谱格式:以第1题为例
;001[]K06W06VER1.2
初级问题
初手はトビ三
000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
000000000000000000000000000126000000000000000
000000000000000000000000126000000000000000000
000000000000000000009000009142157000000000000
000000000000127127001126156171000000000000000
000000000000000126115001001009000000000000000
000000000000099084001001096009000000000000000
000000000000000142000001000144000000000000000
000000000000100115000009009000000000000000000
000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
第1~3行用不到,就不分析了。后面的就是数字棋谱了。15行,45列。也就是说每三个数字代表一个位置,共15×15位。001代表黑棋,009代表白棋,其他数字没搞明白,但不影响。
二、棋谱转换
1.将大道五目棋谱转为连珠妙手棋谱(即FIVER6棋谱,扩展名为“.Lws”)
void CRenjupConvertDlg::OnLws()
{
// TODO: Add your control notification handler code here
int i, j, k, t; //k:棋谱序号
int WhiteCount, BlackCount; //黑白棋子计数
int m, n; //棋子坐标数组Black[255], White[255]的下标
int data[15][15];
char buffer[50], *h[15], *v[15];
char *pch;
CString cstrLine, cstrTemp, Black[255], White[255];
FILE *fps, *fpd;
h[0] = "a";
h[1] = "b";
h[2] = "c";
h[3] = "d";
h[4] = "e";
h[5] = "f";
h[6] = "g";
h[7] = "h";
h[8] = "i";
h[9] = "j";
h[10] = "k";
h[11] = "l";
h[12] = "m";
h[13] = "n";
h[14] = "o";
v[0] = "15";
v[1] = "14";
v[2] = "13";
v[3] = "12";
v[4] = "11";
v[5] = "10";
v[6] = "9";
v[7] = "8";
v[8] = "7";
v[9] = "6";
v[10] = "5";
v[11] = "4";
v[12] = "3";
v[13] = "2";
v[14] = "1";
if((fps = fopen("E:\\MyProjects\\RenjupConvert\\Debug\\RENJUP31.REN", "r")) == NULL)
{
MessageBox("Can't open file!\n");
exit(0); //关闭所有文件,中止程序的运行。
}
for(k = 1; k <= 108; k++)
{
for(i = 0; i < 15 ; i++)
for(j =0; j < 15 ; j++)
data[j] = 0;
fgets(buffer, 50, fps);
fgets(buffer, 50, fps);
fgets(buffer, 50, fps);
//获取棋谱数据
for(i = 0; i < 15; i++)
{
fgets(buffer, 50, fps);
cstrLine = buffer;
for(j = 0; j < 15; j++)
{
cstrTemp = cstrLine.Mid(3*j, 3);
pch = (LPSTR)(LPCTSTR) cstrTemp;
t = atoi(pch);
data[j] = t;
}
}
//判断棋子坐标
m = n = BlackCount = WhiteCount = 0;
for(i = 0; i < 15; i++)
for(
#2 Re:大道五目棋谱格式转换 作者:一笔开天 发表时间:2012-8-2 23:11:40