1 \input texinfo @c -*-texinfo-*-
3 @c % ** Start of header.
4 @setfilename gnushogi.info
5 @settitle GNU Shogi manual
10 * gnushogi: (gnushogi). Japanese chess
13 @setchapternewpage odd
15 @c ==================================
16 @c TeX-specific macros
17 @c ==================================
21 @c ==================================
22 @c info-specific macros
23 @c ==================================
27 @c ==================================
28 @c Summary description and copyright.
29 @c ==================================
33 This file describes how to use GNU shogi,
34 a program which plays Shogi (Japanese chess).
36 Copyright (C) 1999 Michael C. Vanier and the Free Software Foundation, Inc.
38 Permission is granted to make and distribute verbatim copies of
39 this manual provided the copyright notice and this permission notice
40 are preserved on all copies.
43 Permission is granted to process this file through TeX and print the
44 results, provided the printed document carries copying permission
45 notice identical to this one except for the removal of this paragraph
46 (this paragraph not being relevant to the printed manual).
49 Permission is granted to copy and distribute modified versions of this
50 manual under the conditions for verbatim copying, provided that the entire
51 resulting derived work is distributed under the terms of a permission
52 notice identical to this one.
54 Permission is granted to copy and distribute translations of this manual
55 into another language, under the above conditions for modified versions,
56 except that this permission notice may be stated in a translation approved
57 by the Free Software Foundation.
61 @c =========================================
62 @c End of summary description and copyright.
63 @c =========================================
66 @c ====================
67 @c Title and copyright.
68 @c ====================
72 @comment The title is printed in a large font.
73 @center @titlefont{GNU Shogi (Japanese chess)}
76 @c The following two commands start the copyright page.
78 @vskip 0pt plus 1filll
79 Copyright @copyright{} 1999 Michael C. Vanier and the Free Software Foundation
83 @c ===========================
84 @c End of title and copyright.
85 @c ===========================
88 @c =========================
89 @c Top node and master menu.
90 @c =========================
92 @node Top, (dir), (dir), (dir)
93 @top GNU Shogi (Japanese chess)
97 * Introduction:: What is GNU shogi?
98 * About shogi:: General information, rules, etc.
99 * gnushogi:: How to play GNU shogi (gnushogi).
100 * xshogi:: The X interface to GNU shogi.
101 * References and links:: Where to go for more information.
103 * Bugs:: Where and how to report bugs.
109 This document describes GNU shogi, a program which plays Japanese chess
110 (shogi) against a human opponent.
113 @c ================================
114 @c End of top node and master menu.
115 @c ================================
122 @node Introduction, About shogi, Top, Top
123 @chapter Introduction
126 GNU shogi is a program that plays shogi, the Japanese version of chess,
127 against a human (or computer) opponent. This file describes how to use
128 GNU shogi and also gives background information about the game of shogi.
130 This file describes GNU shogi version 1.3.2. It was written by me, Mike
131 Vanier, the current maintainer of GNU shogi. My email address is
132 @email{mvanier@@cs.caltech.edu}.
135 GNU Shogi is actually two programs:
140 is the text-based program which also contains the game-playing engine.
143 is the X-windows graphical interface to gnushogi.
147 Since xshogi invokes gnushogi, most players will just type ``xshogi''
150 Disclaimer: I use the personal pronouns ``him'', ``his'' etc. to refer
151 to a shogi player regardless of gender. That's easier than writing
152 ``his or her'' all over the place. I don't mean to infer that women
153 don't play shogi; in fact shogi is very popular in Japan among women as
157 @node About shogi, gnushogi, Introduction, Top
158 @chapter About the game of shogi
162 ``Japanese chess cedes nothing in depth or beauty to the European
163 game... it is at least as interesting.''
165 --- Alexander Alekhine @*
166 (quoted in David Pritchard, @cite{The Encyclopedia of Chess Variants})
168 ``... shogi [is] by far the most complex form of chess that has ever
169 achieved widespread popularity.''
171 --- R. Wayne Schmittberger, @cite{New Rules for Classic Games}
174 Shogi is the version of chess played in Japan. It is strikingly
175 different from standard chess (which I shall refer to henceforth as
176 ``international chess'') and also to all other regional variants,
177 because captured pieces can re-enter play on the side of the capturer.
178 This has several interesting effects on the play of the game:
182 Shogi is much more complex than international chess, at least in
183 terms of the average number of possible moves per turn (estimated at
184 about 35 for chess and at about 80 for shogi).
187 There are almost no draws (about 1-2% of all games in professional play).
190 Exchanges complicate the play rather than simplifying it.
193 There are no ``endgames'' in the standard chess sense; all pieces remain
194 in play throughout the game. Games typically end in a race to
195 checkmate the other player before being checkmated oneself.
198 Ownership of a piece is not indicated by the color of the piece;
199 instead, pieces are wedge-shaped and point towards the opponent. The
200 name of the piece is inscribed in Kanji characters on the front of the
204 Most importantly: it's more fun than other forms of chess :-)
208 Shogi is extremely popular in Japan; it has been estimated that 20
209 million Japanese can play shogi, of which perhaps 1 million are active
210 players. It is even more popular there than the game of go, Japan's
211 other favorite board game. There are a number of professional players
212 who make a considerable amount of money playing in shogi tournaments,
213 and the game receives extensive newpaper and television coverage.
214 Despite this, the game has yet to become popular outside of Japan. Part
215 of this is because the Kanji characters on the pieces scare away some
216 people, but mostly it's due, I think, to lack of exposure to the game
217 and to the difficulty of finding opponents. I hope that GNU shogi will
218 help introduce shogi to a wider audience.
222 * The rules of shogi::
226 * Differences between shogi and chess::
231 @c -------------------------------------------------------
233 @c The rules of shogi.
235 @c -------------------------------------------------------
237 @node The rules of shogi, Sample game, About shogi, About shogi
238 @section The rules of shogi
241 Shogi is a two-person abstract strategy board game with full information
242 (i.e. all pieces and moves are visible to both players at all times).
243 It is in the chess family, being descended from the same ancestral game
244 as international chess: the Indian game of Chaturanga. The two players
245 are referred to as ``Black'' and ``White'', with Black moving first
246 (unlike in international chess, where White moves first), and with
247 movement alternating between the two players. Note that ``Black'' and
248 ``White'' are just names; the pieces are not colored. Instead, they are
249 flat, wedge-shaped pieces which point towards the opponent. The
250 identity of a given piece is indicated by two Japanese Kanji characters
251 on each piece. In fact, only the top character is needed to identify
252 the piece and thus only the top character is used in shogi diagrams. I
253 will use alphabetical equivalents in the diagrams here; to see what the
254 Kanji characters look like, start up xshogi (@pxref{xshogi}) and compare
255 the starting setup there with the starting setup in this file
256 (@pxref{The opening setup}).
258 The object of the game is to capture the opponent's King. The board is
259 a grid of 9x9 uncolored squares, and pieces are placed on the squares.
260 Each player begins with 20 pieces, described in the next section.
261 Capture is by displacement, as in international chess.
265 * The moves of the pieces::
266 * The opening setup::
267 * Promotion of pieces::
272 * Notes for chess players::
276 @c The moves of the pieces.
278 @node The moves of the pieces, The opening setup, The rules of shogi, The rules of shogi
279 @subsection The moves of the pieces
282 Each player at the beginning of a shogi game has a total of 20 pieces of
283 eight different types. The moves of the shogi pieces can be divided
284 into three classes: ``stepping'' pieces, that only move one square at a
285 time; ``ranging'' pieces that move any number of unobstructed squares in
286 a line, and ``jumping'' pieces that can jump over obstructing pieces to
287 reach their destination squares. Most pieces can also promote to
288 different (usually stronger) pieces under certain circumstances (see the
289 next section). All pieces capture the same way that they move (even
290 pawns). The piece moves and promotions are as follows; each piece name
291 is followed by the standard piece abbreviation:
296 The king (K). The king can move one square in any horizontal, vertical,
297 or diagonal direction, just like the king in international chess. The
298 king does not promote.
301 The rook (R). The rook can move any number of squares in a horizontal
302 or vertical direction. The rook is the same as the rook in
303 international chess (except that it can promote). A rook promotes to a
304 ``dragon king'' or ``dragon'' for short (often just referred to as a
305 ``promoted rook''), which can move as a rook or can move one square in
306 any diagonal direction.
309 The bishop (B). The bishop can move any number of squares in a diagonal
310 direction. The bishop is the same as the bishop in international chess
311 (except that it can promote). A bishop promotes to a ``dragon horse''
312 or ``horse'' for short (often just referred to as a ``promoted
313 bishop''), which can move as a bishop or can move one square in any
314 horizontal or vertical direction. Note: the horse should not be
315 confused with a knight (see below), as they are two completely different
319 The gold general (G). A gold general can move one square in any
320 horizontal or vertical direction, or one square in a forward diagonal
321 direction. Gold generals do not promote.
324 The silver general (S). A silver general can move one square in any
325 diagonal direction, or one square straight forward. A silver general
326 promotes to a gold general.
329 The knight (N). A knight can move one square straight forward followed
330 by one square to either forward diagonal, jumping over intervening
331 pieces if any. In other words, a knight moves like its international
332 chess counterpart, but forward only. A knight promotes to a gold
333 general. The knight is the only jumping piece, as in chess.
336 The lance (L). A lance can move any number of squares straight forward.
337 A lance promotes to a gold general.
340 The pawn (P). A pawn can move one square straight forward. The pawn
341 captures the same way that it moves, in contrast to international chess.
342 There is also no initial two-space move for pawns and no
343 @emph{en-passant} capture. A pawn promotes to a gold general; a
344 promoted pawn is usually known as a ``Tokin''.
349 @c The opening setup.
351 @node The opening setup, Promotion of pieces, The moves of the pieces, The rules of shogi
352 @subsection The opening setup
353 @cindex Opening setup
355 The opening setup for shogi is as follows:
360 +--------------------------------------------+
361 | wL | wN | wS | wG | wK | wG | wS | wN | wL | a
362 +--------------------------------------------+
363 | | wR | | | | | | wB | | b
364 +--------------------------------------------+
365 | wP | wP | wP | wP | wP | wP | wP | wP | wP | c
366 +--------------------------------------------+
367 | | | | | | | | | | d
368 +--------------------------------------------+
369 | | | | | | | | | | e
370 +--------------------------------------------+
371 | | | | | | | | | | f
372 +--------------------------------------------+
373 | bP | bP | bP | bP | bP | bP | bP | bP | bP | g
374 +--------------------------------------------+
375 | | bB | | | | | | bR | | h
376 +--------------------------------------------+
377 | bL | bN | bS | bG | bK | bG | bS | bN | bL | i
378 +--------------------------------------------+
382 @c The following TeX macros are taken with permission from
383 @c "TeX for the Beginner" by Wynter Snow.
386 \def\startline{\par\nobreak\noindent}
388 {\obeylines\obeyspaces%
389 \gdef\beginVerbatim{\bigbreak%
392 \obeylines\obeyspaces%
395 \gdef\endVerbatim{\endgroup\bigbreak}
400 +--------------------------------------------+
401 | wL | wN | wS | wG | wK | wG | wS | wN | wL | a
402 +--------------------------------------------+
403 | | wR | | | | | | wB | | b
404 +--------------------------------------------+
405 | wP | wP | wP | wP | wP | wP | wP | wP | wP | c
406 +--------------------------------------------+
407 | | | | | | | | | | d
408 +--------------------------------------------+
409 | | | | | | | | | | e
410 +--------------------------------------------+
411 | | | | | | | | | | f
412 +--------------------------------------------+
413 | bP | bP | bP | bP | bP | bP | bP | bP | bP | g
414 +--------------------------------------------+
415 | | bB | | | | | | bR | | h
416 +--------------------------------------------+
417 | bL | bN | bS | bG | bK | bG | bS | bN | bL | i
418 +--------------------------------------------+
423 Here, ``b'' stands for ``black'' and ``w'' stands for ``white'', so
424 that, for instance, ``bL'' means ``black lance''. The numbers above the
425 files and the letters to the right of the ranks represent the most
426 common notation system used for shogi by westerners (the Japanese also
427 use Arabic numerals for the files but use Japanese numerals for the
431 @c Promotion of pieces.
433 @node Promotion of pieces, Drops, The opening setup, The rules of shogi
434 @subsection Promotion of pieces
435 @cindex Piece promotion
437 In sharp contrast to international chess, where only pawns can promote
438 to higher-ranked pieces, most of the pieces in shogi can promote. The
439 promoted ranks are discussed in the section on piece moves (@pxref{The
440 moves of the pieces}) but are repeated here for reference:
445 promotes to gold general (called a `tokin' in this case only).
448 promotes to gold general.
451 promotes to gold general.
454 promotes to gold general.
460 promotes to ``dragon horse'' or just ``horse'' for short. The horse can
461 move as a bishop or can move one square in any orthogonal direction.
464 promotes to ``dragon king'' or just ``dragon'' for short. The dragon
465 can move as a rook or can move one square in any diagonal direction.
472 The three ranks furthest away from each player constitute his/her
473 ``promotion zone''. A player may, but is not required to, promote a
474 piece after making a move in which the piece begins and/or ends in the
475 promotion zone. Thus you can promote a piece when moving the piece into
476 the promotion zone, out of the promotion zone, or entirely within the
477 promotion zone. Promotion is mandatory in these cases:
481 @item You must promote a pawn or a lance after moving it to the last rank.
483 @item You must promote a knight after moving it to either of the last
488 These forced promotions ensure that a piece cannot be moved to a square
489 from which it would have no further move.
491 Pieces ``dropped'' onto the board (@pxref{Drops}) always drop in the
492 unpromoted state, even if they drop into the promotion zone.
498 @node Drops, Winning the game, Promotion of pieces, The rules of shogi
502 When a player captures a piece, that piece is not removed from play.
503 Instead, it becomes the property of the capturer and can re-enter play
504 by being placed on (almost) any vacant square during the player's move.
505 This is known as a ``drop'' and counts as a full move (in other words,
506 you can either move a piece on the board or drop a piece onto the board
507 during your move, but not both). All pieces drop in the unpromoted
508 state. Pieces may be legally dropped in their promotion zone, but they
509 do not promote on that turn.
511 There are several restrictions on drops:
515 @item A pawn may not be dropped onto a file if there is already an
516 unpromoted pawn belonging to the same player on that file. It is legal
517 to drop a pawn on a file which contains a @emph{promoted} pawn belonging
518 to the same player, however.
520 @item A pawn may not be dropped to give immediate checkmate on the
521 move. A pawn is, however, permitted to be moved on the board to give
522 immediate checkmate. This is a curious rule, and if anyone knows the
523 reason for it I would appreciate it if they would contact me and explain
526 @item A pawn or piece may not be dropped onto a square from which they
527 would have no legal move. This means that pawns and lances may not be
528 dropped onto the last rank, and the knight may not be dropped onto the
529 last or second-to-last rank.
533 It is entirely permissible (and often advisable) to drop a piece or pawn
534 between one's King and an attacking ranging piece. For this reason,
535 the final checkmating move is nearly always an attack on the King from
536 an adjacent square (except for an attack by a Knight).
538 Captured pieces are said to be pieces ``in hand''.
540 The drop is the primary distinguishing feature of Japanese chess, shared
541 with no other popular chess-type game. It gives shogi a very aggressive
542 quality, and dramatically increases the number of possible moves once a
543 few pieces have been captured. Another interesting feature of shogi is
544 that exchanges complicate play rather than simplifying it (as in
545 international chess), because of the drop rule.
550 @node Winning the game, Draws, Drops, The rules of shogi
551 @subsection Winning the game
552 @cindex Winning the game
554 A game of shogi is won by capturing the opponent's king. In general,
555 this is done by checkmating the king: attacking the king in such a way
556 that the king cannot be defended no matter what the defending player
557 moves. Note, though, that there is no rule that requires a player to
558 defend a king which is being attacked. However, if he does not defend
559 his king, the opponent is entirely free to capture it on the next move,
560 thus winning the game. As in international chess, in practice most
561 games end by resignation when one player realizes that he cannot escape
567 @node Draws, Handicaps, Winning the game, The rules of shogi
571 There are very few draws in shogi; only about 1-2% of professional games
572 end in a draw. One reason for this is that material can never be
573 depleted as in chess, because captured pieces are constantly re-entering
574 play as a consequence of the drop rule. In fact, most of the ways a
575 game can be drawn in chess are not allowed in shogi:
579 @item Draws cannot be offered.
581 @item There is no fifty-move rule.
583 @item A stalemate counts as a win for the stalemater. Stated otherwise:
584 if you can't move, you lose.
586 @item Perpetual check is illegal (see below).
590 There are only two legal ways in which a draw can occur:
594 @item A position (including the pieces in hand) occurs 4 times with the same
595 player to move (called ``Sennichite''). However, if this is caused by
596 consecutive checks (direct attacks on the King, threatening to capture
597 it on the next move) by one side, the player giving these checks loses
598 the game. In other words, perpetual check results in a loss for the
599 attacker who recreates the same position the 4th time.
601 @item Both players have moved their King into the the promotion zone (or they
602 cannot be prevented from doing so) and the Kings cannot be checkmated.
603 A King who has entered the promotion zone is known as an ``entering
604 King''; due to the forward orientation of most shogi pieces, it is very
605 hard to mate such a King. In that case the players may decide to count
606 their pieces as follows: the King does not count, the Rook and Bishop
607 count as 5 points, and all other pieces as one point. Promotion is
608 disregarded. If both players have at least 24 points the game is a draw
609 (called ``Jishogi''). If a player has less, he loses the game.
611 Of course, a player can refuse to count pieces when he still has mating
612 chances or chances to gain material which would affect the outcome of
613 the counting. There is no strict rule about what to do if this is not
614 the case, but nonetheless a player refuses to count up (e.g. because he
615 does not have enough points for a draw). It has been generally accepted
616 that in such a case the game ends and the pieces are counted after one
617 player has managed to get all his pieces protected in the promotion
624 @node Handicaps, Notes for chess players, Draws, The rules of shogi
625 @subsection Handicaps
628 Unlike international chess, shogi has a well-established handicap system
629 which is used when players of different strengths play against each
630 other. Handicaps range from small to huge, which makes it possible for
631 weak players to play against even very strong players and have an even
634 Shogi players are ranked as follows: the weakest rank is around 15
635 ``kyu'', which represents a beginner. 14 kyu is higher than 15 kyu, 13
636 kyu is higher still, and so on until you get to 1 kyu. The next highest
637 rank is 1 ``dan'', followed by 2 dan, 3 dan and so forth. The highest
638 amateur rank is 6 dan; professionals go up to 9 dan. However,
639 professional ranks are not the same as amateur ranks; a professional 1
640 dan is @emph{much} stronger than an amateur 1 dan. This system is
641 similar to that used by go players (and also other Japanese sports such
644 A handicap consists of the stronger player playing White and removing
645 one or more pieces from his side of the board at the start of the game.
646 These pieces are permanently removed from play; they are not in hand.
648 The following is a list of the accepted handicaps, from weakest to
649 strongest. The degree of the handicap, represented by the position in
650 the list, represents the difference in rank between the two players for
651 which the handicap is appropriate. These rules are taken from the books
652 ``Shogi for Beginners'' by John Fairbairn and ``The Art of Shogi'' by
653 Tony Hoskings (@pxref{References and links}) and, I believe, represent
654 current Japanese practice.
659 The stronger player removes his left lance (on 1a).
662 The players play a two-game match; in the first game the stronger player
663 removes his left lance (on 1a), while in the second game he removes his
667 The stronger player removes his bishop.
670 The stronger player removes his rook.
673 The stronger player removes his rook and left lance.
676 The players play a two-game match; in the first game the stronger player
677 removes his rook and left lance (on 1a), while in the second game he
678 removes his rook and bishop.
681 The stronger player removes his rook and bishop. This is usually called
682 a ``two-piece'' handicap.
685 The stronger player removes his rook, bishop, and both lances. This is
686 called a ``four-piece'' handicap.
689 The stronger player removes his rook, bishop, both lances, and both
690 knights. This is called a ``six-piece'' handicap.
693 The stronger player removes his rook, bishop, both lances, both knights,
694 and both silvers. This is called an ``eight-piece'' handicap.
698 Another advantage of playing handicap games is that the handicaps alter
699 the optimal strategy for both players. For instance, handicaps all have
700 their own opening lines which may bear little or no resemblance to those
701 used in non-handicap shogi. This means that when learning handicap
702 shogi, you are essentially learning completely new games which use the
705 The reader may wonder how on earth a player giving an eight-piece
706 handicap, say, could possibly hope to win. Don't forget, though, that
707 in shogi the opponent's pieces can be captured and then become part of
708 one's own army. Thus, if the opponent plays badly enough, the number of
709 pieces will soon even out.
712 @c Notes for chess players.
714 @node Notes for chess players, , Handicaps, The rules of shogi
715 @subsection Notes for chess players
717 Here are a few miscellaneous things that may confuse chess players.
718 Some of these have been mentioned elsewhere, but they bear repeating.
721 @item There is no queen.
723 @item Pawns capture the same way they move. There is no initial
724 two-space pawn move and no @emph{en-passant} move.
726 @item There is no special castling move. There @emph{are} a large
727 number of possible defensive formations referred to as ``castles''
728 (@pxref{Sample game}) but there is no need for special moves to create
731 @item A given piece can only promote to @emph{one} other kind of piece.
739 @node Sample game, Mating problems, The rules of shogi, About shogi
743 @c This will have to be spruced up for the TeX version...
745 This game was annotated by Pieter Stouten (@pxref{References and
746 links}). I have made some minor corrections. Note that captures are
747 denoted by the ``x'' symbol e.g. Rx3f and drops are denoted by the ``*''
748 symbol e.g. R*3f. Check is indicated by a ``+'' after the move,
749 e.g. R3f+. I recommend you use gnushogi/xshogi to play along with this
750 game. In xshogi simply hit the ``Force Moves'' button after starting
751 up, while in gnushogi enter the word ``force'' at the prompt. This will
752 allow you to enter moves for both sides.
754 Note also that the move numbering system used here is the chess-type
755 system where one move means one move by each player. The Japanese count
756 one move made by each player as two moves.
758 ---------------------------------------------------------------------------
760 Below you will find (the English translation of) an annotated game which
761 was published in the Dutch Shogi magazine ``81'' and in the Dutch
762 beginners booklet. It has proven to be a very useful game to explain
763 some basic principles of Shogi. Also, it is a rather straightforward
764 game compared to professional games where in most cases very diffuse
765 middle game fights take place.
767 Pieter Stouten, 14th May 1990.
769 ---------------------------------------------------------------------------
771 Black: Michael Trent (1-dan). White: David Murphy (2-dan).
773 1. P2f P3d 2. P2e B3c @*
774 [ This move is necessary, as otherwise white can exchange pawns: 3. P2d
775 Px2d 4. Rx2d. He would thus get a pawn in hand and open up his rook
779 [ White closes the bishop diagonal again. He plans to play ranging rook
780 (the rook goes to 5b, 4b, 3 or 2b; a defensive strategy) and in that
781 case he'd better avoid an exchange of bishops. One of the reasons is
782 that he will have problems developing his pieces without leaving holes
785 4. S4h R3b 5. P3f S4b 6. K6h K6b @*
786 [ In general the rook plays an important role in the attacks. It is
787 wise to move the king away from the area where the initial fights will
788 be and both players act according to the Shogi proverb ``keep the rook
791 7. K7h K7b 8. P5f P5d 9. G4i-5h G4a-5b @*
792 [ Both players use their second gold general to build their castle. ]
795 [ In itself this move is not bad. However, it will become clear that
796 black plans a quick attack and in that case it is wiser to omit this
799 10... S5c 11. P1f P1d @*
800 [ The advance of the edge pawns must be timed very well. The remark at
801 black's tenth move applies here too: this move is good if black wants to
802 play a slow game, because it eliminates a future B1e. ]
804 12. P4f K8b 13. N3g S7b @*
805 [ Black develops his knight in order to start an attack over the second,
806 third and fourth files. White strengthens his king's position and
807 awaits the attack. He aims at a counterattack as soon as black has
808 broken through into the white camp. Probably white's breakthrough will
809 take place later, but he has good compensation in the form of a stronger
810 castle. This theme occurs very often in static rook versus ranging rook
814 [ Black starts his attack and white puts up a very passive defence. His
815 rook has a hard task now to penetrate the black position. Moreover, he
816 blocks his own bishop. It seems much better to start a counterattack
817 with 14... P3e, later to be followed by B2b, B5a or Bx4d in order to use
818 his rook more actively. ]
820 15. Px4d Sx4d 16. P*4e S5c @*
821 [ 16... Sx4e is more active. A silver general is normally more valuable
822 than a knight, but white gets two pawns in hand and black none, while
823 the knight might come in handy for white too. ]
825 17. Bx3c+ Nx3c 18. P2d Px2d @*
826 [ Black threatens to break through and white has to consider taking the
827 pawn on 2d or starting a counterattack with Nx4e. If he chooses the
828 latter, black can play Px2c+ followed by +P3c. The disadvantage is the
829 black ``tokin'' (=promoted pawn) that white will get in his camp; the
830 advantage is that it will cost black two more moves to promote his rook.
831 Because white did not trust that the result after engaging in a
832 ``semeai'' (=mutual attack) with 18...Nx4e would give a positive result,
833 he captured the pawn on 2d. Making the right decision in moments like
834 this often makes the difference between a win and a loss: miss one
835 attacking chance and you will be forced to defend the whole game until
836 the unavoidable defeat; on the other hand, an unsound attack can destroy
837 all ``aji'' (=potential, meaning possibilities, threats) without getting
838 anything in return. ]
840 19. Rx2d Nx4e 20. Nx4e Rx4e 21. R2a+ P*4g @*
841 [ Now it becomes clear why black's 10. S6h was not good. Had this move
842 been omitted, then white would not have had the time to play 13... S7b
843 and after R2a+ the gold on 6a would hang. Thus black would have kept
844 ``sente'' (=initiative). Instead of 21... P*4g, B*6d is a very good
845 move, because after 22. P*2h black does not have a pawn in hand anymore
846 and he is being threatened with the annoying 22... N*4f 23. G5g N3h+
847 24. S4g +N4h also. Black can also counter 21... B*6d with 22. N*3g.
848 White would then reply with 22... R4b 23. B*3c P*4g 24. Bx4b+ Sx4b. The
849 white rook has played its role and instead of spending moves on saving
850 it white starts to scatter black's defences by successive pawn drops on
851 the fourth file: 25. Gx4g P*4f 26. G5g N*6e 27. G5h P4g+ 28. Gx4g P*4f.
852 This analysis was provided by Kato Hifumi, 9-dan professional (the
853 highest regular grade). Destroying the coherence of the enemy pieces
854 (their shape) by dropping pawns is one of the most important Shogi
855 techniques. With the actual move 21... P*4g white missed a good
858 22. Sx4g P*4f 23. B*3g Px4g+ 24. +Rx6a +Px3g @*
859 [ 23. B*3g seems pointless, but a closer look reveals that it is
860 actually quite mean. On move 24 white cannot capture black's ``Ryu''
861 (=dragon =promoted rook) with his silver: 24... Sx6a 25. N*7d K7b
862 26. G*8b mate. By attacking the front of the white castle and
863 threatening to mate him there, black has the chance to break down the
864 white defences from the side. ]
867 [ Here 25... B*4d would be much better, because it is defensive and
868 attacking at the same time. After e.g. 26. G*4c Bx9i+ 27. Gx5c black
869 threatens 28. +Rx7b Kx7b 29. S*6a K8b 30. S*7a Kx7a 31. G*7b mate.
870 White is one move quicker, however. He has the following beautiful
871 ``tsume'' (mating sequence where every move is check): 27... N*8f 28. Px8f
872 S*8g 29. Kx8g B*9h 30. K7h Bx8i+ 31. K8g +B8i-8h 32. K9f L*9e mate.
873 This illustrates the sharpness of Shogi: one move can make the
874 difference between winning and losing. ]
877 [ This move eliminates white's last chances. 26... R4b 27. +Rx4b Sx4b
878 28. R*4a seems annoying, but after 28... B*3c 29. S7g B*3b white wins
879 the rook and with his ``tokin'' on 3g there still is some hope. ]
882 [ White cannot defend anymore, so he starts a desperate attack. Black
883 does not lose the right track, however. ]
885 28. Nx5c+ +Px5h 29. +Nx6b +Px6h 30. Gx6h N*8f 31. Px8f B*6i 32. Gx6i
886 R4h+ 33. N*6h +Rx6h 34. Gx6h S*8g 35. Kx8g N*9e 36. K7h Resigns @*
887 [ White resigns here, because after 36... B*8g 27. K7g his attack has
897 @node Mating problems, Shogi variants, Sample game, About shogi
898 @section Mating problems
900 One good way to improve at shogi is to solve mating problems. There are
901 several types of these problems, but the most common is called a
902 ``tsume-shogi'' problem, or ``tsume'' problem for short. In a tsume
903 problem, all pieces that are not on the board are assumed to be in the
904 opponent's hand (except for your King, which is usually not shown).
905 Every move you make must be check until the final checkmate. Your
906 opponent may play any piece on the board or drop any of his pieces in
907 hand in order to prevent the mate. In a properly constructed tsume
908 problem, all of your pieces on the board and in hand must be essential
909 to the solution. One consequence of this is that all of your pieces in
910 hand must be played during the solution. There should only be one
911 correct solution for the given number of moves. Tsume problems use
912 Japanese-style move numbering; thus, a problem where you move (and give
913 check), your opponent moves, and you move to give checkmate is called a
914 three-mover. Here is a really trivial three-mover:
939 \def\startline{\par\nobreak\noindent}
941 {\obeylines\obeyspaces%
942 \gdef\beginVerbatim{\bigbreak%
945 \obeylines\obeyspaces%
948 \gdef\endVerbatim{\endgroup\bigbreak}
971 Here, Black plays G*2b, White plays K1c, and Black plays G*1d mate.
972 More typical tsume problems range from 5 moves to arbitrarily high
973 numbers of moves, and they can be quite brain-busting. Tsume problems
974 may seem artificial, but in the closing stages of the game where both
975 players have a lot of pieces in hand, it is often necessary to give
976 check at every move, or else your opponent will start a counterattack
977 and will mate you before you mate him. A tsume problem is a worst-case
978 scenario for the attacker: you have to mate your opponent even though he
979 has every piece not on the board in hand, which means you have to
980 develop sharp attacking skills. Many more tsume problems can be found
981 on the internet; I particularly recommend Patrick Davin's ``Shogi
982 Nexus'' (@pxref{References and links}).
990 @node Shogi variants, Differences between shogi and chess, Mating problems, About shogi
991 @section Shogi variants
992 @cindex Shogi variants
998 @cindex Tenjiku Shogi
999 @cindex Dai-dai Shogi
1000 @cindex Maka-dai-dai Shogi
1002 @cindex Kyoku Tai Shogi
1004 Several historical variants of shogi exist. Most of these were invented
1005 before modern shogi (in some cases hundreds of years before), are much
1006 larger than modern shogi and are not played with drops. Thus, in many
1007 ways they are really more like giant chess games than like modern shogi.
1008 The only one of these games to have survived in Japan is Chu (middle)
1009 shogi, which is still played a little bit. Thanks to the efforts of
1010 George Hodges and John Fairbairn of the Shogi Association (two British
1011 shogi enthusiasts), these games were resurrected and rules and sets for
1012 them can still be purchased from George Hodges (@pxref{References and
1013 links}). I hope to eventually extend GNU shogi so that it can play at
1014 least some of these games. There are also several non-historical
1015 variants of shogi; I don't know much about them but you can find
1016 information about them on the internet (@pxref{References and links}).
1018 The historical variants include:
1023 Tori (bird) shogi, played on a 7x7 board with 32 pieces in all; this is
1024 the only variant that is known to have been played with drops.
1027 Wa shogi, played on an 11x11 board with 54 pieces. This game can be
1028 played with or without drops but the historical evidence favors the view
1029 that it was played without drops. However, most people who have tried
1030 it claim it is a much better game with drops, being even more intricate
1031 than standard shogi.
1034 Chu (middle) shogi, played on a 12x12 board with 92 pieces. This was
1035 (and is) by far the most popular of the variants, and has 21 different
1036 kinds of pieces in the starting line-up alone (along with several others
1037 that appear upon promotion). Unlike modern shogi, there are a
1038 tremendous number of ranging pieces and the game is definitely not
1039 played with drops. There is also an amazing piece called the Lion which
1040 has a double king move and can capture two pieces at once! Chu shogi
1041 has a small but fanatical following, some of whom consider it better
1045 Dai (great) shogi, played on a 15x15 board with 130 pieces. Other than
1046 the larger board, this game is very similar to Chu shogi.
1049 Tenjiku (exotic) shogi, played on a 16x16 board with 176 pieces. This
1050 game is possibly the most complex tactical game in existence. There are
1051 many astoundingly powerful pieces, including one (the Fire Demon) that
1052 can capture up to eight opposing pieces in a single move! Despite the
1053 size of the game, checkmates can occur very suddenly (and often very
1054 early on) if one player makes a wrong move. Tenjiku also has a small
1055 but fanatical following, one of whom (Colin Adams) has written a book on
1056 the game which is available for download at
1057 @uref{http://www.colina.demon.co.uk/tenjiku.html}.
1060 Dai-dai (great-great) shogi, played on a 17x17 board with 192 pieces.
1061 The opening setup alone has 64 different kinds of pieces! This game and
1062 the larger ones that follow sound pretty outlandish, but they have
1063 actually been played; a game of Dai-dai can supposedly be played in
1067 Maka-dai-dai (great-great-great) shogi, played on a 19x19 board with 192
1068 pieces. For those for whom Dai-dai shogi is just too small :-)
1071 Tai (grand) shogi, played on a 25x25 board with 354 pieces! Until
1072 recently, this was thought to be the biggest chess game ever devised,
1076 Kyoku tai (extremely grand?) shogi, played on a 36x36 board with 402
1077 pieces. The rules for this have just been unearthed in an old Japanese
1078 book. Hopefully someone will soon organize a postal Kyoku tai shogi
1079 championship; maybe their distant ancestors could finish it :-)
1081 It is thought that the really huge games (Dai-dai and up) were never
1082 really played to any significant extent (gee, wonder why?) and were
1083 devised merely so that the creators could have the fun of inventing
1084 enormous games, amazing their friends and confounding their enemies.
1085 However, the games up to Tenjiku shogi at least appear to be quite
1086 playable, assuming one has the time.
1091 @c Differences between shogi and chess.
1094 @node Differences between shogi and chess, , Shogi variants, About shogi
1095 @section Differences between shogi and chess
1096 @cindex Shogi vs. Chess
1098 Some differences between shogi and international chess have been
1099 mentioned elsewhere in this document; I summarize them here for people
1100 who are interested in game comparisons. I won't try to deal with the
1101 thorny question of which game is ``better'' although my bias may have
1102 already come through :-) In fact, the drop rule makes the two games so
1103 different in character that arguing over which game is better is like
1104 comparing apples to oranges (you'd be better off comparing chess to Chu
1105 shogi (@pxref{Shogi variants}). However, I believe that if you are a
1106 chess fan you'll really like shogi as well, and shogi is also popular
1107 with many people who don't particularly like chess.
1109 Here are the significant differences between chess and shogi:
1114 In shogi, captured pieces become the property of the capturer and can
1115 re-enter play by being dropped onto almost any vacant square. In chess,
1116 captured pieces are out of the game. Thus, in shogi, piece exchanges
1117 complicate the play significantly while in chess they simplify it.
1120 The shogi board is 9x9; the chess board is 8x8.
1123 Shogi has five pieces with no counterpart in chess: the gold and silver
1124 generals, the lance, the promoted rook and the promoted bishop. Chess
1125 has one piece with no counterpart in shogi: the queen. The knight's
1126 move in shogi is much more restrictive than in chess. Pieces in shogi
1127 generally have a much smaller range of movement than in chess (unless
1131 In shogi, all pieces except the gold general and the king can promote,
1132 but only to one kind of piece. Promotion is easier in shogi because the
1133 promotion zone is closer to the starting position of the pieces
1134 (especially pawns). In chess, only the pawn can promote, but it can
1135 promote to any other piece except the king.
1138 In shogi, pawns capture the same way they move. There is no initial
1139 two-space pawn move and hence no @emph{en-passant} captures. In chess,
1140 pawns capture diagonally which means that opposing pawns can block each
1144 In shogi, you only have one rook and one bishop. Note that the bishop
1145 is not restricted to only one ``color'' square (squares in shogi aren't
1146 colored, but never mind) because promoted bishops can also move one
1147 square orthogonally.
1150 There is no special castling move in shogi. The term ``castle'' is
1151 used in shogi to denote a defensive formation consisting of (usually)
1152 three generals which protect the king. There are many such castles
1153 (about 40 or so have names). @xref{Sample game}.
1156 Draws are much rarer in shogi than in chess. Perpetual check is not
1157 allowed. Stalemate is a virtual impossibility, and is a loss for the
1161 Since pieces are never out of play in shogi, chess-type endgames
1162 involving only a few pieces do not occur.
1165 Shogi games are generally longer than chess games (about 60-70 moves is
1169 Shogi has a well-developed handicap system which is in general use;
1174 The effects of all these differences on play include (in my opinion):
1179 Piece/pawn structures in chess are more rigid than in shogi. Pawns
1180 block each other and pawns, once advanced, cannot ever retreat. In
1181 shogi, you can repair the hole caused by a pawn advance by exchanging
1182 the pawn and dropping it back where you want it. Thus shogi is more
1183 fluid than chess and less ``structural''.
1186 Counterattack is MUCH more common in shogi than in chess. Games
1187 typically end in mutual mating attacks, where each player is trying to
1188 checkmate the other player before being checkmated himself. This makes
1189 tempo incredibly important and also makes sacrificial play quite common.
1192 Attacks involving only ranging pieces are more a feature of chess than
1193 of shogi. A shogi attack typically uses a ranging piece or pieces to
1194 support an attack by short-range pieces (especially generals). It is
1195 very rare to mate a king with a non-adjacent ranging piece in shogi
1196 since the player whose king is threatened can almost always interpose by
1202 @c --------------------
1204 @c --------------------
1206 @node gnushogi, xshogi, About shogi, Top
1210 This section describes how to run the ``gnushogi'' program.
1214 gnushogi [ [[-]a] [-b bookfile] [-B binbookfile] [-C] [-h langfile]
1215 [-L langfile] [-r length] [-R] [-s pathname] [-l pathname] [-S binbooksize]
1216 [-t] [-c size] [-T size] [-v] [-x] [-X] arg1 arg2 ]
1220 GNU shogi (gnushogi) plays a game of japanese chess (shogi) against the
1221 user or it plays against itself.
1223 At startup gnushogi reads the binbook file if it is present. It then
1224 looks for a book file. If it is present it adds its contents to the
1225 binbook data. If the binbook file is writable a new combined binbook
1228 Gnushogi is a modified version of the gnuchess program. It has a simple
1229 alphanumeric board display, or it can be used with the xshogi program
1230 under X windows. The program gets its opening moves from the file
1231 gnushogi.bbk which is located in a directory specified in the Makefile.
1232 To invoke the program type:
1237 simple curses based version
1239 @item gnushogi -X (or just gnushogi)
1240 xshogi compatible version
1243 raw test display version
1248 If one argument is given, it is the search time per move in
1249 [minutes:]seconds. So gnushogi 30 will generate one move every 30
1250 seconds, while gnushogi 5:00 will generate one move every 5 minutes.
1252 If two or more arguments are given, they will be used to set tournament
1253 time controls with the first argument of each pair being the number of
1254 moves and the second being the total clock time in minutes[:seconds].
1255 Thus, entering gnushogi 60 5 will set the clocks for 5 minutes (300
1256 seconds) for the first 60 moves, and gnushogi 30 3:30 will allow 3
1257 minutes and 30 seconds for 30 moves.
1259 gnushogi 30 5 1 :30 will allow 5 minutes for the first 30 moves and 30
1260 seconds for each move after that. Up to 4 pairs of controls may be
1263 If no argument is given the program will prompt the user for level of
1266 For use with xshogi see the documentation on that program.
1273 The book gnushogi.tbk consists of a sequence of openings. An opening
1274 begins with a line starting with a # (the rest of the line is a comment).
1275 Following this is a series of moves in algebraic notation alternating
1276 between black and white separated by whitespace. A move may have a ?
1277 after it indicating this move should never be made in this position. Moves
1278 are stored as position:move so transpositions between openings can take
1283 The hashfile if created should be on the order of 4 megabytes; you can
1284 create such a hashfile by typing ``gnushogi -c 22'' (see below). This
1285 file contains positions and moves learned from previous games. If a
1286 hashfile is used the computer makes use of the experience it gained in
1287 past games. Tests run so far show that it plays no worse with the
1288 hashfile than without, but it is not clear yet whether it provides a
1293 Note: Piece letters are determined by the language file. What is
1294 specified here is the default (English).
1296 Once gnushogi is invoked, the program will display the board and prompt
1297 the user for a move. To enter a move, use the notation 7g7f where the
1298 first letter-number pair indicates the origin square and the second
1299 letter-number pair indicates the destination square. An alternative is
1300 to use the notation P7f where the first letter indicates the piece type
1301 (P,L,N,S,G,B,R,K). To promote append a + the type of the new piece to
1302 the move, as in 2d2c+ or P2c+. Note that you must use capital letters
1303 for the pieces by default.
1305 COMMAND-LINE OPTIONS
1310 Do not search on opponent's time.
1313 Do search on opponent's time.
1315 @item -b @var{bookfile}
1316 Use bookfile for opening book.
1318 @item -B @var{binbookfile}
1319 Use binbookfile for binary opening book.
1322 Create a new HASHFILE. File size is 2^size entries of approximately 65+?
1326 Use curses-based display mode.
1329 Do not use hashfile.
1334 @item -l @var{pathname}
1335 Pathname of the loadfile used with get or xget.
1338 Use language lang from the file gnushogi.lang. If -L is not specified
1339 it uses the first language in the file.
1341 @item -P @var{plylevels}
1342 Number of plys to include in the binbookfile. For generating a
1345 @item -r @var{length}
1346 Rehash @emph{length} times in searching entries for position in
1347 transposition table.
1350 Use raw text display mode. This can be used for dumb terminals or for
1351 systems that don't have curses.
1353 @item -s @var{pathname}
1354 Pathname of the save file to use with the save command.
1357 Size of binbookfile for memory based books. For creating a binbookfile.
1360 Show statistics for HASHFILE.
1363 Set the transposition table size to 2^size entries.
1366 Show version and patchlevel.
1368 @item -x @var{value}
1369 Use value as the evaluation window xwndw.
1372 Use xshogi display mode (the default).
1379 In addition to legal moves, the following commands can be entered at the
1380 gnushogi prompt. Note: command names are determined by the language
1381 file and may vary with the implementation. The default language is
1387 allow algebraic input (not implemented).
1390 change Alpha window (default score + 90).
1393 change Beta window (default score - 90).
1396 toggles beeping after each move (default: on).
1399 updates the current board position on the display.
1402 turns off use of the opening library.
1405 causes the computer to play both sides of a shogi game.
1408 causes the computer to play as White, if the computer was to move
1412 saves a game to disk as a book textfile. The program will prompt the
1413 user for a file name.
1416 toggles game mode time control. Assumes the time specified for time
1417 control is the time for a complete game. Input with the level command
1418 should be the game time and the expected number of moves in a game. go
1419 command must be given.
1422 show coordinates on the display (visual only).
1425 allows the value of @emph{contempt} to be modified.
1428 asks for a piece as color piece, as wb or bn, and shows its calculated
1429 value on each square.
1432 sets level of debugging output if compiled with debug options.
1435 allows the user to change the search depth of the program. The maximum
1436 depth is 29 ply. Normally the depth is set to 29 and the computer
1437 terminates its search based on elapsed time rather than depth. If depth
1438 is set to (say) 4 ply, the program will search until all moves have been
1439 examined to a depth of 4 ply (with extensions up to 11 additional ply
1440 for sequences of checks and captures). If you set a maximum time per
1441 move and also use the depth command, the search will stop at the
1442 specified time or the specified depth, whichever comes first.
1445 toggles easy mode (thinking on opponents time) on and off. The default
1446 is easy mode ON. If easy mode is disabled, the keyboard is polled for
1447 input every so often and when input is seen the search is terminated. It
1448 may also be terminated with a sigint.
1451 allows the user to set up a board position.
1461 command will exit setup mode.
1467 place a promoted pawn on 3b
1470 place a pawn in hand (among the captured pieces)
1474 Pieces are entered by typing a letter (p,l,n,s,g,b,r,k) for
1475 the piece followed by the coordinate. Here, letter case is ignored.
1477 The usual warning about the language file applies.
1483 tells the computer to move first. Computer begins searching for a move.
1487 allows the user to enter moves for both sides. To get the program to
1488 play after a sequence of moves has been entered use the ``black'' or
1492 retrieves a game from disk. The program will prompt the user for a file
1496 tells the computer to move first. Computer begins searching for a move.
1497 (same as ``first'').
1500 use/don't use hashfile.
1503 allows the user to change the minimum depth for using the hashfile and
1504 the number of moves from the beginning of the game to use it.
1507 displays a short description of the commands and the current status of
1511 causes the program to supply the user with its predicted move.
1514 allows the user to set time controls such as 60 moves in 5 minutes etc.
1515 In tournament mode, the program will vary the time it takes for each
1516 move depending on the situation. If easy mode is disabled (using the
1517 ``easy'' command), the program will often respond with its move
1518 immediately, saving time on its clock for use later on.
1521 writes the game moves and some statistics on search depth, nodes, and
1522 time to the file ``shogi.lst''.
1525 toggle material flag - draws on no pawns and both sides < rook.
1531 evaluates the board and shows the point score for each piece. The total
1532 score for a position is the sum of these individual piece scores.
1535 causes the program to display the principal variation and the score
1536 during the search. A score of 100 is equivalent to a 1 pawn advantage
1543 causes the program to randomize its move selection slightly.
1549 backout the last level for both sides. Equal to 2 undo's.
1552 causes the board display to be reversed. That is, the Black's pieces will
1553 now appear at the top of the board.
1556 reverse board display.
1559 saves a game to disk. The program will prompt the user for a file name.
1562 causes the program to switch places with the opponent and begin
1566 performs some speed tests for MoveList and CaptureList generation, and
1567 ScorePosition position scoring for the current board.
1570 set computer's time remaining, intended for synchronizing clocks among
1574 toggle tsume mode. In tsume mode, not all possible moves will be
1575 generated. If a king is in check, only moves that get the king out of
1576 check are generated. If the king is not in check, only moves that give
1577 check to the opponent's king are generated.
1580 undoes the last move whether it was the computer's or the human's. You
1581 may also type ``remove''. This is equivalent to two ``undo'''s
1582 (e.g. retract one move for each side).
1585 causes the computer to play as Black; if the computer is to move
1586 first the go command must be given.
1589 read an xshogi position file.
1592 save as an xshogi position file.
1595 change X window. The window around alpha/beta used to determine whether
1596 the position should be scored or just estimated. Note: this has
1597 @emph{nothing} to do with xshogi or X windows; the terms are completely
1603 @c --------------------
1605 @c --------------------
1607 @node xshogi, References and links, gnushogi, Top
1611 This section describes how to run the ``xshogi'' program.
1619 xshogi provides an X11/Xt/Athena Widgets user interface for gnushogi.
1620 With xshogi you can play gnushogi, set up arbitrary positions, force
1621 variations, or watch xshogi manage a game between two shogi programs.
1622 Furthermore, it can be used as an interface between two players on
1625 xshogi can also be used as a shogi board to play out games. It will
1626 read through a game file or allow a player to play through a variation
1627 manually (force mode). This is useful for keeping track of email postal
1628 games or browsing games off the net.
1630 After starting xshogi, you can make moves by pressing mouse button 1
1631 while the cursor is over a square with your piece on it and dragging the
1632 mouse to another square. If the move is illegal, gnushogi will not
1633 allow it. xshogi will then retract the move.
1635 COMMAND-LINE OPTIONS
1637 The following command line options also correspond to X resources that
1638 you can set in your .Xdefaults file.
1642 @item [standard Xt options]
1643 xshogi accepts standard Xt options like -display, -geometry, and
1646 @item -tc or -timeControl minutes[:seconds]
1647 Amount of time for a set of moves determined by movesPerSession. If
1648 this number of moves is played within the time control period, xshogi
1649 resets the time clocks. Default: 5 minutes.
1651 @item -mps or -movesPerSession moves
1652 Number of moves in a time control period. Default: 40 moves.
1654 @item -st or -searchTime minutes[:seconds]
1655 Tell gnushogi to spend at most the given amount of time searching for
1656 each of its moves. Without this option, gnushogi chooses its search
1657 time based on the number of moves and amount of time remaining until the
1658 next time control. Setting this option also sets -clockMode to False.
1660 @item -sd or -searchDepth number
1661 Tell gnushogi to look ahead at most the given number of moves when
1662 searching for a move to make. Without this option, gnushogi chooses
1663 its search depth based on the number of moves and amount of time
1664 remaining until the next time control. Setting this option also sets
1665 -clockMode to False.
1667 @item -clock or -clockMode (True | False)
1668 Determines whether or not to use the clock. If clockMode is False, the
1669 clock does not run, but the side that is to play next is still
1672 @item -td or -timeDelay seconds
1673 Time delay between moves during ``Load Game''. This doesn't have to be
1674 a round number. Try -td 0.4. Default: 1 second.
1676 @item -nsp or -noShogiProgram (True | False)
1677 If this option is True, xshogi acts as a passive shogi board; it does
1678 not try to start a shogi program, not even to check whether moves made
1679 in Force mode are legal. It also sets -clockMode to False. Default:
1682 @item -fsp or -firstShogiProgram program
1683 Name of first shogi program. In matches between two machines, this
1684 program plays white. Default: ``gnushogi''.
1686 @item -ssp or -secondShogiProgram program
1687 Name of second shogi program, if needed. In matches between two
1688 machines, this program plays black; otherwise it is not started.
1689 Default: ``gnushogi''.
1691 @item -fh or -firstHost host
1692 Name of host the first shogi program plays on. Default: ``localhost''.
1694 @item -sh or -secondHost host
1695 Name of host the second shogi program plays on. Default: ``localhost''.
1697 @item -rsh or -remoteShell shell_name
1698 Some systems do not use rsh as the remote shell. This option allows a
1699 user to name the remote shell command. This should be done in the
1702 @item -mm or -matchMode (False | Init | Position | Opening)
1703 Automatically run a game between firstShogiProgram and
1704 secondShogiProgram. If matchMode is set to Init, xshogi will start the
1705 game with the initial shogi position. If matchMode is set to Position,
1706 xshogi will start the game with the position specified by the
1707 loadPositionFile resource. If matchMode is set to Opening, xshogi will
1708 play out the opening moves specified by the -loadGameFile resource. If
1709 the -saveGameFile resource is set, a move record for the match will be
1710 saved in the specified file. Default: ``False''.
1712 @item -lgf or -loadGameFile file
1713 Name of file to read a game record from. Game files are found in the
1714 directory named by the SHOGIDIR environment variable. If this variable
1715 is not set, the current directory is used unless the file name starts
1718 @item -lpf or -loadPositionFile file
1719 Name of file to read a game position from. Position files are found in
1720 the directory named by the SHOGIDIR environment variable. If this
1721 variable is not set, the current directory is used unless the file name
1724 @item -sgf or -saveGameFile file
1725 Name of file to save a game record to. Game files are saved in the
1726 directory named by the SHOGIDIR environment variable. If this variable
1727 is not set, the current directory is used unless the file name starts
1730 @item -spf or -savePositionFile file
1731 Name of file to save a game position to. Position files are saved in
1732 the directory named by the SHOGIDIR environment variable. If this
1733 variable is not set, the current directory is used unless the file name
1736 @item -coords or -showCoords (True | False)
1737 If this option is True, xshogi displays algebraic coordinates along the
1738 board's left and bottom edges. The default is False. The coordFont
1739 resource specifies what font to use.
1741 @item -mono or -monoMode (True | False)
1742 Determines whether xshogi displays its pieces and squares with two
1743 colors or four. You shouldn't have to specify monochrome. xshogi will
1744 determine if this is necessary.
1746 @item -pc or -pieceColor color
1747 Color specification for pieces suitable for XParseColor().
1750 @item -sc or -squareColor color
1751 Same for squares. Default: #EBDFB0.
1753 @item -wps or -westernPieceSet (True | False)
1754 Choose the Western style piece set.
1756 @item -npb or -normalPawnBitmap file
1757 @item -nnb or -normalKnightBitmap file
1758 @item -nbb or -normalBishopBitmap file
1759 @item -nrb or -normalRookBitmap file
1760 @item -nkb or -normalKingBitmap file
1761 Names of the bitmap files for the bitmap piece icons.
1763 @item -rpb or -reversePawnBitmap file
1764 @item -rnb or -reverseKnightBitmap file
1765 @item -rbb or -reverseBishopBitmap file
1766 @item -rrb or -reverseRookBitmap file
1767 @item -rkb or -reverseKingBitmap file
1768 Names of the bitmap files for the outline piece icons.
1770 @item -debug or -debugMode (True | False)
1771 Turns on debugging printout.
1782 The actual string that is sent to initialize the shogi program can be
1783 set from .Xdefaults. It can't be set from the command line because of
1784 syntax problems. The default value is ``new\nbeep\nrandom\neasy\n''.
1785 The ``new'' and ``beep'' commands are required. You can remove the
1786 ``random'' command if you like; including it causes gnushogi to
1787 randomize its move selection slightly so that it doesn't play the same
1788 moves in every game. Even without ``random'', gnushogi randomizes its
1789 choice of moves from its opening book. You can also remove ``easy'' if
1790 you like; including it toggles easy mode off, causing gnushogi to think
1791 on your time. That is, if ``easy'' is included in the initString, GNU
1792 Shogi thinks on your time; if not, it does not. (Yes, this does seem
1793 backwards, doesn't it.) You can also try adding other commands to the
1794 initString; see the gnushogi documentation (@pxref{gnushogi}) for
1797 @item blackString and whiteString
1798 These resources control what is sent when the Machine Black and Machine
1799 White buttons are selected. This is mostly for compatibility with
1800 obsolete versions of gnushogi.
1802 Alternate bitmaps for piece icons can be specified either by choosing
1803 one of the built-in sets or with the file name resources described
1804 above. There are three built-in sets of piece bitmaps available, large
1805 (the default), medium, or small. It is easiest to select the set you
1806 prefer in the .Xdefaults file:
1808 XShogi*boardSize: Medium
1810 The font used for button labels and comments can be changed in the
1811 .Xdefaults file. You may want to choose a smaller font if you are using
1814 XShogi*font: helvetica_oblique12
1816 The font used for coordinates (when the showCoords option is True) can
1819 XShogi*coordFont: helvetica_10
1821 If you are using a grayscale monitor, try setting the colors to:
1823 XShogi*pieceColor: gray100 @*
1824 XShogi*squareColor: gray60 @*
1828 COMMAND BUTTONS AND KEYS
1833 Quits xshogi. Q or q is a keyboard equivalent.
1836 Resets xshogi to the beginning of a shogi game. It also deselects any
1837 game or position files.
1840 inverts the view of the shogi board.
1843 displays a move hint from gnushogi.
1846 plays a game from a record file. If no file is specified a popup dialog
1847 asks for a filename. Game files are found in the directory named by the
1848 SHOGIDIR environment variable. If this variable is not declared then
1849 the current directory is used unless the file name starts with a /. G
1850 or g is a keyboard equivalent. The game file parser will accept almost
1851 any file that contains moves in algebraic notation. If the first line
1852 begins with `#', it is assumed to be a title and is displayed. Text
1853 enclosed in parentheses or square brackets is assumed to be commentary
1854 and is displayed in a pop-up window. Any other text in the file is
1858 sets up a position from a position file. If no file is specified a
1859 popup dialog asks for a filename. Position files are found in the
1860 directory named by the SHOGIDIR environment variable. If this variable
1861 is not declared then the current directory is used unless the file name
1862 starts with a /. Position files must be in the format that the Save
1863 Position command writes.
1866 saves a game to a record file. If no file is specified a popup dialog
1867 asks for a filename. If the filename exists, the user is asked whether
1868 the current game record is be appended to this file or if the file
1869 should be replaced. Game files are saved in the directory named by the
1870 SHOGIDIR environment variable. If this variable is not declared then
1871 the current directory is used unless the file name starts with a /.
1872 Game files are human-readable, and can also be read back by the Load
1873 Game command. Furthermore, they are accepted as gnushogi text bookfiles.
1876 saves a position to a position file. If no file is specified a popup
1877 dialog asks for a filename. Position files are saved in the directory
1878 named by the SHOGIDIR environment variable. If this variable is not
1879 declared then the current directory is used unless the file name starts
1880 with a /. Position files are human-readable, and can also be read back
1881 by the Load Position command.
1884 forces gnushogi to play white.
1887 forces gnushogi to play black.
1890 forces a series of moves. That is, gnushogi stops playing and xshogi
1891 allows you to make moves for both white and black.
1894 plays a game between two computer programs.
1897 moves forward through a series of remembered moves. F or f is a
1898 keyboard equivalent.
1901 moves backward through a series of remembered moves. As a side effect,
1902 puts xshogi into Force Moves mode. B or b is a keyboard equivalent.
1905 pauses the clocks or (in Load Game mode) pauses the game being loaded.
1906 Press Pause again to continue. P or p is a keyboard equivalent.
1909 lets you set up an arbitrary board position. Use mouse button 1 to drag
1910 pieces to new squares, or to delete a piece by dragging it off the board
1911 or dragging an empty square on top of it. To drop a new piece on a
1912 square, press mouse button 2 or 3 over the square. This brings up a
1913 menu of black pieces (button 2) or white pieces (button 3). Additional
1914 menu choices let you empty the square or clear the board. You can set
1915 the side to play next by clicking on the Black or White indicator at the
1919 allows you to make a two display game between two human players. Enter
1920 the display you want to connect to. If you are allowed to connect, a
1921 new board is displayed at the remote display. Challenge mode can only
1922 be stopped by pressing ``quit''.
1925 allows you to reset the clocks for both players. Enter the number of
1926 moves and the number of minutes in which the moves should be done.
1929 force computer to stop thinking and to make the current best move.
1931 @item Iconify I, i, C or c
1938 If you press the Pause button during GNU Shogi's turn,
1939 xshogi will stop the clocks, but gnushogi will still make a
1942 After a mate or draw when playing against gnushogi, if you
1943 back up with the Backward button, the clocks are reset
1944 (because gnushogi has exited and must be restarted).
1946 The game parser recognizes only algebraic notation.
1950 Original authors of XBoard: Chris Sears and Dan Sears.
1952 Enhancements for XBoard (Version 2.0): Tim Mann.
1954 Conversion to XShogi (Version 1.1): Matthias Mutz.
1956 Current maintainer: Mike Vanier.
1958 COPYRIGHT INFORMATION
1960 XShogi borrows its piece bitmaps from CRANES Shogi.
1962 Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
1963 Enhancements Copyright 1992 Free Software Foundation, Inc. Enhancements
1964 Copyright 1993 Matthias Mutz. Further enhancements copyright 1999 by
1965 Michael Vanier and the Free Software Foundation, Inc.
1967 The following terms apply to Digital Equipment Corporation's copyright
1972 Permission to use, copy, modify, and distribute this software and its
1973 documentation for any purpose and without fee is hereby granted,
1974 provided that the above copyright notice appear in all copies and that
1975 both that copyright notice and this permission notice appear in
1976 supporting documentation, and that the name of Digital not be used in
1977 advertising or publicity pertaining to distribution of the software
1978 without specific, written prior permission.
1980 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
1981 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
1982 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
1983 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
1984 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1985 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1988 The following terms apply to the enhanced version of XShogi distributed
1989 by the Free Software Foundation:
1991 This file is part of XSHOGI.
1993 XSHOGI is distributed in the hope that it will be useful, but WITHOUT
1994 ANY WARRANTY. No author or distributor accepts responsibility to anyone
1995 for the consequences of using it or for whether it serves any particular
1996 purpose or works at all, unless he says so in writing. Refer to the
1997 XSHOGI General Public License for full details.
1999 Everyone is granted permission to copy, modify and redistribute XSHOGI,
2000 but only under the conditions described in the XSHOGI General Public
2001 License. A copy of this license is supposed to have been given to you
2002 along with XSHOGI so you can know your rights and responsibilities. It
2003 should be in a file named COPYING. Among other things, the copyright
2004 notice and this notice must be preserved on all copies.
2007 @c ---------------------
2008 @c References and links.
2009 @c ---------------------
2011 @node References and links, Acknowledgements, xshogi, Top
2012 @chapter References and links
2015 @cindex Mailing lists
2019 There are very few English-language books for people learning shogi.
2020 The two I recommend are:
2025 @cite{Shogi for Beginners, 2nd. Edition}, by John Fairbairn. This is a
2026 superb beginner's book in every way, covering all phases of the game.
2027 It was out of print for a long time, but has now been reprinted and is
2028 available either from Kiseido (@uref{http://www.labnet.or.jp/~kiseido})
2029 or from George Hodges (see below).
2032 @cite{The Art of Shogi}, by Tony Hoskings. This is one step up from the
2033 Fairbairn book. It covers a lot of ground, and is especially noteworthy
2034 for its detailed treatment of opening lines. You can order this book
2035 from Amazon.com's UK branch (@uref{http://www.amazon.co.uk}).
2039 Another book you may find is @cite{Shogi: Japan's Game of Strategy} by
2040 Trevor Leggett. This book is very elementary and is somewhat outdated,
2041 having been published first in 1966. However, it does feature a paper
2042 shogi board and punch-out pieces, so if you want a really cheap shogi
2043 set you might pick this book up. It is still in print.
2045 Two books that are no longer in print but are definitely worth getting
2046 if you find them are @cite{Guide to Shogi Openings} and @cite{Better
2047 Moves for Better Shogi}, both by Aono Teriuchi. They are published in a
2048 bilingual edition (English/Japanese) and are the only books on shogi in
2049 English written by a Japanese professional shogi player. John Fairbairn
2050 did the translation from Japanese to English.
2052 Shogi sets are available from:
2058 United Kingdom BR1 2WT
2061 George also sells equipment for all the historical shogi variants
2062 (@pxref{Shogi variants}) (except for Kyoku tai shogi) and also sells
2063 back issues of the magazine ``Shogi'' which he published for 70 issues
2064 in the late 70's to late 80's. This magazine is STRONGLY recommended;
2065 it contains more information about shogi in English than you will ever
2068 Here are some useful URLs:
2072 @item Pieter Stouten's shogi page: @uref{http://www.shogi.net}
2073 This is the main shogi-related site on the internet, with links to
2074 almost all the other sites.
2076 @item Roger Hare's shogi page: @uref{http://www.ed.ac.uk/~rjhare/shogi}
2077 This has lots of information, including full rules to most of the shogi
2080 @item Patrick Davin's Shogi Nexus: @uref{http://www.vega.or.jp/~patrick/shogi/}
2081 There's lots of cool stuff on this site; my favorite is the extensive
2082 collection of Tsume-shogi (mating) problems, both for beginners and
2083 more advanced players.
2085 @item Steve Evans' shogi page: @uref{http://www.netspace.net.au/~trout/index.html}
2086 Steve has written a program that plays almost all of the shogi variants,
2087 unfortunately it only runs on Windows :-(
2089 @item Hans Bodlaender's chess variant pages: @uref{http://www.cs.ruu.nl/~hansb/d.chessvar}
2090 This page has an almost unimaginable variety of rules for different
2091 chess variants, including many shogi variants (historical and non-historical).
2095 @c -----------------
2096 @c Acknowledgements.
2097 @c -----------------
2099 @node Acknowledgements, Bugs, References and links, Top
2100 @chapter Acknowledgements
2101 @cindex Acknowledgements
2103 I would like to thank the following people:
2108 Matthias Mutz, who originally developed GNU shogi as a spin-off of GNU
2109 chess and who very kindly let me take over the maintenance of this very
2110 interesting project.
2113 Richard Stallman and the Free Software Foundation, for creating an
2114 organization where anyone can contribute software for the common good of
2115 all, for making GNU/Linux possible, and especially for writing emacs and
2116 gcc, without which my working life would be intolerable.
2119 Georges Hodges, for starting the Shogi Association in England, without
2120 which I would probably never have heard of shogi, for supplying shogi
2121 equipment, for publishing the excellent magazine ``Shogi'' (now sadly
2122 defunct), for personally answering all my silly questions by mail, and
2123 for being the ambassador of shogi to the West.
2126 Pieter Stouten, for having the most comprehensive shogi site on the
2127 World Wide Web (@uref{http://www.shogi.net}), and for
2128 maintaining the shogi-l mailing list. Go to Pieter's web site for more
2129 information on subscribing to the list. Also thanks to everyone who
2130 contributes and has contributed to that list.
2133 Matt Casters, for testing GNU shogi. Matt and I will be working
2134 together on improving the solution engine in future versions of this
2143 @node Bugs, Index, Acknowledgements, Top
2146 The motto of GNU shogi is ``100% bug-free or you don't pay!'' :-) In the
2147 extremely unlikely case (*ahem*) that you do find a bug, please send me
2148 (Mike Vanier) an email at @email{mvanier@@cs.caltech.edu}. Also, feel
2149 free to send me comments, complaints, out-and-out raves, suggestions,
2150 plane tickets to Hawaii, and/or large suitcases filled with unmarked,
2151 untraceable hundred-dollar bills.
2164 @node Index, , Bugs, Top