4 * Convert GNU Shogi pattern textfile to an include file.
6 * ----------------------------------------------------------------------
7 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
8 * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
10 * GNU SHOGI is based on GNU CHESS
12 * Copyright (c) 1988, 1989, 1990 John Stanback
13 * Copyright (c) 1992 Free Software Foundation
15 * This file is part of GNU SHOGI.
17 * GNU Shogi is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 3 of the License,
20 * or (at your option) any later version.
22 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
23 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 * You should have received a copy of the GNU General Public License along
28 * with GNU Shogi; see the file COPYING. If not, see
29 * <http://www.gnu.org/licenses/>.
30 * ----------------------------------------------------------------------
39 extern void ReadOpeningSequences(short *pindex);
40 extern void WriteOpeningSequences(short pindex);
44 small_short PieceCnt[2];
45 small_short PieceList[2][NO_SQUARES];
46 small_short PieceIndex[NO_SQUARES];
48 small_short board[NO_SQUARES];
49 small_short color[NO_SQUARES];
56 short side, piece, f, t, d;
58 for (side = 0; side <= 1; side++)
60 printf("SIDE = %d\n", side);
62 for (piece = pawn; piece <= king; piece++)
64 printf("PIECE = %d\n", piece);
66 for (f = 0; f < NO_SQUARES; f++)
68 printf("FROM %d TO ", f);
70 for (t = 0; t < NO_SQUARES; t++)
72 d = piece_distance(side, piece, f, t);
74 if (d != CANNOT_REACH)
75 printf("%d:%d ", t, d);
88 main(int argc, char **argv)
92 short sq, side, max_pattern_data;
94 #if defined(EXTLANGFILE)
103 display_type = DISPLAY_RAW;
105 #if defined(EXTLANGFILE)
111 for (sq = 0; sq < NO_SQUARES; sq++)
113 board[sq] = no_piece;
119 for (side = 0; side <= 1; side++)
123 strcpy(s, "g6i k5i g4i p9g p8g r* s3h p7g b8h B* S5f");
125 if (string_to_board_color(s))
127 printf("ERROR IN string_to_board_color");
132 UpdateDisplay(0, 0, 1, 0);
135 d = pattern_distance(black, &pattern);
137 printf("distance = %d\n", d);
141 ReadOpeningSequences(&max_pattern_data);
142 WriteOpeningSequences(max_pattern_data);