717a0e0235c6ecbd54a3d3f364005cf275af6755
[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 or
163 .IR \&.Xresources
164 file.
165 .TP 8
166 .B standard Xt options
167 .IR xshogi
168 accepts standard Xt options like -display, -geometry, -iconic, -bg etc.
169 .TP 8
170 .B -tc or -timeControl minutes[:seconds]
171 Amount of time for a set of moves determined by
172 .IR movesPerSession .
173 If this number of moves is played within the time control period,
174 .IR xshogi
175 resets the time clocks.
176 Default: 5 minutes.
177 .TP 8
178 .B -mps or -movesPerSession moves
179 Number of moves in a time control period.
180 Default: 40 moves.
181 .TP 8
182 .B -st or -searchTime minutes[:seconds]
183 Tell gnushogi to spend at most the given amount of time searching
184 for each of its moves.  Without this option, gnushogi chooses
185 its search time based on the number of moves and amount of time
186 remaining until the next time control.
187 Setting this option also sets -clockMode to False.
188 .TP 8
189 .B -sd or -searchDepth number
190 Tell gnushogi to look ahead at most the given number of moves when searching
191 for a move to make.  Without this option, gnushogi chooses
192 its search depth based on the number of moves and amount of time
193 remaining until the next time control.
194 Setting this option also sets -clockMode to False.
195 .TP 8
196 .B -clock or -clockMode "(True | False)"
197 Determines whether or not to use the clock.
198 If clockMode is False, the clock does not run, but the
199 side that is to play next is still highlighted.
200 .TP 8
201 .B -td or -timeDelay seconds
202 Time delay between moves during "Load Game".
203 This doesn't have to be round numbers.
204 Try -td 0.4.  Default: 1 second.
205 .TP 8
206 .B -nsp or -noShogiProgram "(True | False)"
207 If this option is True,
208 .IR xshogi
209 acts as a passive shogiboard; it does not
210 try to start a shogi program, not even to check whether
211 moves made in Force mode are legal.
212 It also sets -clockMode to False.
213 Default: False.
214 .TP 8
215 .B -fsp or -firstShogiProgram program
216 Name of first shogi program.
217 In matches between two machines, this program plays white.
218 Default: "gnushogi".
219 .TP 8
220 .B -ssp or -secondShogiProgram program
221 Name of second shogi program, if needed.
222 In matches between two machines, this program plays black; otherwise
223 it is not started.
224 Default: "gnushogi".
225 .TP 8
226 .B -fh or -firstHost host
227 Name of host the first shogi program plays on.
228 Default: "localhost".
229 .TP 8
230 .B -sh or -secondHost host
231 Name of host the second shogi program plays on.
232 Default: "localhost".
233 .TP 8
234 .B -rsh or -remoteShell shell_name
235 Some systems do not use rsh as the remote shell.
236 This option allows a user to name the remote shell command.
237 This should be done in the resource file.
238 .TP 8
239 .B -mm or -matchMode "(False | Init | Position | Opening)"
240 Automatically run a game between
241 .IR firstShogiProgram
242 and
243 .IR secondShogiProgram .
244 If
245 .IR matchMode
246 is set to
247 .IR Init ,
248 .IR xshogi
249 will start the game with the initial shogi position.
250 If
251 .IR matchMode
252 is set to
253 .IR Position ,
254 .IR xshogi
255 will start the game with the position specified by the
256 .IR loadPositionFile
257 resource.
258 If
259 .IR matchMode
260 is set to
261 .IR Opening ,
262 .IR xshogi
263 will play out the opening moves specified by the
264 .IR -loadGameFile
265 resource.
266 If the
267 .IR -saveGameFile 
268 resource is set, a move record for the match will
269 be saved in the specified file.
270 Default: "False".
271 .TP 8
272 .B -lgf or -loadGameFile file
273 Name of file to read a game record from.
274 Game files are found in the directory named by the SHOGIDIR environment
275 variable.  If this variable is not set, the current directory is used
276 unless the file name starts with a /.
277 .TP 8
278 .B -lpf or -loadPositionFile file
279 Name of file to read a game position from.
280 Position files are found in the directory named by the SHOGIDIR environment
281 variable.  If this variable is not set, the current directory is used
282 unless the file name starts with a /.
283 .TP 8
284 .B -sgf or -saveGameFile file
285 Name of file to save a game record to.
286 Game files are saved in the directory named by the SHOGIDIR environment
287 variable.  If this variable is not set, the current directory is used
288 unless the file name starts with a /.
289 .TP 8
290 .B -spf or -savePositionFile file
291 Name of file to save a game position to.
292 Position files are saved in the directory named by the SHOGIDIR environment
293 variable.  If this variable is not set, the current directory is used
294 unless the file name starts with a /.
295 .TP 8
296 .B -coords or -showCoords "(True | False)"
297 If this option is True,
298 .IR xshogi
299 displays algebraic coordinates along the board's left and bottom edges.
300 The default is False.  The
301 .IR coordFont
302 resource specifies what font to use.  
303 .TP 8
304 .B -mono or -monoMode "(True | False)"
305 Monochrome mode.  You shouldn't have to specify monochrome.
306 .IR xshogi
307 will determine if this is necessary.
308 .TP 8
309 .B -pc or -pieceColor color
310 Color specification for pieces suitable for
311 .IR XParseColor().
312 Default: #FFFFD7.
313 .TP 8
314 .B -sc or -squareColor color
315 Same for squares.
316 Default: #EBDFB0.
317 .TP 8
318 .B -wps or -westernPieceSet (True | False)
319 Choose the Western style piece set.
320 .TP 8
321 .B -npb or -normalPawnBitmap file
322 .PD 0
323 .TP 8
324 .B -nnb or -normalKnightBitmap file
325 .TP 8
326 .B -nbb or -normalBishopBitmap file
327 .TP 8
328 .B -nrb or -normalRookBitmap file
329 .TP 8
330 .B -nkb or -normalKingBitmap file
331 Names of the bitmap files for the bitmap piece icons.
332 .PD
333
334 .PD 0
335 .TP 8
336 .B -rpb or -reversePawnBitmap file
337 .TP 8
338 .B -rnb or -reverseKnightBitmap file
339 .TP 8
340 .B -rbb or -reverseBishopBitmap file
341 .TP 8
342 .B -rrb or -reverseRookBitmap file
343 .TP 8
344 .B -rkb or -reverseKingBitmap file
345 Names of the bitmap files for the outline piece icons.
346 .PD
347 .TP 8
348 .B -debug or -debugMode "(True | False)"
349 Turns on debugging printout.
350 .SH RESOURCES
351 .TP 8
352 .B initString
353 The actual string that is sent to initialize the shogi program can be
354 set from .Xdefaults.  It can't be set from the command line because of
355 syntax problems.  The default value is "new\\nbeep\\nrandom\\neasy\\n".
356 The "new" and "beep" commands are required.  
357 You can remove the "random" command if you
358 like; including it causes gnushogi to randomize its move selection slightly so
359 that it doesn't play the same moves in every game.  
360 Even without "random", gnushogi
361 randomizes its choice of moves from its opening book.
362 You can also remove "easy" if you like; including it toggles easy mode
363 .IR off ,
364 causing gnushogi to think on your time.
365 That is, if "easy" is included in the initString, gnushogi thinks
366 on your time; if not, it does not.  (Yes, this does seem backwards, doesn't
367 it.)
368 You can also try adding other commands to the initString; see the gnushogi
369 documentation for details.
370 .TP 8
371 .B blackString and whiteString
372 These resources control what is sent when the Machine Black and Machine White
373 buttons are selected.  This is mostly for compatibility with obsolete versions
374 of gnushogi.
375 .LP
376 Alternate bitmaps for piece icons can be specified
377 either by choosing one of the built-in sets or with
378 the file name resources described above.
379 There are three built-in sets of piece bitmaps available,
380 large (the default), medium, or small.
381 It is easiest to select the set you prefer in the .Xdefaults file:
382 .sp 1
383 .br
384 XShogi*boardSize:   Medium
385 .LP
386 The font used for button labels and comments can be changed in 
387 the .Xdefaults file.  You may want to choose a smaller
388 font if you are using the small pieces:
389 .sp 1
390 .br
391 XShogi*font:    helvetica_oblique12
392 .LP
393 The font used for coordinates (when the
394 .IR showCoords
395 option is True) can be set similarly:
396 .sp 1
397 .br
398 XShogi*coordFont:    helvetica_10
399 .LP
400 If you are using a grayscale monitor, try setting the colors to:
401 .sp 1
402 .br
403 XShogi*pieceColor:     gray100
404 .br
405 XShogi*squareColor:    gray60
406 .br
407 .SH COMMAND BUTTONS AND KEYS
408 .TP 8
409 .B Quit
410 Quits
411 .IR xshogi .
412 Q or q is a keyboard equivalent.
413 .TP 8
414 .B Reset
415 Resets
416 .IR xshogi
417 to the beginning of a shogi game.
418 It also deselects any game or position files.
419 .TP 8
420 .B Flip View
421 inverts the view of the shogi board.
422 .TP 8
423 .B Hint
424 displays a move hint from gnushogi.
425 .TP 8
426 .B Load Game
427 plays a game from a record file.
428 If no file is specified a popup dialog asks for a filename.
429 Game files are found in the directory named by the SHOGIDIR environment
430 variable.  If this variable is not declared then the current directory is used
431 unless the file name starts with a /.
432 G or g is a keyboard equivalent.
433 The game file parser will accept almost any file that contains 
434 moves in algebraic notation.
435 If the first line begins with `#', it
436 is assumed to be a title and is displayed.
437 Text enclosed in parentheses or square brackets is assumed to be
438 commentary and is displayed in a pop-up window.
439 Any other text in the file is ignored.
440 .TP 8
441 .B Load Position
442 sets up a position from a position file.
443 If no file is specified a popup dialog asks for a filename.
444 Position files are found in the directory named by the SHOGIDIR environment
445 variable.  If this variable is not declared then the current directory is used
446 unless the file name starts with a /.
447 Position files must be in the format that the Save Position command
448 writes.
449 .TP 8
450 .B Save Game
451 saves a game to a record file.
452 If no file is specified a popup dialog asks for a filename.
453 If the filename exists, the user is asked whether the current game record 
454 is be appended to this file or if the file should be replaced.
455 Game files are saved in the directory named by the SHOGIDIR environment
456 variable.  If this variable is not declared then the current directory is used
457 unless the file name starts with a /.
458 Game files are human-readable, and can also be read back by
459 the Load Game command. Furthermore, they are accepted as gnushogi text bookfiles.
460 .TP 8
461 .B Save Position
462 saves a position to a position file.
463 If no file is specified a popup dialog asks for a filename.
464 Position files are saved in the directory named by the SHOGIDIR environment
465 variable.  If this variable is not declared then the current directory is used
466 unless the file name starts with a /.
467 Position files are human-readable, and can also be read back by
468 the Load Position command.
469 .TP 8
470 .B Machine White
471 forces gnushogi to play white.
472 .TP 8
473 .B Machine Black
474 forces gnushogi to play black.
475 .TP 8
476 .B Force Moves
477 forces a series of moves.  That is, gnushogi stops playing
478 and xshogi allows you to make moves for both white and black.
479 .TP 8
480 .B Two Machines
481 plays a game between two computer programs.
482 .TP 8
483 .B Forward
484 moves forward through a series of remembered moves.
485 F or f is a keyboard equivalent.
486 .TP 8
487 .B Backward
488 moves backward through a series of remembered moves.
489 As a side effect, puts xshogi into Force Moves mode.
490 B or b is a keyboard equivalent.
491 .TP 8
492 .B Pause
493 pauses the clocks or (in Load Game mode) pauses the game being loaded.
494 Press Pause again to continue.
495 P or p is a keyboard equivalent.
496 .TP 8
497 .B Edit Position
498 lets you set up an arbitrary board position.
499 Use mouse button 1 to drag pieces to new squares, or to
500 delete a piece by dragging it off the board or dragging an empty square
501 on top of it.  To drop a new piece on a square, press mouse button 2 or 3
502 over the square.  This brings up a menu of black pieces (button 2) or white
503 pieces (button 3).  Additional menu choices let you empty the square or
504 clear the board.  You can set the side to play next
505 by clicking on the Black or White indicator at the top of the screen.
506 .TP 8
507 .B Challenge
508 allows you to make a two display game between two human players.
509 Enter the display you want to connect to. If you are allowed to
510 connect, a new board is displayed at the remote display.
511 Challenge mode can only be stopped by pressing "quit".
512 .TP 8
513 .B Select Level
514 allows you to reset the clocks for both players.
515 Enter the number of moves and the number of minutes in which the
516 moves should be done.
517 .TP 8
518 .B Move NOW
519 force computer to stop thinking and to make the current best move.
520 .TP 8
521 .B Iconify
522 I, i, C or c iconifies
523 .IR xshogi .
524 .SH SEE ALSO
525 .IR gnushogi (6)
526 .SH LIMITATIONS
527 If you press the Pause button during gnushogi's turn,
528 .IR xshogi
529 will stop the clocks,
530 but gnushogi will still make a move.
531 .LP
532 After a mate or draw when playing against gnushogi, if you back up with
533 the Backward button, the clocks are reset (because 
534 gnushogi has exited and must
535 be restarted).
536 .LP
537 Some
538 .IR xshogi
539 functions may not work with versions of gnushogi earlier 
540 than 1.1, patchlevel 02. 
541 .LP
542 The game parser recognizes only algebraic notation.
543 .SH AUTHORS
544 Original authors of XBoard:  Chris Sears and Dan Sears.
545 .LP
546 Enhancements for XBoard (Version 2.0):  Tim Mann.
547 .LP
548 Conversion to XShogi (Version 1.1):  Matthias Mutz.
549 .LP
550 Current maintainer: Mike Vanier.
551 .SH COPYRIGHT
552 XShogi borrows some of its piece bitmaps from CRANES Shogi.
553 .LP
554 Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
555 Enhancements Copyright 1992 Free Software Foundation, Inc.
556 Enhancements Copyright 1993 Matthias Mutz
557 .LP
558 The following terms apply to Digital Equipment Corporation's copyright
559 interest in XBoard:
560 .LP
561 .RS
562 All Rights Reserved
563 .LP
564 Permission to use, copy, modify, and distribute this software and its
565 documentation for any purpose and without fee is hereby granted,
566 provided that the above copyright notice appear in all copies and that
567 both that copyright notice and this permission notice appear in
568 supporting documentation, and that the name of Digital not be
569 used in advertising or publicity pertaining to distribution of the
570 software without specific, written prior permission.
571 .LP
572 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
573 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
574 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
575 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
576 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
577 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
578 SOFTWARE.
579 .RE
580 .LP
581 The following terms apply to the enhanced version of XShogi distributed
582 by the Free Software Foundation:
583 .LP
584 .RS
585 This file is part of XSHOGI.
586 .LP
587 XSHOGI is distributed in the hope that it will be useful, but WITHOUT ANY
588 WARRANTY.  No author or distributor accepts responsibility to anyone for
589 the consequences of using it or for whether it serves any particular
590 purpose or works at all, unless he says so in writing.  Refer to the XSHOGI
591 General Public License for full details.
592 .LP
593 Everyone is granted permission to copy, modify and redistribute XSHOGI, but
594 only under the conditions described in the XSHOGI General Public License. A
595 copy of this license is supposed to have been given to you along with
596 XSHOGI so you can know your rights and responsibilities.  It should be in a
597 file named COPYING.  Among other things, the copyright notice and this
598 notice must be preserved on all copies.
599 .RE