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