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