Updating to version 1.3.2, last public release by Mike Vanier.
[gnushogi.git] / doc / gnushogi_19.html
1 <HTML>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3 <!-- Created on July, 7  2004 by texi2html 1.64 -->
4 <!-- 
5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
6             Karl Berry  <karl@freefriends.org>
7             Olaf Bachmann <obachman@mathematik.uni-kl.de>
8             and many others.
9 Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
10 Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
11  
12 -->
13 <HEAD>
14 <TITLE>GNU Shogi manual: gnushogi</TITLE>
15
16 <META NAME="description" CONTENT="GNU Shogi manual: gnushogi">
17 <META NAME="keywords" CONTENT="GNU Shogi manual: gnushogi">
18 <META NAME="resource-type" CONTENT="document">
19 <META NAME="distribution" CONTENT="global">
20 <META NAME="Generator" CONTENT="texi2html 1.64">
21
22 </HEAD>
23
24 <BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
25
26 <A NAME="SEC19"></A>
27 <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
28 <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_18.html#SEC18"> &lt; </A>]</TD>
29 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_20.html#SEC20"> &gt; </A>]</TD>
30 <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_5.html#SEC5"> &lt;&lt; </A>]</TD>
31 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi.html#SEC_Top"> Up </A>]</TD>
32 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_20.html#SEC20"> &gt;&gt; </A>]</TD>
33 <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi.html#SEC_Top">Top</A>]</TD>
34 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_toc.html#SEC_Contents">Contents</A>]</TD>
35 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_24.html#SEC24">Index</A>]</TD>
36 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_abt.html#SEC_About"> ? </A>]</TD>
37 </TR></TABLE>
38 <HR SIZE=1>
39 <H1> 3. gnushogi </H1>
40 <!--docid::SEC19::-->
41 <P>
42
43 This section describes how to run the "gnushogi" program.
44 </P><P>
45
46 SYNOPSIS
47      
48 </P><P>
49
50 gnushogi [ [[-]a] [-b bookfile] [-B binbookfile] [-C] [-h langfile] 
51 [-L langfile] [-r length] [-R] [-s pathname] [-l pathname] [-S binbooksize]
52 [-t] [-c size] [-T size] [-v] [-x] [-X] arg1 arg2 ]
53 </P><P>
54
55 DESCRIPTION
56 </P><P>
57
58 GNU shogi (gnushogi) plays a game of japanese chess (shogi) against the
59 user or it plays against itself.
60 </P><P>
61
62 At startup gnushogi reads the binbook file if it is present.  It then
63 looks for a book file.  If it is present it adds its contents to the
64 binbook data.  If the binbook file is writable a new combined binbook
65 file is written.
66 </P><P>
67
68 Gnushogi is a modified version of the gnuchess program.  It has a simple
69 alphanumeric board display, or it can be used with the xshogi program
70 under X windows.  The program gets its opening moves from the file
71 gnushogi.bbk which is located in a directory specified in the Makefile.
72 To invoke the program type:
73 </P><P>
74
75 <DL COMPACT>
76
77 <DT><SAMP>`gnushogi -C'</SAMP>
78 <DD>simple curses based version
79 <P>
80
81 <DT><SAMP>`gnushogi -X (or just gnushogi)'</SAMP>
82 <DD>xshogi compatible version
83 <P>
84
85 <DT><SAMP>`gnushogi -R'</SAMP>
86 <DD>raw test display version
87 </DL>
88 <P>
89
90 TIME CONTROLS
91 </P><P>
92
93 If one argument is given, it is the search time per move in
94 [minutes:]seconds.  So gnushogi 30 will generate one move every 30
95 seconds, while gnushogi 5:00 will generate one move every 5 minutes.
96 </P><P>
97
98 If two or more arguments are given, they will be used to set tournament
99 time controls with the first argument of each pair being the number of
100 moves and the second being the total clock time in minutes[:seconds].
101 Thus, entering gnushogi 60 5 will set the clocks for 5 minutes (300
102 seconds) for the first 60 moves, and gnushogi 30 3:30 will allow 3
103 minutes and 30 seconds for 30 moves.
104 </P><P>
105
106 gnushogi 30 5 1 :30 will allow 5 minutes for the first 30 moves and 30
107 seconds for each move after that.  Up to 4 pairs of controls may be
108 specified.
109 </P><P>
110
111 If no argument is given the program will prompt the user for level of
112 play.
113 </P><P>
114
115 For use with xshogi see the documentation on that program.
116 See section <A HREF="gnushogi_20.html#SEC20">4. xshogi</A>.
117 </P><P>
118
119 BOOK
120 </P><P>
121
122 The book gnushogi.tbk consists of a sequence of openings.  An opening
123 begins with a line starting with a # (the rest of the line is a comment).
124 Following this is a series of moves in algebraic notation alternating
125 between black and white separated by whitespace.  A move may have a ?
126 after it indicating this move should never be made in this position.  Moves
127 are stored as position:move so transpositions between openings can take
128 place.
129 </P><P>
130
131 HASHFILE
132 </P><P>
133
134 The hashfile if created should be on the order of 4 megabytes; you can
135 create such a hashfile by typing "gnushogi -c 22" (see below).  This
136 file contains positions and moves learned from previous games.  If a
137 hashfile is used the computer makes use of the experience it gained in
138 past games.  Tests run so far show that it plays no worse with the
139 hashfile than without, but it is not clear yet whether it provides a
140 real advantage.
141 </P><P>
142
143 LEGAL MOVES
144 </P><P>
145
146 Note: Piece letters are determined by the language file.  What is
147 specified here is the default (English).
148 </P><P>
149
150 Once gnushogi is invoked, the program will display the board and prompt
151 the user for a move.  To enter a move, use the notation 7g7f where the
152 first letter-number pair indicates the origin square and the second
153 letter-number pair indicates the destination square.  An alternative is
154 to use the notation P7f where the first letter indicates the piece type
155 (P,L,N,S,G,B,R,K).  To promote append a + the type of the new piece to
156 the move, as in 2d2c+ or P2c+. Note that you must use capital letters
157 for the pieces by default.
158 </P><P>
159
160 COMMAND-LINE OPTIONS
161 </P><P>
162
163 <DL COMPACT>
164
165 <DT><SAMP>`-a'</SAMP>
166 <DD>Do not search on opponent's time.
167 <P>
168
169 <DT><SAMP>`a'</SAMP>
170 <DD>Do search on opponent's time.
171 <P>
172
173 <DT><SAMP>`-b <VAR>bookfile</VAR>'</SAMP>
174 <DD>Use bookfile for opening book.
175 <P>
176
177 <DT><SAMP>`-B <VAR>binbookfile</VAR>'</SAMP>
178 <DD>Use binbookfile for binary opening book.
179 <P>
180
181 <DT><SAMP>`-c <VAR>size</VAR>'</SAMP>
182 <DD>Create a new HASHFILE.  File size is 2^size entries of approximately 65+?
183 bytes.
184 <P>
185
186 <DT><SAMP>`-C'</SAMP>
187 <DD>Use curses-based display mode.
188 <P>
189
190 <DT><SAMP>`-h'</SAMP>
191 <DD>Do not use hashfile.
192 <P>
193
194 <DT><SAMP>`h'</SAMP>
195 <DD>Do use hashfile.
196 <P>
197
198 <DT><SAMP>`-l <VAR>pathname</VAR>'</SAMP>
199 <DD>Pathname of the loadfile used with get or xget.
200 <P>
201
202 <DT><SAMP>`-L <VAR>lang</VAR>'</SAMP>
203 <DD>Use language lang from the file gnushogi.lang.  If -L is not specified
204 it uses the first language in the file.
205 <P>
206
207 <DT><SAMP>`-P <VAR>plylevels</VAR>'</SAMP>
208 <DD>Number of plys to include in the binbookfile.  For generating a
209 binbookfile.
210 <P>
211
212 <DT><SAMP>`-r <VAR>length</VAR>'</SAMP>
213 <DD>Rehash <EM>length</EM> times in searching entries for position in
214 transposition table.
215 <P>
216
217 <DT><SAMP>`-R'</SAMP>
218 <DD>Use raw text display mode.  This can be used for dumb terminals or for
219 systems that don't have curses.
220 <P>
221
222 <DT><SAMP>`-s <VAR>pathname</VAR>'</SAMP>
223 <DD>Pathname of the save file to use with the save command.
224 <P>
225
226 <DT><SAMP>`-S <VAR>size</VAR>'</SAMP>
227 <DD>Size of binbookfile for memory based books.  For creating a binbookfile.
228 <P>
229
230 <DT><SAMP>`-t'</SAMP>
231 <DD>Show statistics for HASHFILE.
232 <P>
233
234 <DT><SAMP>`-T <VAR>size</VAR>'</SAMP>
235 <DD>Set the transposition table size to 2^size entries.
236 <P>
237
238 <DT><SAMP>`-v'</SAMP>
239 <DD>Show version and patchlevel.
240 <P>
241
242 <DT><SAMP>`-x <VAR>value</VAR>'</SAMP>
243 <DD>Use value as the evaluation window xwndw.
244 <P>
245
246 <DT><SAMP>`-X'</SAMP>
247 <DD>Use xshogi display mode (the default).
248 <P>
249
250 </DL>
251 <P>
252
253 COMMANDS
254 </P><P>
255
256 In addition to legal moves, the following commands can be entered at the
257 gnushogi prompt.  Note: command names are determined by the language
258 file and may vary with the implementation.  The default language is
259 English.
260 </P><P>
261
262 <DL COMPACT>
263
264 <DT><SAMP>`alg'</SAMP>
265 <DD>allow algebraic input (not implemented).
266 <P>
267
268 <DT><SAMP>`Awindow'</SAMP>
269 <DD>change Alpha window (default score + 90).
270 <P>
271
272 <DT><SAMP>`Bwindow'</SAMP>
273 <DD>change Beta window (default score - 90).
274 <P>
275
276 <DT><SAMP>`beep'</SAMP>
277 <DD>toggles beeping after each move (default: on).
278 <P>
279
280 <DT><SAMP>`bd'</SAMP>
281 <DD>updates the current board position on the display.
282 <P>
283
284 <DT><SAMP>`book'</SAMP>
285 <DD>turns off use of the opening library.
286 <P>
287
288 <DT><SAMP>`both'</SAMP>
289 <DD>causes the computer to play both sides of a shogi game.
290 <P>
291
292 <DT><SAMP>`black'</SAMP>
293 <DD>causes the computer to play as White, if the computer was to move
294 first.
295 <P>
296
297 <DT><SAMP>`bsave'</SAMP>
298 <DD>saves a game to disk as a book textfile.  The program will prompt the
299 user for a file name.
300 <P>
301
302 <DT><SAMP>`gamein'</SAMP>
303 <DD>toggles game mode time control.  Assumes the time specified for time
304 control is the time for a complete game.  Input with the level command
305 should be the game time and the expected number of moves in a game.  go
306 command must be given.
307 <P>
308
309 <DT><SAMP>`coords'</SAMP>
310 <DD>show coordinates on the display (visual only).
311 <P>
312
313 <DT><SAMP>`contempt'</SAMP>
314 <DD>allows the value of <EM>contempt</EM> to be modified.
315 <P>
316
317 <DT><SAMP>`debug'</SAMP>
318 <DD>asks for a piece as color piece, as wb or bn, and shows its calculated
319 value on each square.
320 <P>
321
322 <DT><SAMP>`debuglevel'</SAMP>
323 <DD>sets level of debugging output if compiled with debug options.
324 <P>
325
326 <DT><SAMP>`depth'</SAMP>
327 <DD>allows the user to change the search depth of the program.  The maximum
328 depth is 29 ply.  Normally the depth is set to 29 and the computer
329 terminates its search based on elapsed time rather than depth.  If depth
330 is set to (say) 4 ply, the program will search until all moves have been
331 examined to a depth of 4 ply (with extensions up to 11 additional ply
332 for sequences of checks and captures).  If you set a maximum time per
333 move and also use the depth command, the search will stop at the
334 specified time or the specified depth, whichever comes first.
335 <P>
336
337 <DT><SAMP>`easy'</SAMP>
338 <DD>toggles easy mode (thinking on opponents time) on and off. The default
339 is easy mode ON.  If easy mode is disabled, the keyboard is polled for
340 input every so often and when input is seen the search is terminated. It
341 may also be terminated with a sigint.
342 <P>
343
344 <DT><SAMP>`edit'</SAMP>
345 <DD>allows the user to set up a board position.
346 <UL>
347
348 <LI>#
349 clear the board.
350 <P>
351
352 <LI>c
353 toggle piece color.
354 <P>
355
356 <LI>.
357 command will exit setup mode.
358 <P>
359
360 <LI>p3b
361 place a pawn on 3b
362 <P>
363
364 <LI>p3b+
365 place a promoted pawn on 3b
366 <P>
367
368 <LI>p*
369 place a pawn in hand (among the captured pieces)
370 <P>
371
372 </UL>
373 <P>
374
375 Pieces are entered by typing a letter (p,l,n,s,g,b,r,k)  for
376 the piece followed by the coordinate.  Here, letter case is ignored.
377 </P><P>
378
379 The usual warning about the language file applies.
380 </P><P>
381
382 <DT><SAMP>`exit'</SAMP>
383 <DD>exits gnushogi.
384 <P>
385
386 <DT><SAMP>`first'</SAMP>
387 <DD>tells the computer to move first.  Computer begins searching for a move.
388 (same as "go").
389 <P>
390
391 <DT><SAMP>`force'</SAMP>
392 <DD>allows the user to enter moves for both sides.  To get the program to
393 play after a sequence of moves has been entered use the "black" or
394 "white" commands.
395 <P>
396
397 <DT><SAMP>`get'</SAMP>
398 <DD>retrieves a game from disk.  The program will prompt the user for a file
399 name.
400 <P>
401
402 <DT><SAMP>`go'</SAMP>
403 <DD>tells the computer to move first.  Computer begins searching for a move.
404 (same as "first").
405 <P>
406
407 <DT><SAMP>`hash'</SAMP>
408 <DD>use/don't use hashfile.
409 <P>
410
411 <DT><SAMP>`hashdepth'</SAMP>
412 <DD>allows the user to change the minimum depth for using the hashfile and
413 the number of moves from the beginning of the game to use it.
414 <P>
415
416 <DT><SAMP>`help'</SAMP>
417 <DD>displays a short description of the commands and the current status of
418 options.
419 <P>
420
421 <DT><SAMP>`hint'</SAMP>
422 <DD>causes the program to supply the user with its predicted move.
423 <P>
424
425 <DT><SAMP>`level'</SAMP>
426 <DD>allows the user to set time controls such as 60 moves in 5 minutes etc.
427 In tournament mode, the program will vary the time it takes for each
428 move depending on the situation.  If easy mode is disabled (using the
429 "easy" command), the program will often respond with its move
430 immediately, saving time on its clock for use later on.
431 <P>
432
433 <DT><SAMP>`list'</SAMP>
434 <DD>writes the game moves and some statistics on search depth, nodes, and
435 time to the file "shogi.lst".
436 <P>
437
438 <DT><SAMP>`material'</SAMP>
439 <DD>toggle material flag - draws on no pawns and both sides &#60; rook.
440 <P>
441
442 <DT><SAMP>`new'</SAMP>
443 <DD>starts a new game.
444 <P>
445
446 <DT><SAMP>`p'</SAMP>
447 <DD>evaluates the board and shows the point score for each piece.  The total
448 score for a position is the sum of these individual piece scores.
449 <P>
450
451 <DT><SAMP>`post'</SAMP>
452 <DD>causes the program to display the principal variation and the score
453 during the search.  A score of 100 is equivalent to a 1 pawn advantage
454 for the computer.
455 <P>
456
457 <DT><SAMP>`quit'</SAMP>
458 <DD>exits the game.
459 <P>
460
461 <DT><SAMP>`random'</SAMP>
462 <DD>causes the program to randomize its move selection slightly.
463 <P>
464
465 <DT><SAMP>`rcptr'</SAMP>
466 <DD>set recapture mode.
467 <P>
468
469 <DT><SAMP>`remove'</SAMP>
470 <DD>backout the last level for both sides.  Equal to 2 undo's.
471 <P>
472
473 <DT><SAMP>`reverse'</SAMP>
474 <DD>causes the board display to be reversed.  That is, the Black's pieces will
475 now appear at the top of the board.
476 <P>
477
478 <DT><SAMP>`rv'</SAMP>
479 <DD>reverse board display.
480 <P>
481
482 <DT><SAMP>`save'</SAMP>
483 <DD>saves a game to disk.  The program will prompt the user for a file name.
484 <P>
485
486 <DT><SAMP>`switch'</SAMP>
487 <DD>causes the program to switch places with the opponent and begin
488 searching.
489 <P>
490
491 <DT><SAMP>`test'</SAMP>
492 <DD>performs some speed tests for MoveList and CaptureList generation, and
493 ScorePosition position scoring for the current board.
494 <P>
495
496 <DT><SAMP>`time'</SAMP>
497 <DD>set computer's time remaining, intended for synchronizing clocks among
498 multiple players.
499 <P>
500
501 <DT><SAMP>`tsume'</SAMP>
502 <DD>toggle tsume mode. In tsume mode, not all possible moves will be
503 generated. If a king is in check, only moves that get the king out of
504 check are generated.  If the king is not in check, only moves that give
505 check to the opponent's king are generated.
506 <P>
507
508 <DT><SAMP>`undo'</SAMP>
509 <DD>undoes the last move whether it was the computer's or the human's.  You
510 may also type "remove".  This is equivalent to two "undo"'s
511 (e.g. retract one move for each side).
512 <P>
513
514 <DT><SAMP>`white'</SAMP>
515 <DD>causes the computer to play as Black; if the computer is to move
516 first the go command must be given.
517 <P>
518
519 <DT><SAMP>`xget'</SAMP>
520 <DD>read an xshogi position file.
521 <P>
522
523 <DT><SAMP>`xsave'</SAMP>
524 <DD>save as an xshogi position file.
525 <P>
526
527 <DT><SAMP>`xwndw'</SAMP>
528 <DD>change X window. The window around alpha/beta used to determine whether
529 the position should be scored or just estimated.  Note: this has
530 <EM>nothing</EM> to do with xshogi or X windows; the terms are completely
531 separate.
532 <P>
533
534 </DL>
535 <P>
536
537 <A NAME="xshogi"></A>
538 <HR SIZE=1>
539 <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
540 <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_18.html#SEC18"> &lt; </A>]</TD>
541 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_20.html#SEC20"> &gt; </A>]</TD>
542 <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_5.html#SEC5"> &lt;&lt; </A>]</TD>
543 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi.html#SEC_Top"> Up </A>]</TD>
544 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_20.html#SEC20"> &gt;&gt; </A>]</TD>
545 <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi.html#SEC_Top">Top</A>]</TD>
546 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_toc.html#SEC_Contents">Contents</A>]</TD>
547 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_24.html#SEC24">Index</A>]</TD>
548 <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gnushogi_abt.html#SEC_About"> ? </A>]</TD>
549 </TR></TABLE>
550 <BR>  
551 <FONT SIZE="-1">
552 This document was generated
553 by <I>Michael C. Vanier</I> on <I>July, 7  2004</I>
554 using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
555 "><I>texi2html</I></A>
556
557 </BODY>
558 </HTML>