GNU Shogi 1.1p02
[gnushogi.git] / src / pattern.h
blobe44c1a38b54edda1043ec553fafb23ef03220f07
1 /* #define TEST_PATTERN */
2 /* #define DEBUG_PATTERN */
5 #define MAX_PATTERN 20 /* maximum number of pieces in pattern */
6 #define MAX_NEXT 6 /* maximum number of links */
7 #define MAX_NAME 20 /* maximum length of opening name */
10 typedef
11 struct PatternField_rec {
12 small_short side, piece, square;
13 } PatternField;
15 typedef
16 struct Pattern_rec {
17 short n;
18 PatternField field[MAX_PATTERN];
19 } PatternFields;
21 typedef
22 struct PatternSequence_rec {
23 small_short n;
24 small_short next[MAX_NEXT];
25 small_short distance[2];
26 small_short reachedGameCnt[2];
27 small_short visited;
28 PatternFields patternfields;
29 struct PatternSequence_rec *next_pattern;
30 } PatternSequence;
33 typedef
34 struct OpeningPattern_rec {
35 char name[MAX_NAME];
36 short n;
37 PatternSequence *sequence;
38 struct OpeningPattern_rec *next;
39 } OpeningPattern;
42 extern OpeningPattern *Patterns;
45 extern
46 short
47 string_to_board_color
48 (char *s);
50 extern
51 short
52 string_to_patternfields
53 (char *s, PatternFields *pattern);
55 extern
56 short
57 piece_to_pattern_distance
58 (short side, short piece, short pside, PatternFields *pattern);
60 extern
61 short
62 pattern_distance (short pside, PatternFields *pattern);
64 extern
65 short
66 board_to_pattern_distance
67 (short pside, OpeningPattern *opattern, short pmplty, short GameCnt);
69 extern
70 OpeningPattern *locate_opening_pattern(short pside, char *s, short GameCnt);
72 extern
73 void
74 DisplayPattern (PatternFields *pattern);
76 extern
77 void
78 GetOpeningPatterns ();
80 extern
81 void
82 ShowOpeningPatterns ();
84 extern
85 void update_advance_bonus (short pside, OpeningPattern *p);