Bool transition: do not scanf directly into would-be bools.
[gnushogi.git] / gnushogi / pattern.h
bloba7e4fc07eb7414c7f99c514e452d8595e4687259
1 /*
2 * FILE: pattern.h
4 * ----------------------------------------------------------------------
5 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
6 * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
7 * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation
9 * GNU SHOGI is based on GNU CHESS
11 * Copyright (c) 1988, 1989, 1990 John Stanback
12 * Copyright (c) 1992 Free Software Foundation
14 * This file is part of GNU SHOGI.
16 * GNU Shogi is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 3 of the License,
19 * or (at your option) any later version.
21 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
22 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * for more details.
26 * You should have received a copy of the GNU General Public License along
27 * with GNU Shogi; see the file COPYING. If not, see
28 * <http://www.gnu.org/licenses/>.
29 * ----------------------------------------------------------------------
34 #ifndef _PATTERN_H_
35 #define _PATTERN_H_
37 #define MAX_NAME 16 /* maximum length of opening name */
38 #define MAX_SEQUENCE 4 /* maximum number of sequences
39 * for an opening type */
41 #define CANNOT_REACH (-1)
42 #define NOT_TO_REACH (-2)
43 #define IS_REACHED (-3)
44 #define IS_SUCCESSOR (-4)
46 #define END_OF_SEQUENCES (-1)
47 #define END_OF_PATTERNS (-2)
48 #define END_OF_LINKS (-3)
49 #define END_OF_FIELDS (-4)
51 struct PatternField
53 short side;
54 short piece;
55 short square;
59 struct Pattern_rec
61 small_short visited;
62 small_short distance[2];
63 short reachedGameCnt[2];
64 short first_link;
65 short first_field;
66 short next_pattern;
70 struct OpeningSequence_rec
72 short opening_type;
73 short first_pattern[MAX_SEQUENCE];
77 extern struct Pattern_rec Pattern[];
78 extern struct OpeningSequence_rec OpeningSequence[];
80 extern short
81 piece_to_pattern_distance(short side, short piece,
82 short pside, short pattern);
84 extern short
85 pattern_distance(short pside, short pattern);
87 extern short
88 board_to_pattern_distance(short pside, short osequence,
89 short pmplty, short GameCnt);
91 extern short
92 locate_opening_sequence(short pside, char *s, short GameCnt);
94 extern void
95 DisplayPattern(FILE *fd, short first_field);
97 extern void
98 update_advance_bonus(short pside, short os);
100 extern void
101 GetOpeningPatterns(short *max_opening_sequence);
103 extern void
104 ShowOpeningPatterns(short max_opening_sequence);
107 extern short
108 ValueOfOpeningName(char *name);
110 extern small_short pattern_data[];
113 #endif /* _PATTERN_H_ */