Changing license to GPL3 (and bumping version to 1.4.0).
[gnushogi.git] / gnushogi / pattern.h
blob1db68ced75c14588015ebd820205ff0d3ed8c4d2
1 /*
2 * FILE: pattern.h
4 * ----------------------------------------------------------------------
6 * Copyright (c) 2012 Free Software Foundation
8 * GNU SHOGI is based on GNU CHESS
10 * This file is part of GNU SHOGI.
12 * GNU Shogi is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 3 of the License,
15 * or (at your option) any later version.
17 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with GNU Shogi; see the file COPYING. If not, see
24 * <http://www.gnu.org/licenses/>.
25 * ----------------------------------------------------------------------
30 #ifndef _PATTERN_H_
31 #define _PATTERN_H_
33 #define MAX_NAME 16 /* maximum length of opening name */
34 #define MAX_SEQUENCE 4 /* maximum number of sequences
35 * for an opening type */
37 #define CANNOT_REACH (-1)
38 #define NOT_TO_REACH (-2)
39 #define IS_REACHED (-3)
40 #define IS_SUCCESSOR (-4)
42 #define END_OF_SEQUENCES (-1)
43 #define END_OF_PATTERNS (-2)
44 #define END_OF_LINKS (-3)
45 #define END_OF_FIELDS (-4)
47 struct PatternField
49 short side;
50 short piece;
51 short square;
55 struct Pattern_rec
57 small_short visited;
58 small_short distance[2];
59 short reachedGameCnt[2];
60 short first_link;
61 short first_field;
62 short next_pattern;
66 struct OpeningSequence_rec
68 short opening_type;
69 short first_pattern[MAX_SEQUENCE];
73 extern struct Pattern_rec Pattern[];
74 extern struct OpeningSequence_rec OpeningSequence[];
76 extern short
77 piece_to_pattern_distance(short side, short piece,
78 short pside, short pattern);
80 extern short
81 pattern_distance(short pside, short pattern);
83 extern short
84 board_to_pattern_distance(short pside, short osequence,
85 short pmplty, short GameCnt);
87 extern short
88 locate_opening_sequence(short pside, char *s, short GameCnt);
90 extern void
91 DisplayPattern(FILE *fd, short first_field);
93 extern void
94 update_advance_bonus(short pside, short os);
96 extern void
97 GetOpeningPatterns(short *max_opening_sequence);
99 extern void
100 ShowOpeningPatterns(short max_opening_sequence);
103 extern short
104 ValueOfOpeningName(char *name);
106 extern void
107 NameOfOpeningValue(short i, char *name);
109 extern small_short pattern_data[];
112 #endif /* _PATTERN_H_ */