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