Long-dead code removal: "rv" flag.
[gnushogi.git] / doc / gnushogi.6
blob46765a784d70385cf029097dc9a16ca2e8809747
1 .TH gnushogi 6
2 .SH NAME
3 gnushogi \- GNU Shogi (Japanese Chess)
4 .SH SYNOPSIS
5 .B gnushogi
7 .B [[-]a] 
8 .B [-b bookfile] 
9 .B [-B binbookfile] 
10 .B [-C] 
11 .B [-h langfile] 
12 .B [-L langfile] 
13 .B [-r length]
14 .B [-R]
15 .B [-s pathname] [-l pathname] 
16 .B [-S binbooksize]
17 .B [-t] [-c size] 
18 .B [-T size]
19 .B [-v]
20 .B [-x]
21 .B [-X]
22 .B arg1 arg2
24 .SH DESCRIPTION
25 .I Gnushogi
26 plays a game of japanese chess (shogi) against the user or it plays against
27 itself.
28 .PP
29 At startup 
30 .I Gnushogi
31 reads the
32 .I binbook
33 file if it is present. It then looks for a 
34 .I book
35 file. If it is present it adds its contents to the 
36 .I binbook
37 data. If the 
38 .I binbook
39 file is writable a new combined
40 .I binbook
41 file is written.
43 .PP
44 .I Gnushogi
45 is a modified version of the gnuchess program.  It has a simple
46 alphanumeric board display, or it can be compiled for use with the
47 .B xshogi 
48 program under X windows.  The program gets its opening moves from the file
49 .B gnushogi.bbk 
50 which is located in a directory specified in the Makefile.  To invoke the
51 program type:
52 .TP
53 .B gnushogi -C
54 - simple curses based version
55 .TP
56 .B gnushogi -X (or just gnushogi)
57 - xshogi compatible version
58 .TP
59 .B gnushogi -R
60 - raw test display version
61 .SH TIME CONTROLS
62 .PP
63 If one argument is given, it is the search time per move in 
64 [minutes:]seconds.
65 So 
66 .B gnushogi 30
67 will generate one move every 30 seconds, while
68 .B gnushogi 5:00
69 will generate one move every 5 minutes.
71 If two or more arguments are given, they will be used to set tournament
72 time controls with the first argument of each pair being the number of
73 moves and the second being the total clock time in minutes[:seconds].
74 Thus, entering
75 .B gnushogi 60 5
76 will set
77 the clocks for 5 minutes (300 seconds) for the first 60 moves,
78 and 
79 .B gnushogi 30 3:30
80 will allow 3 minutes and 30 seconds for 30 moves.
82 .B gnushogi 30 5 1 :30
83 will allow 5 minutes for the first 30 moves and 30 seconds for each move
84 after that.  Up to 4 pairs of controls may be specified.
86 If no argument is given the program will prompt the user for level of play.
88 For use with 
89 .B xshogi
90 see the documentation on that program.
91 .SH BOOK
92 .PP
93 The book
94 .I gnushogi.tbk
95 consists of a sequence of openings.  An opening begins with a line starting
96 with a
97 .B #
98 , the rest of the line is a comment.  Following this is a series of moves
99 in algebraic notation alternating black and white separated by white
100 space. A move may have a
101 .B ?
102 after it indicating this move should never be made in this position.
103 Moves are stored as position:move so transpositions between openings
104 can take place. 
105 .SH HASHFILE
107 The hashfile if created should be on the order of 4 megabytes or
108 .B gnushogi -c 22.
109 This file contains positions and moves learned from previous games.  If a
110 hashfile is used the computer makes use of the experience it gained in past
111 games. Tests run so far show that it plays no worse with the hashfile than
112 without, but it is not clear yet whether it provides a real advantage.
113 .SH LEGAL MOVES
115 .B Note:
116 Piece letters are determined by the language file.
117 What is specified here is the default (English).
119 Once
120 .I gnushogi
121 is invoked, the program will display the board and prompt the user
122 for a move. To enter a move, use the notation 
123 .B 7g7f
124 where the first letter-number pair indicates the origin square
125 and the second letter-number pair indicates the destination square.
126 An alternative is to use the notation 
127 .B P7f
128 where the first letter indicates the piece type (P,L,N,S,G,B,R,K).
129 To promote append a + the type of the new piece to the move, as in 
130 .B 2d2c+ 
131 or 
132 .B P2c+.
133 Note that you must use capital letters for the pieces by default.
134 .SH "COMMAND-LINE OPTIONS"
136 .B -a
137 Do not search on opponent's time.
139 .B a
140 Do search on opponent's time.
142 .B -b bookfile
143 Use bookfile for opening book.
145 .B -B binbookfile
146 Use binbookfile for binary opening book.
148 .B -c size
149 Create a new HASHFILE. File size is 2^size entries of approximately 65+? bytes.
151 .B -C
152 Use curses-based display mode.
154 .B -h 
155 Do not use hashfile.
157 .B h 
158 Do use hashfile.
160 .B -l pathname
161 Pathname of the loadfile use with
162 .BR get
164 .BR xget.
166 .B -L lang
167 Use language 
168 .I lang from the file 
169 .B gnushogi.lang.
170 If -L is not specified it uses the first language in the file.
172 .B -P plylevels
173 Number of plys to include in the binbookfile. For generating a binbookfile.
175 .B -r length
176 Rehash length times in searching  entries for position in transposition table.
178 .B -R
179 Use raw text display mode.  This can be used for dumb terminals or for
180 systems that don't have curses.
182 .B -s pathname
183 Pathname of the save file to use with the
184 .BR save
185 command.
187 .B -S size
188 Size of binbookfile for memory based books. For creating a binbookfile.
190 .B -t
191 Show statistics for HASHFILE
193 .B -T size
194 Set the transposition table size to 2^size entries.
196 .B -v
197 Show version and patchlevel.
199 .B -x value
201 .BR value
202 as the evaluation window
203 .BR xwndw.
205 .B -X
206 Use xshogi display mode (the default).
207 .SH "COMMANDS"
209 In addition to legal moves, the following commands are available as responses.
210 .B Note:
211 command names are determined by the 
212 .I language
213 file and may vary with the implementation. The default language is English.
215 .B alg
216 -- allow algebraic input (not implemented)
218 .B Awindow
219 -- change Alpha window (default score + 90)
221 .B Bwindow
222 -- change Beta window (default score - 90)
224 .B beep
225 -- toggles beeping after each move (default: on).
227 .B bd
228 -- updates the current board position on the display.
230 .B book
231 -- turns off use of the opening library.
233 .B both
234 -- causes the computer to play both sides of a shogi game.
236 .B black
237 -- causes the computer to take the white pieces, if the computer is to move
238 first.
240 .B bsave
241 -- saves a game to disk as a book textfile.  
242 The program will prompt the user for a file name.
244 .B gamein
245 -- toggles game mode time control. Assumes the time specified for time control
246 is the time for a complete game.  Input with the level command should be the
247 game time and the expected number of moves in a game.
248 .B go
249 command must be given.
251 .B contempt
252 -- allows the value of 
253 .I contempt
254 to be modified.
256 .B debug
257 --  asks for a piece as color piece, as wb or bn, and shows its calculated value on
258 each square.
260 .B debuglevel
261 --  sets level of debugging output if compiled with debug options.
263 .B depth
264 -- allows the user to change the search depth of the program.  The maximum
265 depth is 29 ply.  Normally the depth is set to 29 and the computer
266 terminates its search based on elapsed time rather than depth.  If depth is
267 set to (say) 4 ply, the program will search until all moves have been
268 examined to a depth of 4 ply (with extensions up to 11 additional ply for
269 sequences of checks and captures).  If you set a maximum time per move and
270 also use the depth command, the search will stop at the specified time or
271 the specified depth, whichever comes first.
273 .B easy
274 -- toggles easy mode (thinking on opponents time) on and off. The default
275 is easy mode ON.  If easy mode is disabled, the keyboard is polled for
276 input every so often and when input is seen the search is terminated. It
277 may also be terminated with a
278 .I sigint.
280 .B edit
281 -- allows the user to set up a board position.
283 .B  #
284 - command will clear the board.
286 .B  c 
287 - toggle piece color. 
289 .B  .
290 - command will exit setup mode.
292 .B  p3b
293 - place a pawn on 3b
295 .B  p3b+
296 - place a promoted pawn on 3b
298 .B  p*
299 - place a pawn to the captured pieces
301 Pieces are entered by typing a letter (p,l,n,s,g,b,r,k) for
302 the piece followed by the coordinate.
304 The usual warning about the
305 .I language file
306 applies.
308 .B exit
309 -- exits gnushogi.
311 .B first
312 -- tells the computer to move first. Computer begins searching for a move.
313 (same as "go").
315 .B force
316 -- allows the user to enter moves for both
317 sides. To get the program to play after a sequence of moves
318 has been entered use the 'black' or 'white' commands.
320 .B get
321 -- retrieves a game from disk.  The program will
322 prompt the user for a file name.
324 .B hash
325 -- use/don't use hashfile.
327 .B hashdepth
328 -- allows the user to change the minimum depth for using the hashfile and
329 the number of moves from the beginning of the game to use it.
331 .B help
332 -- displays a short description of the commands and the current status of options.
334 .B go
335 -- tells the computer to move first. Computer begins searching for a move.
336 (same as "first").
338 .B hint
339 -- causes the program to supply the user with its predicted move.
341 .B level
342 -- allows the user to set time controls such as 60 moves in 5 minutes etc.
343 In tournament mode, the program will vary the time it takes for each move
344 depending on the situation.  If easy mode is disabled (using the 'easy'
345 command), the program will often respond with its move immediately, saving
346 time on its clock for use later on.
348 .B list
349 -- writes the game moves and some statistics on search depth, nodes, and
350 time to the file 'shogi.lst'.
352 .B material
353 -- toggle material flag - draws on no pawns and both sides < rook
355 .B new
356 -- starts a new game.
358 .B p
359 -- evaluates the board and shows the point score for each piece. The total score for
360 a position is the sum of these individual piece scores.
362 .B post
363 -- causes the program to display the principal variation and the score
364 during the search.  A score of 100 is equivalent to a 1 pawn advantage for
365 the computer.
367 .B quit
368 -- exits the game.
370 .B random
371 -- causes the program to randomize its move selection slightly.
373 .B rcptr
374 -- set recapture mode.
376 .B remove
377 -- backout the last level for both sides. Equal to 2 
378 .I undo's.
380 .B reverse
381 -- causes the board display to be reversed.  That
382 is, the black pieces will now appear at the top of the board.
384 .B save
385 -- saves a game to disk.  The program will prompt the user for a file name.
387 .B switch
388 -- causes the program to switch places with the opponent and begin
389 searching.
391 .B test
392 -- performs some speed tests for MoveList and CaptureList generation, and
393 ScorePosition position scoring for the current board.
395 .B time
396 -- set computer's time remaining, intended for synchronizing clocks among
397 multiple players.
399 .B tsume
400 -- toggle tsume mode. In tsume mode, not all possible moves will be
401 generated. If a king is in check, only moves that get the king out of check
402 are generated.  If the king is not in check, only moves that give check to
403 the opponent's king are generated.
405 .B undo
406 -- undoes the last move whether it was the computer's
407 or the human's. You may also type "remove". This is equivalent
408 to two "undo"'s (e.g. retract one move for each side).
410 .B white
411 -- causes the computer to take the black pieces, if the computer is to move
412 first the
413 .B go 
414 command must be given.
416 .B xget
417 -- read an 
418 .I xshogi
419 position file.
421 .B xsave
422 -- save as an 
423 .I xshogi
424 position file.
426 .B xwndw
427 -- change X window. The window around alpha/beta used to determine whether
428 the position should be scored or just estimated.
429 .SH BUGS
432 .SH SEE ALSO
434 xshogi(6)