Updating to version 1.3.2, last public release by Mike Vanier.
[gnushogi.git] / doc / gnushogi.info-1
1 This is gnushogi.info, produced by makeinfo version 4.3 from
2 gnushogi.texinfo.
3
4    This file describes how to use GNU shogi, a program which plays
5 Shogi (Japanese chess).
6
7    Copyright (C) 1999 Michael C. Vanier and the Free Software
8 Foundation, Inc.
9
10    Permission is granted to make and distribute verbatim copies of this
11 manual provided the copyright notice and this permission notice are
12 preserved on all copies.
13
14    Permission is granted to copy and distribute modified versions of
15 this manual under the conditions for verbatim copying, provided that
16 the entire resulting derived work is distributed under the terms of a
17 permission notice identical to this one.
18
19    Permission is granted to copy and distribute translations of this
20 manual into another language, under the above conditions for modified
21 versions, except that this permission notice may be stated in a
22 translation approved by the Free Software Foundation.
23
24 \1f
25 File: gnushogi.info,  Node: Top,  Next: (dir),  Prev: (dir),  Up: (dir)
26
27 GNU Shogi (Japanese chess)
28 **************************
29
30 * Menu:
31
32 * Introduction::         What is GNU shogi?
33 * License::              The GNU General Public License.
34 * About shogi::          General information, rules, etc.
35 * gnushogi::             How to play GNU shogi (gnushogi).
36 * xshogi::               The X interface to GNU shogi.
37 * References and links:: Where to go for more information.
38 * Acknowledgements::
39 * Bugs::                 Where and how to report bugs.
40 * Index::
41
42 \1f
43 File: gnushogi.info,  Node: Introduction,  Next: License,  Prev: Top,  Up: Top
44
45 Introduction
46 ************
47
48    GNU shogi is a program that plays shogi, the Japanese version of
49 chess, against a human (or computer) opponent.  This file describes how
50 to use GNU shogi and also gives background information about the game
51 of shogi.
52
53    This file describes GNU shogi version 1.3.2.  It was written by me,
54 Mike Vanier, the current maintainer of GNU shogi.  My email address is
55 <mvanier@cs.caltech.edu>.
56
57    GNU shogi is actually two programs:
58
59
60 `gnushogi'
61      is the text-based program which also contains the game-playing
62      engine.
63
64 `xshogi'
65      is the X-windows graphical interface to gnushogi.
66
67
68    Since xshogi invokes gnushogi, most players will just type "xshogi"
69 and start playing.
70
71    Disclaimer: I use the personal pronouns "him", "his" etc. to refer
72 to a shogi player regardless of gender.  That's easier than writing
73 "his or her" all over the place.  I don't mean to infer that women
74 don't play shogi; in fact shogi is very popular in Japan among women as
75 well as men.
76
77 \1f
78 File: gnushogi.info,  Node: License,  Next: About shogi,  Prev: Introduction,  Up: Top
79
80 GNU GENERAL PUBLIC LICENSE
81 **************************
82
83                          Version 2, June 1991
84      Copyright (C) 1989, 1991 Free Software Foundation, Inc.
85      675 Mass Ave, Cambridge, MA 02139, USA
86      
87      Everyone is permitted to copy and distribute verbatim copies
88      of this license document, but changing it is not allowed.
89
90 Preamble
91 ========
92
93    The licenses for most software are designed to take away your
94 freedom to share and change it.  By contrast, the GNU General Public
95 License is intended to guarantee your freedom to share and change free
96 software--to make sure the software is free for all its users.  This
97 General Public License applies to most of the Free Software
98 Foundation's software and to any other program whose authors commit to
99 using it.  (Some other Free Software Foundation software is covered by
100 the GNU Library General Public License instead.)  You can apply it to
101 your programs, too.
102
103    When we speak of free software, we are referring to freedom, not
104 price.  Our General Public Licenses are designed to make sure that you
105 have the freedom to distribute copies of free software (and charge for
106 this service if you wish), that you receive source code or can get it
107 if you want it, that you can change the software or use pieces of it in
108 new free programs; and that you know you can do these things.
109
110    To protect your rights, we need to make restrictions that forbid
111 anyone to deny you these rights or to ask you to surrender the rights.
112 These restrictions translate to certain responsibilities for you if you
113 distribute copies of the software, or if you modify it.
114
115    For example, if you distribute copies of such a program, whether
116 gratis or for a fee, you must give the recipients all the rights that
117 you have.  You must make sure that they, too, receive or can get the
118 source code.  And you must show them these terms so they know their
119 rights.
120
121    We protect your rights with two steps: (1) copyright the software,
122 and (2) offer you this license which gives you legal permission to copy,
123 distribute and/or modify the software.
124
125    Also, for each author's protection and ours, we want to make certain
126 that everyone understands that there is no warranty for this free
127 software.  If the software is modified by someone else and passed on, we
128 want its recipients to know that what they have is not the original, so
129 that any problems introduced by others will not reflect on the original
130 authors' reputations.
131
132    Finally, any free program is threatened constantly by software
133 patents.  We wish to avoid the danger that redistributors of a free
134 program will individually obtain patent licenses, in effect making the
135 program proprietary.  To prevent this, we have made it clear that any
136 patent must be licensed for everyone's free use or not licensed at all.
137
138    The precise terms and conditions for copying, distribution and
139 modification follow.
140
141     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
142   0. This License applies to any program or other work which contains a
143      notice placed by the copyright holder saying it may be distributed
144      under the terms of this General Public License.  The "Program",
145      below, refers to any such program or work, and a "work based on
146      the Program" means either the Program or any derivative work under
147      copyright law: that is to say, a work containing the Program or a
148      portion of it, either verbatim or with modifications and/or
149      translated into another language.  (Hereinafter, translation is
150      included without limitation in the term "modification".)  Each
151      licensee is addressed as "you".
152
153      Activities other than copying, distribution and modification are
154      not covered by this License; they are outside its scope.  The act
155      of running the Program is not restricted, and the output from the
156      Program is covered only if its contents constitute a work based on
157      the Program (independent of having been made by running the
158      Program).  Whether that is true depends on what the Program does.
159
160   1. You may copy and distribute verbatim copies of the Program's
161      source code as you receive it, in any medium, provided that you
162      conspicuously and appropriately publish on each copy an appropriate
163      copyright notice and disclaimer of warranty; keep intact all the
164      notices that refer to this License and to the absence of any
165      warranty; and give any other recipients of the Program a copy of
166      this License along with the Program.
167
168      You may charge a fee for the physical act of transferring a copy,
169      and you may at your option offer warranty protection in exchange
170      for a fee.
171
172   2. You may modify your copy or copies of the Program or any portion
173      of it, thus forming a work based on the Program, and copy and
174      distribute such modifications or work under the terms of Section 1
175      above, provided that you also meet all of these conditions:
176
177        a. You must cause the modified files to carry prominent notices
178           stating that you changed the files and the date of any change.
179
180        b. You must cause any work that you distribute or publish, that
181           in whole or in part contains or is derived from the Program
182           or any part thereof, to be licensed as a whole at no charge
183           to all third parties under the terms of this License.
184
185        c. If the modified program normally reads commands interactively
186           when run, you must cause it, when started running for such
187           interactive use in the most ordinary way, to print or display
188           an announcement including an appropriate copyright notice and
189           a notice that there is no warranty (or else, saying that you
190           provide a warranty) and that users may redistribute the
191           program under these conditions, and telling the user how to
192           view a copy of this License.  (Exception: if the Program
193           itself is interactive but does not normally print such an
194           announcement, your work based on the Program is not required
195           to print an announcement.)
196
197      These requirements apply to the modified work as a whole.  If
198      identifiable sections of that work are not derived from the
199      Program, and can be reasonably considered independent and separate
200      works in themselves, then this License, and its terms, do not
201      apply to those sections when you distribute them as separate
202      works.  But when you distribute the same sections as part of a
203      whole which is a work based on the Program, the distribution of
204      the whole must be on the terms of this License, whose permissions
205      for other licensees extend to the entire whole, and thus to each
206      and every part regardless of who wrote it.
207
208      Thus, it is not the intent of this section to claim rights or
209      contest your rights to work written entirely by you; rather, the
210      intent is to exercise the right to control the distribution of
211      derivative or collective works based on the Program.
212
213      In addition, mere aggregation of another work not based on the
214      Program with the Program (or with a work based on the Program) on
215      a volume of a storage or distribution medium does not bring the
216      other work under the scope of this License.
217
218   3. You may copy and distribute the Program (or a work based on it,
219      under Section 2) in object code or executable form under the terms
220      of Sections 1 and 2 above provided that you also do one of the
221      following:
222
223        a. Accompany it with the complete corresponding machine-readable
224           source code, which must be distributed under the terms of
225           Sections 1 and 2 above on a medium customarily used for
226           software interchange; or,
227
228        b. Accompany it with a written offer, valid for at least three
229           years, to give any third party, for a charge no more than your
230           cost of physically performing source distribution, a complete
231           machine-readable copy of the corresponding source code, to be
232           distributed under the terms of Sections 1 and 2 above on a
233           medium customarily used for software interchange; or,
234
235        c. Accompany it with the information you received as to the offer
236           to distribute corresponding source code.  (This alternative is
237           allowed only for noncommercial distribution and only if you
238           received the program in object code or executable form with
239           such an offer, in accord with Subsection b above.)
240
241      The source code for a work means the preferred form of the work for
242      making modifications to it.  For an executable work, complete
243      source code means all the source code for all modules it contains,
244      plus any associated interface definition files, plus the scripts
245      used to control compilation and installation of the executable.
246      However, as a special exception, the source code distributed need
247      not include anything that is normally distributed (in either
248      source or binary form) with the major components (compiler,
249      kernel, and so on) of the operating system on which the executable
250      runs, unless that component itself accompanies the executable.
251
252      If distribution of executable or object code is made by offering
253      access to copy from a designated place, then offering equivalent
254      access to copy the source code from the same place counts as
255      distribution of the source code, even though third parties are not
256      compelled to copy the source along with the object code.
257
258   4. You may not copy, modify, sublicense, or distribute the Program
259      except as expressly provided under this License.  Any attempt
260      otherwise to copy, modify, sublicense or distribute the Program is
261      void, and will automatically terminate your rights under this
262      License.  However, parties who have received copies, or rights,
263      from you under this License will not have their licenses
264      terminated so long as such parties remain in full compliance.
265
266   5. You are not required to accept this License, since you have not
267      signed it.  However, nothing else grants you permission to modify
268      or distribute the Program or its derivative works.  These actions
269      are prohibited by law if you do not accept this License.
270      Therefore, by modifying or distributing the Program (or any work
271      based on the Program), you indicate your acceptance of this
272      License to do so, and all its terms and conditions for copying,
273      distributing or modifying the Program or works based on it.
274
275   6. Each time you redistribute the Program (or any work based on the
276      Program), the recipient automatically receives a license from the
277      original licensor to copy, distribute or modify the Program
278      subject to these terms and conditions.  You may not impose any
279      further restrictions on the recipients' exercise of the rights
280      granted herein.  You are not responsible for enforcing compliance
281      by third parties to this License.
282
283   7. If, as a consequence of a court judgment or allegation of patent
284      infringement or for any other reason (not limited to patent
285      issues), conditions are imposed on you (whether by court order,
286      agreement or otherwise) that contradict the conditions of this
287      License, they do not excuse you from the conditions of this
288      License.  If you cannot distribute so as to satisfy simultaneously
289      your obligations under this License and any other pertinent
290      obligations, then as a consequence you may not distribute the
291      Program at all.  For example, if a patent license would not permit
292      royalty-free redistribution of the Program by all those who
293      receive copies directly or indirectly through you, then the only
294      way you could satisfy both it and this License would be to refrain
295      entirely from distribution of the Program.
296
297      If any portion of this section is held invalid or unenforceable
298      under any particular circumstance, the balance of the section is
299      intended to apply and the section as a whole is intended to apply
300      in other circumstances.
301
302      It is not the purpose of this section to induce you to infringe any
303      patents or other property right claims or to contest validity of
304      any such claims; this section has the sole purpose of protecting
305      the integrity of the free software distribution system, which is
306      implemented by public license practices.  Many people have made
307      generous contributions to the wide range of software distributed
308      through that system in reliance on consistent application of that
309      system; it is up to the author/donor to decide if he or she is
310      willing to distribute software through any other system and a
311      licensee cannot impose that choice.
312
313      This section is intended to make thoroughly clear what is believed
314      to be a consequence of the rest of this License.
315
316   8. If the distribution and/or use of the Program is restricted in
317      certain countries either by patents or by copyrighted interfaces,
318      the original copyright holder who places the Program under this
319      License may add an explicit geographical distribution limitation
320      excluding those countries, so that distribution is permitted only
321      in or among countries not thus excluded.  In such case, this
322      License incorporates the limitation as if written in the body of
323      this License.
324
325   9. The Free Software Foundation may publish revised and/or new
326      versions of the General Public License from time to time.  Such
327      new versions will be similar in spirit to the present version, but
328      may differ in detail to address new problems or concerns.
329
330      Each version is given a distinguishing version number.  If the
331      Program specifies a version number of this License which applies
332      to it and "any later version", you have the option of following
333      the terms and conditions either of that version or of any later
334      version published by the Free Software Foundation.  If the Program
335      does not specify a version number of this License, you may choose
336      any version ever published by the Free Software Foundation.
337
338  10. If you wish to incorporate parts of the Program into other free
339      programs whose distribution conditions are different, write to the
340      author to ask for permission.  For software which is copyrighted
341      by the Free Software Foundation, write to the Free Software
342      Foundation; we sometimes make exceptions for this.  Our decision
343      will be guided by the two goals of preserving the free status of
344      all derivatives of our free software and of promoting the sharing
345      and reuse of software generally.
346
347                                 NO WARRANTY
348
349  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
350      WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
351      LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
352      HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
353      WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
354      NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
355      FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE
356      QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
357      PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
358      SERVICING, REPAIR OR CORRECTION.
359
360  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
361      WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
362      MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
363      LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
364      INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
365      INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
366      DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
367      OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
368      OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
369      ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
370
371                       END OF TERMS AND CONDITIONS
372
373 How to Apply These Terms to Your New Programs
374 =============================================
375
376    If you develop a new program, and you want it to be of the greatest
377 possible use to the public, the best way to achieve this is to make it
378 free software which everyone can redistribute and change under these
379 terms.
380
381    To do so, attach the following notices to the program.  It is safest
382 to attach them to the start of each source file to most effectively
383 convey the exclusion of warranty; and each file should have at least
384 the "copyright" line and a pointer to where the full notice is found.
385
386      ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
387      Copyright (C) 19YY  NAME OF AUTHOR
388      
389      This program is free software; you can redistribute it and/or modify
390      it under the terms of the GNU General Public License as published by
391      the Free Software Foundation; either version 2 of the License, or
392      (at your option) any later version.
393      
394      This program is distributed in the hope that it will be useful,
395      but WITHOUT ANY WARRANTY; without even the implied warranty of
396      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
397      GNU General Public License for more details.
398      
399      You should have received a copy of the GNU General Public License
400      along with this program; if not, write to the Free Software
401      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
402
403    Also add information on how to contact you by electronic and paper
404 mail.
405
406    If the program is interactive, make it output a short notice like
407 this when it starts in an interactive mode:
408
409      Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
410      Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
411      type `show w'.
412      This is free software, and you are welcome to redistribute it
413      under certain conditions; type `show c' for details.
414
415    The hypothetical commands `show w' and `show c' should show the
416 appropriate parts of the General Public License.  Of course, the
417 commands you use may be called something other than `show w' and `show
418 c'; they could even be mouse-clicks or menu items--whatever suits your
419 program.
420
421    You should also get your employer (if you work as a programmer) or
422 your school, if any, to sign a "copyright disclaimer" for the program,
423 if necessary.  Here is a sample; alter the names:
424
425      Yoyodyne, Inc., hereby disclaims all copyright interest in the program
426      `Gnomovision' (which makes passes at compilers) written by James Hacker.
427      
428      SIGNATURE OF TY COON, 1 April 1989
429      Ty Coon, President of Vice
430
431    This General Public License does not permit incorporating your
432 program into proprietary programs.  If your program is a subroutine
433 library, you may consider it more useful to permit linking proprietary
434 applications with the library.  If this is what you want to do, use the
435 GNU Library General Public License instead of this License.
436
437 \1f
438 File: gnushogi.info,  Node: About shogi,  Next: gnushogi,  Prev: License,  Up: Top
439
440 About the game of shogi
441 ***********************
442
443      "Japanese chess cedes nothing in depth or beauty to the European
444      game... it is at least as interesting."
445
446      -- Alexander Alekhine
447      (quoted in David Pritchard, `The Encyclopedia of Chess Variants')
448
449
450      "... shogi [is] by far the most complex form of chess that has ever
451      achieved widespread popularity."
452
453      -- R. Wayne Schmittberger, `New Rules for Classic Games'
454
455
456    Shogi is the version of chess played in Japan.  It is strikingly
457 different from standard chess (which I shall refer to henceforth as
458 "international chess") and also to all other regional variants, because
459 captured pieces can re-enter play on the side of the capturer.  This
460 has several interesting effects on the play of the game:
461
462
463   1. Shogi is much more complex than international chess, at least in
464      terms of the average number of possible moves per turn (estimated
465      at about 35 for chess and at about 80 for shogi).
466
467   2. There are almost no draws (about 1-2% of all games in professional
468      play).
469
470   3. Exchanges complicate the play rather than simplifying it.
471
472   4. There are no "endgames" in the standard chess sense; all pieces
473      remain in play throughout the game.  Games typically end in a race
474      to checkmate the other player before being checkmated oneself.
475
476   5. Ownership of a piece is not indicated by the color of the piece;
477      instead, pieces are wedge-shaped and point towards the opponent.
478      The name of the piece is inscribed in Kanji characters on the
479      front of the piece.
480
481   6. Most importantly: it's more fun than other forms of chess :-)
482
483
484
485    Shogi is extremely popular in Japan; it has been estimated that 20
486 million Japanese can play shogi, of which perhaps 1 million are active
487 players.  It is even more popular there than the game of go, Japan's
488 other favorite board game.  There are a number of professional players
489 who make a considerable amount of money playing in shogi tournaments,
490 and the game receives extensive newpaper and television coverage.
491 Despite this, the game has yet to become popular outside of Japan.  Part
492 of this is because the Kanji characters on the pieces scare away some
493 people, but mostly it's due, I think, to lack of exposure to the game
494 and to the difficulty of finding opponents.  I hope that GNU shogi will
495 help introduce shogi to a wider audience.
496
497 * Menu:
498
499 * The rules of shogi::
500 * Sample game::
501 * Mating problems::
502 * Shogi variants::
503 * Differences between shogi and chess::
504
505 \1f
506 File: gnushogi.info,  Node: The rules of shogi,  Next: Sample game,  Prev: About shogi,  Up: About shogi
507
508 The rules of shogi
509 ==================
510
511    Shogi is a two-person abstract strategy board game with full
512 information (i.e. all pieces and moves are visible to both players at
513 all times).  It is in the chess family, being descended from the same
514 ancestral game as international chess: the Indian game of Chaturanga.
515 The two players are referred to as "Black" and "White", with Black
516 moving first (unlike in international chess, where White moves first),
517 and with movement alternating between the two players.  Note that
518 "Black" and "White" are just names; the pieces are not colored.
519 Instead, they are flat, wedge-shaped pieces which point towards the
520 opponent.  The identity of a given piece is indicated by two Japanese
521 Kanji characters on each piece.  In fact, only the top character is
522 needed to identify the piece and thus only the top character is used in
523 shogi diagrams.  I will use alphabetical equivalents in the diagrams
524 here; to see what the Kanji characters look like, start up xshogi
525 (*note xshogi::) and compare the starting setup there with the starting
526 setup in this file (*note The opening setup::).
527
528    The object of the game is to capture the opponent's King.  The board
529 is a grid of 9x9 uncolored squares, and pieces are placed on the
530 squares.  Each player begins with 20 pieces, described in the next
531 section.  Capture is by displacement, as in international chess.
532
533 * Menu:
534
535 * The moves of the pieces::
536 * The opening setup::
537 * Promotion of pieces::
538 * Drops::
539 * Winning the game::
540 * Draws::
541 * Handicaps::
542 * Notes for chess players::
543
544 \1f
545 File: gnushogi.info,  Node: The moves of the pieces,  Next: The opening setup,  Prev: The rules of shogi,  Up: The rules of shogi
546
547 The moves of the pieces
548 -----------------------
549
550    Each player at the beginning of a shogi game has a total of 20
551 pieces of eight different types.  The moves of the shogi pieces can be
552 divided into three classes: "stepping" pieces, that only move one
553 square at a time; "ranging" pieces that move any number of unobstructed
554 squares in a line, and "jumping" pieces that can jump over obstructing
555 pieces to reach their destination squares.  Most pieces can also
556 promote to different (usually stronger) pieces under certain
557 circumstances (see the next section).  All pieces capture the same way
558 that they move (even pawns).  The piece moves and promotions are as
559 follows; each piece name is followed by the standard piece abbreviation:
560
561   1. The king (K).  The king can move one square in any horizontal,
562      vertical, or diagonal direction, just like the king in
563      international chess.  The king does not promote.
564
565   2. The rook (R).  The rook can move any number of squares in a
566      horizontal or vertical direction.  The rook is the same as the
567      rook in international chess (except that it can promote).  A rook
568      promotes to a "dragon king" or "dragon" for short (often just
569      referred to as a "promoted rook"), which can move as a rook or can
570      move one square in any diagonal direction.
571
572   3. The bishop (B).  The bishop can move any number of squares in a
573      diagonal direction.  The bishop is the same as the bishop in
574      international chess (except that it can promote).  A bishop
575      promotes to a "dragon horse" or "horse" for short (often just
576      referred to as a "promoted bishop"), which can move as a bishop or
577      can move one square in any horizontal or vertical direction.
578      Note: the horse should not be confused with a knight (see below),
579      as they are two completely different pieces.
580
581   4. The gold general (G).  A gold general can move one square in any
582      horizontal or vertical direction, or one square in a forward
583      diagonal direction.  Gold generals do not promote.
584
585   5. The silver general (S).  A silver general can move one square in
586      any diagonal direction, or one square straight forward.  A silver
587      general promotes to a gold general.
588
589   6. The knight (N).  A knight can move one square straight forward
590      followed by one square to either forward diagonal, jumping over
591      intervening pieces if any.  In other words, a knight moves like
592      its international chess counterpart, but forward only.  A knight
593      promotes to a gold general.  The knight is the only jumping piece,
594      as in chess.
595
596   7. The lance (L).  A lance can move any number of squares straight
597      forward.  A lance promotes to a gold general.
598
599   8. The pawn (P).  A pawn can move one square straight forward.  The
600      pawn captures the same way that it moves, in contrast to
601      international chess.  There is also no initial two-space move for
602      pawns and no _en-passant_ capture.  A pawn promotes to a gold
603      general; a promoted pawn is usually known as a "Tokin".
604
605
606 \1f
607 File: gnushogi.info,  Node: The opening setup,  Next: Promotion of pieces,  Prev: The moves of the pieces,  Up: The rules of shogi
608
609 The opening setup
610 -----------------
611
612    The opening setup for shogi is as follows:
613
614    9    8    7    6    5    4    3    2    1
615 +--------------------------------------------+
616 | wL | wN | wS | wG | wK | wG | wS | wN | wL |  a
617 +--------------------------------------------+
618 |    | wR |    |    |    |    |    | wB |    |  b
619 +--------------------------------------------+
620 | wP | wP | wP | wP | wP | wP | wP | wP | wP |  c
621 +--------------------------------------------+
622 |    |    |    |    |    |    |    |    |    |  d
623 +--------------------------------------------+
624 |    |    |    |    |    |    |    |    |    |  e
625 +--------------------------------------------+
626 |    |    |    |    |    |    |    |    |    |  f
627 +--------------------------------------------+
628 | bP | bP | bP | bP | bP | bP | bP | bP | bP |  g
629 +--------------------------------------------+
630 |    | bB |    |    |    |    |    | bR |    |  h
631 +--------------------------------------------+
632 | bL | bN | bS | bG | bK | bG | bS | bN | bL |  i
633 +--------------------------------------------+
634
635
636    Here, "b" stands for "black" and "w" stands for "white", so that,
637 for instance, "bL" means "black lance".  The numbers above the files
638 and the letters to the right of the ranks represent the most common
639 notation system used for shogi by westerners (the Japanese also use
640 Arabic numerals for the files but use Japanese numerals for the ranks).
641
642 \1f
643 File: gnushogi.info,  Node: Promotion of pieces,  Next: Drops,  Prev: The opening setup,  Up: The rules of shogi
644
645 Promotion of pieces
646 -------------------
647
648    In sharp contrast to international chess, where only pawns can
649 promote to higher-ranked pieces, most of the pieces in shogi can
650 promote.  The promoted ranks are discussed in the section on piece
651 moves (*note The moves of the pieces::) but are repeated here for
652 reference:
653
654 Pawn
655      promotes to gold general (called a `tokin' in this case only).
656
657 Lance
658      promotes to gold general.
659
660 Knight
661      promotes to gold general.
662
663 Silver general
664      promotes to gold general.
665
666 Gold general
667      does not promote.
668
669 Bishop
670      promotes to "dragon horse" or just "horse" for short.  The horse
671      can move as a bishop or can move one square in any orthogonal
672      direction.
673
674 Rook
675      promotes to "dragon king" or just "dragon" for short.  The dragon
676      can move as a rook or can move one square in any diagonal
677      direction.
678
679 King
680      does not promote.
681
682
683    The three ranks furthest away from each player constitute his/her
684 "promotion zone".  A player may, but is not required to, promote a
685 piece after making a move in which the piece begins and/or ends in the
686 promotion zone.  Thus you can promote a piece when moving the piece into
687 the promotion zone, out of the promotion zone, or entirely within the
688 promotion zone.  Promotion is mandatory in these cases:
689
690
691   1. You must promote a pawn or a lance after moving it to the last
692      rank.
693
694   2. You must promote a knight after moving it to either of the last
695      two ranks.
696
697
698
699    These forced promotions ensure that a piece cannot be moved to a
700 square from which it would have no further move.
701
702    Pieces "dropped" onto the board (*note Drops::) always drop in the
703 unpromoted state, even if they drop into the promotion zone.
704
705 \1f
706 File: gnushogi.info,  Node: Drops,  Next: Winning the game,  Prev: Promotion of pieces,  Up: The rules of shogi
707
708 Drops
709 -----
710
711    When a player captures a piece, that piece is not removed from play.
712 Instead, it becomes the property of the capturer and can re-enter play
713 by being placed on (almost) any vacant square during the player's move.
714 This is known as a "drop" and counts as a full move (in other words,
715 you can either move a piece on the board or drop a piece onto the board
716 during your move, but not both).  All pieces drop in the unpromoted
717 state.  Pieces may be legally dropped in their promotion zone, but they
718 do not promote on that turn.
719
720    There are several restrictions on drops:
721
722   1. A pawn may not be dropped onto a file if there is already an
723      unpromoted pawn belonging to the same player on that file.  It is
724      legal to drop a pawn on a file which contains a _promoted_ pawn
725      belonging to the same player, however.
726
727   2. A pawn may not be dropped to give immediate checkmate on the move.
728      A pawn is, however, permitted to be moved on the board to give
729      immediate checkmate.  This is a curious rule, and if anyone knows
730      the reason for it I would appreciate it if they would contact me
731      and explain it to me :-)
732
733   3. A pawn or piece may not be dropped onto a square from which they
734      would have no legal move.  This means that pawns and lances may
735      not be dropped onto the last rank, and the knight may not be
736      dropped onto the last or second-to-last rank.
737
738
739    It is entirely permissible (and often advisable) to drop a piece or
740 pawn between one's King and an attacking ranging piece.  For this
741 reason, the final checkmating move is nearly always an attack on the
742 King from an adjacent square (except for an attack by a Knight).
743
744    Captured pieces are said to be pieces "in hand".
745
746    The drop is the primary distinguishing feature of Japanese chess,
747 shared with no other popular chess-type game.  It gives shogi a very
748 aggressive quality, and dramatically increases the number of possible
749 moves once a few pieces have been captured.  Another interesting
750 feature of shogi is that exchanges complicate play rather than
751 simplifying it (as in international chess), because of the drop rule.
752
753 \1f
754 File: gnushogi.info,  Node: Winning the game,  Next: Draws,  Prev: Drops,  Up: The rules of shogi
755
756 Winning the game
757 ----------------
758
759    A game of shogi is won by capturing the opponent's king.  In general,
760 this is done by checkmating the king: attacking the king in such a way
761 that the king cannot be defended no matter what the defending player
762 moves.  Note, though, that there is no rule that requires a player to
763 defend a king which is being attacked.  However, if he does not defend
764 his king, the opponent is entirely free to capture it on the next move,
765 thus winning the game.  As in international chess, in practice most
766 games end by resignation when one player realizes that he cannot escape
767 checkmate.
768
769 \1f
770 File: gnushogi.info,  Node: Draws,  Next: Handicaps,  Prev: Winning the game,  Up: The rules of shogi
771
772 Draws
773 -----
774
775    There are very few draws in shogi; only about 1-2% of professional
776 games end in a draw.  One reason for this is that material can never be
777 depleted as in chess, because captured pieces are constantly re-entering
778 play as a consequence of the drop rule.  In fact, most of the ways a
779 game can be drawn in chess are not allowed in shogi:
780
781
782    * Draws cannot be offered.
783
784    * There is no fifty-move rule.
785
786    * A stalemate counts as a win for the stalemater.  Stated otherwise:
787      if you can't move, you lose.
788
789    * Perpetual check is illegal (see below).
790
791
792
793    There are only two legal ways in which a draw can occur:
794
795
796   1. A position (including the pieces in hand) occurs 4 times with the
797      same player to move (called "Sennichite").  However, if this is
798      caused by consecutive checks (direct attacks on the King,
799      threatening to capture it on the next move) by one side, the
800      player giving these checks loses the game.  In other words,
801      perpetual check results in a loss for the attacker who recreates
802      the same position the 4th time.
803
804   2. Both players have moved their King into the the promotion zone (or
805      they cannot be prevented from doing so) and the Kings cannot be
806      checkmated.  A King who has entered the promotion zone is known as
807      an "entering King"; due to the forward orientation of most shogi
808      pieces, it is very hard to mate such a King.  In that case the
809      players may decide to count their pieces as follows: the King does
810      not count, the Rook and Bishop count as 5 points, and all other
811      pieces as one point.  Promotion is disregarded.  If both players
812      have at least 24 points the game is a draw (called "Jishogi").  If
813      a player has less, he loses the game.
814
815      Of course, a player can refuse to count pieces when he still has
816      mating chances or chances to gain material which would affect the
817      outcome of the counting.  There is no strict rule about what to do
818      if this is not the case, but nonetheless a player refuses to count
819      up (e.g. because he does not have enough points for a draw).  It
820      has been generally accepted that in such a case the game ends and
821      the pieces are counted after one player has managed to get all his
822      pieces protected in the promotion zone.
823
824
825
826 \1f
827 File: gnushogi.info,  Node: Handicaps,  Next: Notes for chess players,  Prev: Draws,  Up: The rules of shogi
828
829 Handicaps
830 ---------
831
832    Unlike international chess, shogi has a well-established handicap
833 system which is used when players of different strengths play against
834 each other.  Handicaps range from small to huge, which makes it
835 possible for weak players to play against even very strong players and
836 have an even chance of winning.
837
838    Shogi players are ranked as follows: the weakest rank is around 15
839 "kyu", which represents a beginner.  14 kyu is higher than 15 kyu, 13
840 kyu is higher still, and so on until you get to 1 kyu.  The next highest
841 rank is 1 "dan", followed by 2 dan, 3 dan and so forth.  The highest
842 amateur rank is 6 dan; professionals go up to 9 dan.  However,
843 professional ranks are not the same as amateur ranks; a professional 1
844 dan is _much_ stronger than an amateur 1 dan.  This system is similar
845 to that used by go players (and also other Japanese sports such as
846 karate).
847
848    A handicap consists of the stronger player playing White and removing
849 one or more pieces from his side of the board at the start of the game.
850 These pieces are permanently removed from play; they are not in hand.
851
852    The following is a list of the accepted handicaps, from weakest to
853 strongest.  The degree of the handicap, represented by the position in
854 the list, represents the difference in rank between the two players for
855 which the handicap is appropriate.  These rules are taken from the books
856 "Shogi for Beginners" by John Fairbairn and "The Art of Shogi" by Tony
857 Hoskings (*note References and links::) and, I believe, represent
858 current Japanese practice.
859
860
861   1. The stronger player removes his left lance (on 1a).
862
863   2. The players play a two-game match; in the first game the stronger
864      player removes his left lance (on 1a), while in the second game he
865      removes his bishop.
866
867   3. The stronger player removes his bishop.
868
869   4. The stronger player removes his rook.
870
871   5. The stronger player removes his rook and left lance.
872
873   6. The players play a two-game match; in the first game the stronger
874      player removes his rook and left lance (on 1a), while in the
875      second game he removes his rook and bishop.
876
877   7. The stronger player removes his rook and bishop.  This is usually
878      called a "two-piece" handicap.
879
880   8. The stronger player removes his rook, bishop, and both lances.
881      This is called a "four-piece" handicap.
882
883   9. The stronger player removes his rook, bishop, both lances, and both
884      knights.  This is called a "six-piece" handicap.
885
886  10. The stronger player removes his rook, bishop, both lances, both
887      knights, and both silvers.  This is called an "eight-piece"
888      handicap.
889
890
891
892    Another advantage of playing handicap games is that the handicaps
893 alter the optimal strategy for both players.  For instance, handicaps
894 all have their own opening lines which may bear little or no
895 resemblance to those used in non-handicap shogi.  This means that when
896 learning handicap shogi, you are essentially learning completely new
897 games which use the same equipment!
898
899    The reader may wonder how on earth a player giving an eight-piece
900 handicap, say, could possibly hope to win.  Don't forget, though, that
901 in shogi the opponent's pieces can be captured and then become part of
902 one's own army.  Thus, if the opponent plays badly enough, the number of
903 pieces will soon even out.
904
905 \1f
906 File: gnushogi.info,  Node: Notes for chess players,  Prev: Handicaps,  Up: The rules of shogi
907
908 Notes for chess players
909 -----------------------
910
911    Here are a few miscellaneous things that may confuse chess players.
912 Some of these have been mentioned elsewhere, but they bear repeating.
913
914
915   1. There is no queen.
916
917   2. Pawns capture the same way they move.  There is no initial
918      two-space pawn move and no _en-passant_ move.
919
920   3. There is no special castling move.  There _are_ a large number of
921      possible defensive formations referred to as "castles" (*note
922      Sample game::) but there is no need for special moves to create
923      them.
924
925   4. A given piece can only promote to _one_ other kind of piece.
926
927
928
929 \1f
930 File: gnushogi.info,  Node: Sample game,  Next: Mating problems,  Prev: The rules of shogi,  Up: About shogi
931
932 Sample game
933 ===========
934
935    This game was annotated by Pieter Stouten (*note References and
936 links::).  I have made some minor corrections.  Note that captures are
937 denoted by the "x" symbol e.g. Rx3f and drops are denoted by the "*"
938 symbol e.g. R*3f.  Check is indicated by a "+" after the move, e.g.
939 R3f+.  I recommend you use gnushogi/xshogi to play along with this
940 game.  In xshogi simply hit the "Force Moves" button after starting up,
941 while in gnushogi enter the word "force" at the prompt.  This will
942 allow you to enter moves for both sides.
943
944    Note also that the move numbering system used here is the chess-type
945 system where one move means one move by each player.  The Japanese count
946 one move made by each player as two moves.
947
948 --------------------------------------------------------------------------
949
950    Below you will find (the English translation of) an annotated game
951 which was published in the Dutch Shogi magazine "81" and in the Dutch
952 beginners booklet.  It has proven to be a very useful game to explain
953 some basic principles of Shogi.  Also, it is a rather straightforward
954 game compared to professional games where in most cases very diffuse
955 middle game fights take place.
956
957    Pieter Stouten, 14th May 1990.
958
959 --------------------------------------------------------------------------
960
961    Black: Michael Trent (1-dan).  White: David Murphy (2-dan).
962
963    1. P2f P3d  2. P2e B3c
964 [ This move is necessary, as otherwise white can exchange pawns: 3. P2d
965 Px2d 4. Rx2d.  He would thus get a pawn in hand and open up his rook
966 file. ]
967
968    3. P7f P4d
969 [ White closes the bishop diagonal again.  He plans to play ranging rook
970 (the rook goes to 5b, 4b, 3 or 2b; a defensive strategy) and in that
971 case he'd better avoid an exchange of bishops.  One of the reasons is
972 that he will have problems developing his pieces without leaving holes
973 for bishop drops. ]
974
975    4. S4h R3b  5. P3f S4b  6. K6h K6b
976 [ In general the rook plays an important role in the attacks.  It is
977 wise to move the king away from the area where the initial fights will
978 be and both players act according to the Shogi proverb "keep the rook
979 and king apart". ]
980
981    7. K7h K7b  8. P5f P5d  9. G4i-5h G4a-5b
982 [ Both players use their second gold general to build their castle. ]
983
984    10. S6h
985 [ In itself this move is not bad.  However, it will become clear that
986 black plans a quick attack and in that case it is wiser to omit this
987 move. ]
988
989    10... S5c  11. P1f P1d
990 [ The advance of the edge pawns must be timed very well.  The remark at
991 black's tenth move applies here too: this move is good if black wants to
992 play a slow game, because it eliminates a future B1e. ]
993
994    12. P4f K8b  13. N3g S7b
995 [ Black develops his knight in order to start an attack over the second,
996 third and fourth files.  White strengthens his king's position and
997 awaits the attack.  He aims at a counterattack as soon as black has
998 broken through into the white camp.  Probably white's breakthrough will
999 take place later, but he has good compensation in the form of a stronger
1000 castle.  This theme occurs very often in static rook versus ranging rook
1001 games. ]
1002
1003    14. P4e R4b
1004 [ Black starts his attack and white puts up a very passive defence.  His
1005 rook has a hard task now to penetrate the black position.  Moreover, he
1006 blocks his own bishop.  It seems much better to start a counterattack
1007 with 14... P3e, later to be followed by B2b, B5a or Bx4d in order to use
1008 his rook more actively. ]
1009
1010    15. Px4d Sx4d  16. P*4e S5c
1011 [ 16... Sx4e is more active.  A silver general is normally more valuable
1012 than a knight, but white gets two pawns in hand and black none, while
1013 the knight might come in handy for white too. ]
1014
1015    17. Bx3c+ Nx3c  18. P2d Px2d
1016 [ Black threatens to break through and white has to consider taking the
1017 pawn on 2d or starting a counterattack with Nx4e.  If he chooses the
1018 latter, black can play Px2c+ followed by +P3c.  The disadvantage is the
1019 black "tokin" (=promoted pawn) that white will get in his camp; the
1020 advantage is that it will cost black two more moves to promote his rook.
1021 Because white did not trust that the result after engaging in a
1022 "semeai" (=mutual attack) with 18...Nx4e would give a positive result,
1023 he captured the pawn on 2d.  Making the right decision in moments like
1024 this often makes the difference between a win and a loss: miss one
1025 attacking chance and you will be forced to defend the whole game until
1026 the unavoidable defeat; on the other hand, an unsound attack can destroy
1027 all "aji" (=potential, meaning possibilities, threats) without getting
1028 anything in return. ]
1029
1030    19. Rx2d Nx4e  20. Nx4e Rx4e  21. R2a+ P*4g
1031 [ Now it becomes clear why black's 10. S6h was not good.  Had this move
1032 been omitted, then white would not have had the time to play 13... S7b
1033 and after R2a+ the gold on 6a would hang.  Thus black would have kept
1034 "sente" (=initiative).  Instead of 21... P*4g, B*6d is a very good
1035 move, because after 22. P*2h black does not have a pawn in hand anymore
1036 and he is being threatened with the annoying 22... N*4f 23. G5g N3h+
1037 24. S4g +N4h also.  Black can also counter 21... B*6d with 22. N*3g.
1038 White would then reply with 22... R4b 23. B*3c P*4g 24. Bx4b+ Sx4b.  The
1039 white rook has played its role and instead of spending moves on saving
1040 it white starts to scatter black's defences by successive pawn drops on
1041 the fourth file: 25. Gx4g P*4f 26. G5g N*6e 27. G5h P4g+ 28. Gx4g P*4f.
1042 This analysis was provided by Kato Hifumi, 9-dan professional (the
1043 highest regular grade).  Destroying the coherence of the enemy pieces
1044 (their shape) by dropping pawns is one of the most important Shogi
1045 techniques.  With the actual move 21... P*4g white missed a good
1046 chance. ]
1047
1048    22. Sx4g P*4f  23. B*3g Px4g+  24. +Rx6a +Px3g
1049 [ 23. B*3g seems pointless, but a closer look reveals that it is
1050 actually quite mean.  On move 24 white cannot capture black's "Ryu"
1051 (=dragon =promoted rook) with his silver: 24... Sx6a 25. N*7d K7b 26.
1052 G*8b mate.  By attacking the front of the white castle and threatening
1053 to mate him there, black has the chance to break down the white
1054 defences from the side. ]
1055
1056    25. +Rx5b S*6b
1057 [ Here 25... B*4d would be much better, because it is defensive and
1058 attacking at the same time.  After e.g. 26. G*4c Bx9i+ 27. Gx5c black
1059 threatens 28. +Rx7b Kx7b 29. S*6a K8b 30. S*7a Kx7a 31. G*7b mate.
1060 White is one move quicker, however.  He has the following beautiful
1061 "tsume" (mating sequence where every move is check): 27... N*8f 28. Px8f
1062 S*8g 29. Kx8g B*9h 30. K7h Bx8i+ 31. K8g +B8i-8h 32. K9f L*9e mate.
1063 This illustrates the sharpness of Shogi: one move can make the
1064 difference between winning and losing. ]
1065
1066    26. P*4f Rx4f
1067 [ This move eliminates white's last chances.  26... R4b 27. +Rx4b Sx4b
1068 28. R*4a seems annoying, but after 28... B*3c 29. S7g B*3b white wins
1069 the rook and with his "tokin" on 3g there still is some hope. ]
1070
1071    27. N*6e +P4g
1072 [ White cannot defend anymore, so he starts a desperate attack.  Black
1073 does not lose the right track, however. ]
1074
1075    28. Nx5c+ +Px5h  29. +Nx6b +Px6h  30. Gx6h N*8f  31. Px8f B*6i  32.
1076 Gx6i    R4h+  33. N*6h +Rx6h  34. Gx6h S*8g  35. Kx8g N*9e  36. K7h
1077 Resigns
1078 [ White resigns here, because after 36... B*8g 27. K7g his attack has
1079 petered out. ]
1080