2 * pattern.h - C source for GNU SHOGI
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.
28 /* #define TEST_PATTERN */
29 /* #define DEBUG_PATTERN */
32 #define MAX_NAME 16 /* maximum length of opening name */
33 #define MAX_SEQUENCE 4 /* maximum number of sequences for an opening type */
36 #define CANNOT_REACH (-1)
37 #define NOT_TO_REACH (-2)
38 #define IS_REACHED (-3)
39 #define IS_SUCCESSOR (-4)
41 #define END_OF_SEQUENCES (-1)
42 #define END_OF_PATTERNS (-2)
43 #define END_OF_LINKS (-3)
44 #define END_OF_FIELDS (-4)
55 small_short distance[2];
56 short reachedGameCnt[2];
63 struct OpeningSequence_rec {
65 short first_pattern[MAX_SEQUENCE];
69 extern struct OpeningSequence_rec OpeningSequence[];
70 extern struct Pattern_rec Pattern[];
76 piece_to_pattern_distance
77 (short side, short piece, short pside, short pattern);
81 pattern_distance (short pside, short pattern);
85 board_to_pattern_distance
86 (short pside, short osequence, short pmplty, short GameCnt);
89 short locate_opening_sequence(short pside, char *s, short GameCnt);
93 DisplayPattern (FILE *fd, short first_field);
96 void update_advance_bonus (short pside, short os);
100 GetOpeningPatterns (short *max_opening_sequence);
104 ShowOpeningPatterns (short max_opening_sequence);
107 extern short ValueOfOpeningName (char *name);
109 extern void NameOfOpeningValue (short i, char *name);
112 #ifdef EXTPATTERNFILE
114 extern void ReadOpeningSequences (short *pindex);
116 extern void WriteOpeningSequences (short pindex);