Updating to version 1.3, release made by Mike Vanier (mvanier@bbb.caltech.edu).
[gnushogi.git] / doc / xshogi.6
1 .TH xshogi 6 "Jan 29, 1993" "X Version 11"
2 .SH NAME
3 xshogi \- Xt/Athena user interface for gnushogi
4 .SH SYNOPSIS
5 .B xshogi [ options ]
6 .SH DESCRIPTION
7 .IR xshogi
8 provides an X11/Xt/Athena Widgets user interface for gnushogi.
9 With
10 .IR xshogi
11 you can play gnushogi,
12 set up arbitrary positions,
13 force variations, or watch
14 .IR xshogi
15 manage a game between two shogi programs.
16 Furthermore, it can be used as an interface between two players on
17 different displays.
18 .LP
19 .IR xshogi
20 can also be used as a shogi board to play out games.
21 It will read through a game file or allow a player to play 
22 through a variation manually (force mode).
23 This is useful for keeping track of email postal games or browsing games
24 off the net.
25 .LP
26 After starting
27 .IR xshogi ,
28 you can make moves by pressing mouse button 1
29 while the cursor is over a square with your piece on it
30 and dragging the mouse to another square.
31 If the move is illegal, gnushogi will not allow it.
32 .IR xshogi
33 will then retract the move.
34
35 .SH RULES
36 Shogi is a Japanese board game played by two players.
37 The object of the game is to capture the opponent's King.
38 Shogi is played on a nine-by-nine board. The vertical rows are called files,
39 the horizontal ones ranks or just rows. Each player has twenty pieces:
40 one King, two Gold Generals, two Silver Generals, two kNights,
41 two Lances, one Rook, one Bishop and nine Pawns.
42 The player moving up the board and making the first move is referred to as
43 black and his opponent white, although in Shogi sets all pieces have the
44 same colour. They are differentiated only in direction: pieces pointing
45 away from a player are his. The pieces lie flat on the board and have
46 their Japanese name written on them.
47
48 .SS Moves
49 .TP 8
50 .B King
51 one step in any direction per move
52 .TP 8
53 .B "Gold General"
54 one step per move any way except diagonally backward (as a king but not diagonally backward)
55 .TP 8
56 .B "Silver General"
57 one step per move forwards or diagonally (as a king but not sideways or vertically backward)
58 .TP 8
59 .B Knight
60 one step to left or right, and two steps forward (the only piece which may jump over other pieces)
61 .TP 8
62 .B Rook
63 moves vertically or horizontally any distance
64 .TP 8
65 .B Bishop
66 moves diagonally any distance
67 .TP 8
68 .B Lance
69 moves forward any distance
70 .TP 8
71 .B Pawn
72 one step forward
73
74 .SS Promotion
75 The three rows furthest away from a player are called the promotion zone. Apart
76 from the King and the Gold, any piece can be promoted to a more powerful piece
77 when it makes a move completely or partly in the promotion zone. So, when a
78 piece moves into, out of or fully inside the promotion zone it may be promoted
79 upon completion of its move. Promotion is optional, provided that the piece
80 still can make a legal move in case it is not promoted: if a Pawn or a Lance
81 move to the last row, or a Knight moves to either of the last two rows, it must
82 be promoted. In Shogi sets promoting a piece is done by turning this piece
83 upside down. Its promoted name is written on its other side.
84
85 Apart from the King and the Gold General all pieces can promote.
86 After promotion their moves are as follows:
87 .TP 8
88 .B +
89 Promoted Silver, promoted kNight, promoted Lance and promoted Pawn all
90 move as a Gold.
91 .TP 8
92 .B +
93 The promoted Rook in addition to the moves of the unpromoted Rook can
94 move one step in the diagonal directions. It either moves like a Rook
95 or like a King.
96 .TP 8
97 .B +
98 The promoted Bishop in addition to the moves of the unpromoted Bishop
99 can move one step horizontally or vertically. It either moves like a
100 Bishop or like a King.
101
102 .SS Capturing and dropping pieces
103
104 When one piece moves onto the same square as an opponent's piece, the
105 opponent's piece is captured. All pieces capture in the same way that they
106 move. Captured pieces become part of the capturer's force. In a later move,
107 instead of moving a piece on the board, a player may put a piece that he
108 has captured from his opponent back onto the board, in an empty square.
109 This is called dropping a piece. Pieces are always dropped unpromoted: if
110 a promoted piece is captured, it reverts to its unpromoted rank.
111 Pieces may be dropped on any empty square on the board with only three
112 restrictions:
113 .TP 8
114 .B 1)
115 After dropping a piece it must be able to make a legal move. This applies
116 to Pawns, Knights or Lances. They may not be dropped onto a square from
117 which they will never be able to move.
118 .TP 8
119 .B 2)
120 Attacking the King by dropping a Pawn on the square in front of him is not
121 allowed if the King cannot prevent being captured on the following move.
122 To use the Chess expression: checkmating the King with a Pawn drop is
123 prohibited.
124 .TP 8
125 .B 3)
126 A pawn may only be dropped on a file (vertical row) if there is no other
127 unpromoted pawn of the same player on that file.
128
129 .SS Draws
130
131 The game of Shogi has very few draws (roughly 1 percent), mainly because of
132 the possibility to drop pieces. Draws cannot be offered and can arise from
133 two situations:
134 .TP 8
135 .B 1)
136 A position (including the pieces in hand) occurs 4 times with the same
137 player to move ("Sennichite"). However, if this is caused by consecutive
138 checks (direct attacks on the King, threatening to capture it on the next
139 move) by one side, the player giving these checks loses the game.
140 .TP 8
141 .B 2)
142 Both players have moved their King into the the promotion zone (or they
143 cannot be prevented to do so) and the Kings cannot be checkmated. In
144 that case the players may decide to count their pieces where the King does
145 not count, the Rook and Bishop count as 5 points, and all other pieces as
146 one point. Promotion is disregarded. If both players have at least 24
147 points the game is a draw ("Jishogi"). If a player has less, he loses the
148 game.
149 .PP
150 Of course, a player can refuse to count pieces when he still has mating
151 chances or chances to gain material which would affect the outcome of the
152 counting. There is no strict rule about what to do if this is not the case,
153 but nonetheless a player refuses to count up (e.g. because he does not have
154 enough points for a draw). It has been generally accepted that in such a
155 case the game ends and the pieces are counted after one player has managed
156 to get all his pieces protected in the promotion zone.
157
158 .SH OPTIONS
159 The following command line options also correspond to X resources
160 that you can set in your
161 .IR \&.Xdefaults
162 file.
163 .TP 8
164 .B standard Xt options
165 .IR xshogi
166 accepts standard Xt options like -display, -geometry, and -iconic.
167 .TP 8
168 .B -tc or -timeControl minutes[:seconds]
169 Amount of time for a set of moves determined by
170 .IR movesPerSession .
171 If this number of moves is played within the time control period,
172 .IR xshogi
173 resets the time clocks.
174 Default: 5 minutes.
175 .TP 8
176 .B -mps or -movesPerSession moves
177 Number of moves in a time control period.
178 Default: 40 moves.
179 .TP 8
180 .B -st or -searchTime minutes[:seconds]
181 Tell gnushogi to spend at most the given amount of time searching
182 for each of its moves.  Without this option, gnushogi chooses
183 its search time based on the number of moves and amount of time
184 remaining until the next time control.
185 Setting this option also sets -clockMode to False.
186 .TP 8
187 .B -sd or -searchDepth number
188 Tell gnushogi to look ahead at most the given number of moves when searching
189 for a move to make.  Without this option, gnushogi chooses
190 its search depth based on the number of moves and amount of time
191 remaining until the next time control.
192 Setting this option also sets -clockMode to False.
193 .TP 8
194 .B -clock or -clockMode "(True | False)"
195 Determines whether or not to use the clock.
196 If clockMode is False, the clock does not run, but the
197 side that is to play next is still highlighted.
198 .TP 8
199 .B -td or -timeDelay seconds
200 Time delay between moves during "Load Game".
201 This doesn't have to be round numbers.
202 Try -td 0.4.  Default: 1 second.
203 .TP 8
204 .B -nsp or -noShogiProgram "(True | False)"
205 If this option is True,
206 .IR xshogi
207 acts as a passive shogiboard; it does not
208 try to start a shogi program, not even to check whether
209 moves made in Force mode are legal.
210 It also sets -clockMode to False.
211 Default: False.
212 .TP 8
213 .B -fsp or -firstShogiProgram program
214 Name of first shogi program.
215 In matches between two machines, this program plays white.
216 Default: "gnushogi".
217 .TP 8
218 .B -ssp or -secondShogiProgram program
219 Name of second shogi program, if needed.
220 In matches between two machines, this program plays black; otherwise
221 it is not started.
222 Default: "gnushogi".
223 .TP 8
224 .B -fh or -firstHost host
225 Name of host the first shogi program plays on.
226 Default: "localhost".
227 .TP 8
228 .B -sh or -secondHost host
229 Name of host the second shogi program plays on.
230 Default: "localhost".
231 .TP 8
232 .B -rsh or -remoteShell shell_name
233 Some systems do not use rsh as the remote shell.
234 This option allows a user to name the remote shell command.
235 This should be done in the resource file.
236 .TP 8
237 .B -mm or -matchMode "(False | Init | Position | Opening)"
238 Automatically run a game between
239 .IR firstShogiProgram
240 and
241 .IR secondShogiProgram .
242 If
243 .IR matchMode
244 is set to
245 .IR Init ,
246 .IR xshogi
247 will start the game with the initial shogi position.
248 If
249 .IR matchMode
250 is set to
251 .IR Position ,
252 .IR xshogi
253 will start the game with the position specified by the
254 .IR loadPositionFile
255 resource.
256 If
257 .IR matchMode
258 is set to
259 .IR Opening ,
260 .IR xshogi
261 will play out the opening moves specified by the
262 .IR -loadGameFile
263 resource.
264 If the
265 .IR -saveGameFile 
266 resource is set, a move record for the match will
267 be saved in the specified file.
268 Default: "False".
269 .TP 8
270 .B -lgf or -loadGameFile file
271 Name of file to read a game record from.
272 Game files are found in the directory named by the SHOGIDIR environment
273 variable.  If this variable is not set, the current directory is used
274 unless the file name starts with a /.
275 .TP 8
276 .B -lpf or -loadPositionFile file
277 Name of file to read a game position from.
278 Position files are found in the directory named by the SHOGIDIR environment
279 variable.  If this variable is not set, the current directory is used
280 unless the file name starts with a /.
281 .TP 8
282 .B -sgf or -saveGameFile file
283 Name of file to save a game record to.
284 Game files are saved in the directory named by the SHOGIDIR environment
285 variable.  If this variable is not set, the current directory is used
286 unless the file name starts with a /.
287 .TP 8
288 .B -spf or -savePositionFile file
289 Name of file to save a game position to.
290 Position files are saved in the directory named by the SHOGIDIR environment
291 variable.  If this variable is not set, the current directory is used
292 unless the file name starts with a /.
293 .TP 8
294 .B -coords or -showCoords "(True | False)"
295 If this option is True,
296 .IR xshogi
297 displays algebraic coordinates along the board's left and bottom edges.
298 The default is False.  The
299 .IR coordFont
300 resource specifies what font to use.  
301 .TP 8
302 .B -mono or -monoMode "(True | False)"
303 Determines whether
304 .IR xshogi
305 displays its pieces and squares with two colors or four.
306 You shouldn't have to specify monochrome.
307 .IR xshogi
308 will determine if this is necessary.
309 .TP 8
310 .B -wpc or -blackPieceColor color
311 Color specification for black pieces
312 suitable for
313 .IR XParseColor (3X11).
314 Default: #FFFFCC.
315 These colors look good on a DEC workstation.
316 If you need different colors, try using the
317 .IR xcolors
318 application.  Source for
319 .IR xcolors
320 can be found in the X11/R4 contrib directory.
321 .TP 8
322 .B -bpc or -whitePieceColor color
323 Same for white pieces.
324 Default: #202020.
325 .TP 8
326 .B -lsc or -lightSquareColor color
327 Same for light squares.
328 Default: #C8C365.
329 .TP 8
330 .B -dsc or -darkSquareColor color
331 Same for dark squares.
332 Default: #77A26D.
333 .TP 8
334 .B -wps or -westernPieceSet (True | False)
335 Choose the Western style piece set.
336 .TP 8
337 .B -npb or -normalPawnBitmap file
338 .PD 0
339 .TP 8
340 .B -nnb or -normalKnightBitmap file
341 .TP 8
342 .B -nbb or -normalBishopBitmap file
343 .TP 8
344 .B -nrb or -normalRookBitmap file
345 .TP 8
346 .B -nkb or -normalKingBitmap file
347 Names of the bitmap files for the bitmap piece icons.
348 .PD
349
350 .PD 0
351 .TP 8
352 .B -rpb or -reversePawnBitmap file
353 .TP 8
354 .B -rnb or -reverseKnightBitmap file
355 .TP 8
356 .B -rbb or -reverseBishopBitmap file
357 .TP 8
358 .B -rrb or -reverseRookBitmap file
359 .TP 8
360 .B -rkb or -reverseKingBitmap file
361 Names of the bitmap files for the outline piece icons.
362 .PD
363 .TP 8
364 .B -debug or -debugMode "(True | False)"
365 Turns on debugging printout.
366 .SH RESOURCES
367 .TP 8
368 .B initString
369 The actual string that is sent to initialize the shogi program can be
370 set from .Xdefaults.  It can't be set from the command line because of
371 syntax problems.  The default value is "new\\nbeep\\nrandom\\neasy\\n".
372 The "new" and "beep" commands are required.  
373 You can remove the "random" command if you
374 like; including it causes gnushogi to randomize its move selection slightly so
375 that it doesn't play the same moves in every game.  
376 Even without "random", gnushogi
377 randomizes its choice of moves from its opening book.
378 You can also remove "easy" if you like; including it toggles easy mode
379 .IR off ,
380 causing gnushogi to think on your time.
381 That is, if "easy" is included in the initString, gnushogi thinks
382 on your time; if not, it does not.  (Yes, this does seem backwards, doesn't
383 it.)
384 You can also try adding other commands to the initString; see the gnushogi
385 documentation for details.
386 .TP 8
387 .B blackString and whiteString
388 These resources control what is sent when the Machine Black and Machine White
389 buttons are selected.  This is mostly for compatibility with obsolete versions
390 of gnushogi.
391 .LP
392 Alternate bitmaps for piece icons can be specified
393 either by choosing one of the built-in sets or with
394 the file name resources described above.
395 There are three built-in sets of piece bitmaps available,
396 large (the default), medium, or small.
397 It is easiest to select the set you prefer in the .Xdefaults file:
398 .sp 1
399 .br
400 XShogi*boardSize:   Medium
401 .LP
402 The font used for button labels and comments can be changed in 
403 the .Xdefaults file.  You may want to choose a smaller
404 font if you are using the small pieces:
405 .sp 1
406 .br
407 XShogi*font:    helvetica_oblique12
408 .LP
409 The font used for coordinates (when the
410 .IR showCoords
411 option is True) can be set similarly:
412 .sp 1
413 .br
414 XShogi*coordFont:    helvetica_10
415 .LP
416 If you are using a grayscale monitor, try setting the colors to:
417 .sp 1
418 .br
419 XShogi*blackPieceColor:     gray100
420 .br
421 XShogi*whitePieceColor:     gray0
422 .br
423 XShogi*lightSquareColor:    gray60
424 .br
425 XShogi*darkSquareColor:     gray40
426 .SH COMMAND BUTTONS AND KEYS
427 .TP 8
428 .B Quit
429 Quits
430 .IR xshogi .
431 Q or q is a keyboard equivalent.
432 .TP 8
433 .B Reset
434 Resets
435 .IR xshogi
436 to the beginning of a shogi game.
437 It also deselects any game or position files.
438 .TP 8
439 .B Flip View
440 inverts the view of the shogi board.
441 .TP 8
442 .B Hint
443 displays a move hint from gnushogi.
444 .TP 8
445 .B Load Game
446 plays a game from a record file.
447 If no file is specified a popup dialog asks for a filename.
448 Game files are found in the directory named by the SHOGIDIR environment
449 variable.  If this variable is not declared then the current directory is used
450 unless the file name starts with a /.
451 G or g is a keyboard equivalent.
452 The game file parser will accept almost any file that contains 
453 moves in algebraic notation.
454 If the first line begins with `#', it
455 is assumed to be a title and is displayed.
456 Text enclosed in parentheses or square brackets is assumed to be
457 commentary and is displayed in a pop-up window.
458 Any other text in the file is ignored.
459 .TP 8
460 .B Load Position
461 sets up a position from a position file.
462 If no file is specified a popup dialog asks for a filename.
463 Position files are found in the directory named by the SHOGIDIR environment
464 variable.  If this variable is not declared then the current directory is used
465 unless the file name starts with a /.
466 Position files must be in the format that the Save Position command
467 writes.
468 .TP 8
469 .B Save Game
470 saves a game to a record file.
471 If no file is specified a popup dialog asks for a filename.
472 If the filename exists, the user is asked whether the current game record 
473 is be appended to this file or if the file should be replaced.
474 Game files are saved in the directory named by the SHOGIDIR environment
475 variable.  If this variable is not declared then the current directory is used
476 unless the file name starts with a /.
477 Game files are human-readable, and can also be read back by
478 the Load Game command. Furthermore, they are accepted as gnushogi text bookfiles.
479 .TP 8
480 .B Save Position
481 saves a position to a position file.
482 If no file is specified a popup dialog asks for a filename.
483 Position files are saved in the directory named by the SHOGIDIR environment
484 variable.  If this variable is not declared then the current directory is used
485 unless the file name starts with a /.
486 Position files are human-readable, and can also be read back by
487 the Load Position command.
488 .TP 8
489 .B Machine White
490 forces gnushogi to play white.
491 .TP 8
492 .B Machine Black
493 forces gnushogi to play black.
494 .TP 8
495 .B Force Moves
496 forces a series of moves.  That is, gnushogi stops playing
497 and xshogi allows you to make moves for both white and black.
498 .TP 8
499 .B Two Machines
500 plays a game between two computer programs.
501 .TP 8
502 .B Forward
503 moves forward through a series of remembered moves.
504 F or f is a keyboard equivalent.
505 .TP 8
506 .B Backward
507 moves backward through a series of remembered moves.
508 As a side effect, puts xshogi into Force Moves mode.
509 B or b is a keyboard equivalent.
510 .TP 8
511 .B Pause
512 pauses the clocks or (in Load Game mode) pauses the game being loaded.
513 Press Pause again to continue.
514 P or p is a keyboard equivalent.
515 .TP 8
516 .B Edit Position
517 lets you set up an arbitrary board position.
518 Use mouse button 1 to drag pieces to new squares, or to
519 delete a piece by dragging it off the board or dragging an empty square
520 on top of it.  To drop a new piece on a square, press mouse button 2 or 3
521 over the square.  This brings up a menu of black pieces (button 2) or white
522 pieces (button 3).  Additional menu choices let you empty the square or
523 clear the board.  You can set the side to play next
524 by clicking on the Black or White indicator at the top of the screen.
525 .TP 8
526 .B Challenge
527 allows to make a two display game between two human players.
528 Enter the display you want to connect to. If you are allowed to
529 connect, a new board is displayed at the remote display.
530 Challenge mode can only be stopped by pressing "quit".
531 .TP 8
532 .B Select Level
533 allows to reset the clocks for both players.
534 Enter the number of moves and the number of minutes in which the
535 moves should be done.
536 .TP 8
537 .B Move NOW
538 force computer to stop thinking and to make the current best move.
539 .TP 8
540 .B Iconify
541 I, i, C or c iconifies
542 .IR xshogi .
543 .SH SEE ALSO
544 .IR gnushogi (6)
545 .SH LIMITATIONS
546 If you press the Pause button during gnushogi's turn,
547 .IR xshogi
548 will stop the clocks,
549 but gnushogi will still make a move.
550 .LP
551 After a mate or draw when playing against gnushogi, if you back up with
552 the Backward button, the clocks are reset (because 
553 gnushogi has exited and must
554 be restarted).
555 .LP
556 Some
557 .IR xshogi
558 functions may not work with versions of gnushogi earlier 
559 than 1.1, patchlevel 02. 
560 .LP
561 The game parser recognizes only algebraic notation.
562 .SH AUTHORS
563 Original authors of XBoard:  Chris Sears and Dan Sears.
564 .LP
565 Enhancements for XBoard (Version 2.0):  Tim Mann.
566 .LP
567 Conversion to XShogi (Version 1.1):  Matthias Mutz.
568 .SH COPYRIGHT
569 XShogi borrows its piece bitmaps from CRANES Shogi.
570 .LP
571 Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
572 Enhancements Copyright 1992 Free Software Foundation, Inc.
573 Enhancements Copyright 1993 Matthias Mutz
574 .LP
575 The following terms apply to Digital Equipment Corporation's copyright
576 interest in XBoard:
577 .LP
578 .RS
579 All Rights Reserved
580 .LP
581 Permission to use, copy, modify, and distribute this software and its
582 documentation for any purpose and without fee is hereby granted,
583 provided that the above copyright notice appear in all copies and that
584 both that copyright notice and this permission notice appear in
585 supporting documentation, and that the name of Digital not be
586 used in advertising or publicity pertaining to distribution of the
587 software without specific, written prior permission.
588 .LP
589 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
590 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
591 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
592 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
593 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
594 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
595 SOFTWARE.
596 .RE
597 .LP
598 The following terms apply to the enhanced version of XShogi distributed
599 by the Free Software Foundation:
600 .LP
601 .RS
602 This file is part of XSHOGI.
603 .LP
604 XSHOGI is distributed in the hope that it will be useful, but WITHOUT ANY
605 WARRANTY.  No author or distributor accepts responsibility to anyone for
606 the consequences of using it or for whether it serves any particular
607 purpose or works at all, unless he says so in writing.  Refer to the XSHOGI
608 General Public License for full details.
609 .LP
610 Everyone is granted permission to copy, modify and redistribute XSHOGI, but
611 only under the conditions described in the XSHOGI General Public License. A
612 copy of this license is supposed to have been given to you along with
613 XSHOGI so you can know your rights and responsibilities.  It should be in a
614 file named COPYING.  Among other things, the copyright notice and this
615 notice must be preserved on all copies.
616 .RE