4 * Convert GNU Shogi pattern textfile to an include file.
6 * ----------------------------------------------------------------------
8 * Copyright (c) 2012 Free Software Foundation
10 * GNU SHOGI is based on GNU CHESS
12 * This file is part of GNU SHOGI.
14 * GNU Shogi is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 3 of the License,
17 * or (at your option) any later version.
19 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
20 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with GNU Shogi; see the file COPYING. If not, see
26 * <http://www.gnu.org/licenses/>.
27 * ----------------------------------------------------------------------
36 extern void ReadOpeningSequences(short *pindex);
37 extern void WriteOpeningSequences(short pindex);
41 small_short PieceCnt[2];
42 small_short PieceList[2][NO_SQUARES];
43 small_short PieceIndex[NO_SQUARES];
45 small_short board[NO_SQUARES];
46 small_short color[NO_SQUARES];
53 short side, piece, f, t, d;
55 for (side = 0; side <= 1; side++)
57 printf("SIDE = %d\n", side);
59 for (piece = pawn; piece <= king; piece++)
61 printf("PIECE = %d\n", piece);
63 for (f = 0; f < NO_SQUARES; f++)
65 printf("FROM %d TO ", f);
67 for (t = 0; t < NO_SQUARES; t++)
69 d = piece_distance(side, piece, f, t);
71 if (d != CANNOT_REACH)
72 printf("%d:%d ", t, d);
85 main(int argc, char **argv)
89 short sq, side, max_pattern_data;
91 #if defined(EXTLANGFILE)
100 display_type = DISPLAY_RAW;
102 #if defined(EXTLANGFILE)
108 for (sq = 0; sq < NO_SQUARES; sq++)
110 board[sq] = no_piece;
116 for (side = 0; side <= 1; side++)
120 strcpy(s, "g6i k5i g4i p9g p8g r* s3h p7g b8h B* S5f");
122 if (string_to_board_color(s))
124 printf("ERROR IN string_to_board_color");
129 UpdateDisplay(0, 0, 1, 0);
132 d = pattern_distance(black, &pattern);
134 printf("distance = %d\n", d);
138 ReadOpeningSequences(&max_pattern_data);
139 WriteOpeningSequences(max_pattern_data);