1571cd473c2730df9a97c66b6f1673ed05cf5e9d
[gnushogi.git] / doc / BOOKFILES
1 Binary book files
2 -----------------
3
4 In GNU Shogi the book file is a binary file.
5 The binary book file is "gnushogi.bbk". 
6 It is intended that text book files will only be 
7 used to generate the binary file (see remarks about syntax below).
8
9 The Makefile will generate a "gnushogi.bbk" in the "src" directory
10 from the text book file "gnushogi.tbk" in the "misc" directory
11 if "make gnushogi.bbk" is entered (the "gnushogir" executable
12 must be available in the "src" directory or it is created).
13
14 "make install" also copies the "gnushogi.bbk" to the installation
15 directory for libraries. 
16
17 Adding new opening lines
18 ------------------------
19
20 You can add entries to the binary file by providing a text book 
21 file "gnushogi.tbk" in the installation directory.
22 After starting gnushogi, the new entries will be added. It is 
23 recommended to remove the text book file after adding the entries to
24 the binary book file (or gnushogi will always check for new entries).
25
26 You can also use the "bsave" command while running gnushogi. The current
27 moves will be appended to the named file in a text book file style.
28
29 Syntax of text book files
30 -------------------------
31
32 Text book files are used to generate the binary book file. You must follow a 
33 special text book file syntax while adding an opening line. The book file 
34 parser (program that interpretes the text book moves) is abble to accept 
35 several common Shogi notations.
36 It also allows to include comments.
37                                   
38 All characters in a line following a '#' character are comments. 
39 The moves of an opening line is always between two lines with a '#' as its first
40 character. So, you must not use 1st-column-'#'-comments to give comments to an
41 opening line. "in-opening" comments are included in brackets ('[' ... ']').
42 After each ply, you can add a comment in parantheses ('(' ... ')'). 
43 This is normally used in Shogi notations to indicate the amount of time used by 
44 the player to enter that move. 
45
46 There are several possibilites to describe a move. Examples are
47
48    7g7f P7f P7g-7f P-7f 
49    3c3d +B3cx3d +Bx3d +B3d 
50    2d2c+ P2c+ P2dx2c+ Px2c+
51
52 When you use a character to indicate the piece type, you have to observe
53 whether the piece is promoted or not, i.e for a promoted piece you have to
54 indicate this using a '+'. In Shogi notations, the '+' for promoted pieces
55 may be important in order to avoid ambiguities.
56  
57 For example
58    
59    #
60    # Double Fortess
61    P7f P8d
62    [ this is an "in-opening" comment ]
63    S6h P8e(1)
64    # this is an "off-opening" comment
65
66 defines an opening line with two moves (four plys). The first comment line 
67 above an opening line serves as the name of the opening line. This name is 
68 used in case of errors in the opening line.  
69
70 You can use move numbers given as a decimal number followed by a '.'.
71
72 You can indicate good and bad moves using the character combinations 
73   ? ?? ?! ! !! !? !?/?! ?!/!?
74 They have the same meaning as in chess. The characters must directly follow 
75 a move, i.e. there must be no spaces between the move and the bad/good 
76 indicator.
77   P5e-5d? is correct, while P5e-5d ? is incorrect.
78 The indicators can be seen as a comment with one exception: if the first 
79 character of the indicator is a '?', the move is marked as BAD_MOVE by the 
80 program and it is not used by the computer if the computer has the option 
81 to make this move.
82
83 You can add some words which indicate the end of a game. These words are
84   Resigns Sennichite Jishogi 1-0 0-1
85 "Sennichite" means "draw by repitition and "Jishogi" means "impasse".
86
87 Request
88 -------
89
90 If you add new opening lines, please make them available to the
91 GNU Shogi community. Thank you.
92
93