2 * pat2inc.c - convert GNU SHOGI pattern textfile to include file
4 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
6 * GNU SHOGI is based on GNU CHESS
8 * Copyright (c) 1988,1989,1990 John Stanback
9 * Copyright (c) 1992 Free Software Foundation
11 * This file is part of GNU SHOGI.
13 * GNU Shogi is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 1, or (at your option)
18 * GNU Shogi is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GNU Shogi; see the file COPYING. If not, write to
25 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
36 small_short PieceCnt[2];
37 small_short PieceList[2][NO_SQUARES];
38 small_short PieceIndex[NO_SQUARES];
40 small_short board[NO_SQUARES];
41 small_short color[NO_SQUARES];
48 short side, piece, f, t, d;
50 for ( side = 0; side <= 1; side++ ) {
51 printf("SIDE = %d\n",side);
52 for ( piece = pawn; piece <= king; piece++ ) {
53 printf("PIECE = %d\n",piece);
54 for ( f = 0; f < NO_SQUARES; f++ ) {
55 printf("FROM %d TO ",f);
56 for ( t = 0; t < NO_SQUARES; t++ ) {
57 d = piece_distance(side,piece,f,t);
58 if ( d != CANNOT_REACH )
71 main (int argc, char **argv)
75 short d, sq, side, max_opening_sequence, max_pattern_data;
76 char s[80], *Lang = NULL;
83 #if defined EXTLANGFILE
89 for (sq = 0; sq < NO_SQUARES; sq++ ) {
96 for (side = 0; side <= 1; side++)
101 strcpy(s,"g6i k5i g4i p9g p8g r* s3h p7g b8h B* S5f");
103 if ( string_to_board_color (s) )
105 printf("ERROR IN string_to_board_color");
110 UpdateDisplay (0, 0, 1, 0);
113 d = pattern_distance (black, &pattern);
115 printf("distance = %d\n", d);
119 ReadOpeningSequences (&max_pattern_data);
120 WriteOpeningSequences (max_pattern_data);
123 GetOpeningPatterns (&max_opening_sequence);
124 ShowOpeningPatterns (max_opening_sequence);