-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.c
65 lines (52 loc) · 1.28 KB
/
convert.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <allegro.h>
//char motif_name[5][4] = { "", "SUNY", "CSTL", "RCKY", "SNWY"};
int main(int argc, char *argv[])
{
PACKFILE *file;
int l, k, j, i;
int maps[20][15][2][101];
int motif[100];
allegro_init();
file = pack_fopen(argv[1], "rp");
for (l = 0; l < 100; l++)
for (k = 0; k < 2; k++)
for (j = 0; j < 15; j++)
for (i = 0; i < 20; i++)
maps[i][j][k][l] = pack_igetw(file);
for (l = 0; l < 100; l++)
motif[l] = pack_igetw(file);
pack_fclose(file);
file = pack_fopen(argv[2], "wp");
pack_iputw('B', file);
pack_iputw('L', file);
pack_iputw('n', file);
for (l = 0; l < 100; l++)
for (k = 0; k < 2; k++)
for (j = 0; j < 15; j++)
for (i = 0; i < 20; i++)
pack_iputw(maps[i][j][k][l], file);
for (l = 0; l < 100; l++)
{
// pack_fwrite(motif_name[motif[l]], sizeof(motif_name[motif[l]]), file);
switch(motif[l])
{
case 1:
pack_fwrite("SUNY", 4, file);
break;
case 2:
pack_fwrite("CSTL", 4, file);
break;
case 3:
pack_fwrite("RCKY", 4, file);
break;
case 4:
pack_fwrite("SNWY", 4, file);
break;
default:
pack_fwrite(" ", 4, file);
break;
}
}
pack_fclose(file);
return(0);
}