[fairymax] 01/07: New upstream version 5.0b

Vincent Legout vlegout at moszumanska.debian.org
Fri Nov 11 10:37:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

vlegout pushed a commit to branch master
in repository fairymax.

commit 4f17b44bbecb5044f3187fefade372b5dc7d0766
Author: Vincent Legout <vincent at legout.info>
Date:   Fri Nov 11 08:59:38 2016 +0100

    New upstream version 5.0b
---
 Makefile             |  67 +++---
 changelog            | 125 +++++++++++
 data/fairymax.eng    |   3 +
 data/fmax.ini        | 579 ++++++++++++++++++++++++++++++++++++++++++---------
 data/logo.png        | Bin 0 -> 9457 bytes
 data/makruk.hash     |  48 +++++
 data/maxqi.eng       |   3 +
 data/shamax.eng      |   3 +
 fairymax.c           | 395 ++++++++++++++++++++++-------------
 fairymax.pod         |  81 +++++--
 windows/elephant.ico | Bin 0 -> 2238 bytes
 windows/fmax.rc      |   1 +
 windows/fres.o       | Bin 0 -> 2522 bytes
 13 files changed, 1019 insertions(+), 286 deletions(-)

diff --git a/Makefile b/Makefile
index ef2cc0a..0e659cf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,38 +1,46 @@
 srcdir = .
+prefix = /usr/local
+bindir = $(prefix)/bin
+mandir = $(prefix)/share/man
+datadir = $(prefix)/share
+plugindir = $(datadir)/games/plugins
+fairydir = $(datadir)/games/fairymax
 
 CC?=gcc
 CFLAGS?= -O2 -s
-INI_F?=$(DESTDIR)/usr/share/games/fairymax/fmax.ini
-INI_Q?=$(DESTDIR)/usr/share/games/fairymax/qmax.ini
-
+INI_Q?=$(fairydir)/qmax.ini
+VERSION?=`grep 'define VERSION' fairymax.c | sed -e 's/.*"\(.*\)".*/\1/'`
 
 ALL= fairymax shamax maxqi fairymax.6.gz
 
 all: ${ALL}
 
 fairymax: fairymax.c
-	$(CC) $(CFLAGS) -DINI_FILE=\"${INI_F}\" fairymax.c -o fairymax
+	$(CC) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -DFAIRYDIR=\"${fairydir}\" fairymax.c -o fairymax
 
 shamax: fairymax.c
-	$(CC) $(CFLAGS) -DINI_FILE=\"${INI_F}\" -DSHATRANJ fairymax.c -o shamax
+	$(CC) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -DFAIRYDIR=\"${fairydir}\" -DSHATRANJ fairymax.c -o shamax
 
 maxqi: maxqi.c
-	$(CC) $(CFLAGS) -DINI_FILE=\"${INI_Q}\" maxqi.c -o maxqi
+	$(CC) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -DINI_FILE=\"${INI_Q}\" maxqi.c -o maxqi
 
 install: ${ALL} ${srcdir}/data/*
-	cp -u ${srcdir}/fairymax $(DESTDIR)/usr/games
-	cp -u ${srcdir}/shamax $(DESTDIR)/usr/games
-	cp -u ${srcdir}/maxqi $(DESTDIR)/usr/games
-	install -d -m0755 $(DESTDIR)/usr/share/games/fairymax
-	cp -u ${srcdir}/data/* $(DESTDIR)/usr/share/games/fairymax
-	install -d -m0755 $(DESTDIR)/usr/share/man/man6
-	cp -u ${srcdir}/fairymax.6.gz $(DESTDIR)/usr/share/man/man6
+	install -d -m0755 $(DESTDIR)$(bindir)
+	cp ${srcdir}/fairymax ${srcdir}/shamax ${srcdir}/maxqi $(DESTDIR)$(bindir)
+	install -d -m0755 $(DESTDIR)$(fairydir)
+	cp ${srcdir}/data/*.ini $(DESTDIR)$(fairydir)
+	cp ${srcdir}/data/*.hash $(DESTDIR)$(fairydir)
+	install -d -m0755 $(DESTDIR)$(mandir)/man6
+	cp ${srcdir}/fairymax.6.gz $(DESTDIR)$(mandir)/man6
+	install -d -m0755 $(DESTDIR)$(plugindir)/logos
+	cp ${srcdir}/data/logo.png $(DESTDIR)$(plugindir)/logos/fairymax.png
+	cp ${srcdir}/data/logo.png $(DESTDIR)$(plugindir)/logos/shamax.png
+	cp ${srcdir}/data/logo.png $(DESTDIR)$(plugindir)/logos/maxqi.png
+	install -d -m0755 $(DESTDIR)$(plugindir)/xboard
+	cp ${srcdir}/data/*.eng $(DESTDIR)$(plugindir)/xboard
 
 fairymax.6.gz: fairymax.pod
-	pod2man -s 6 fairymax.pod > fmax.man
-	cp fmax.man fairymax.6
-	rm -f fairymax.6.gz
-	gzip fairymax.6
+	pod2man -s 6 fairymax.pod | gzip -9n > fairymax.6.gz
 
 clean:
 	rm -f ${ALL}
@@ -40,25 +48,32 @@ clean:
 dist-clean:
 	rm -f ${ALL} *~ data/*~ *.man md5sums
 
-dist:
+dist: fairymax
 	install -d -m0755 Fairy-Max
 	install -d -m0755 Fairy-Max/data
 	rm -f fairymax.tar fairymax.tar.gz
 	cp fairymax.c maxqi.c fairymax.pod Makefile README changelog copyright Fairy-Max
 	cp data/* Fairy-Max/data
 	(md5sum Fairy-Max/* Fairy-Max/data/* > Fairy-Max/md5sums) || true
-	tar -cvvf fairymax.tar Fairy-Max
-	gzip fairymax.tar
+	tar -cvvf fairymax-$(VERSION).tar Fairy-Max
+	gzip fairymax-$(VERSION).tar
+	rm fairymax
 	rm Fairy-Max/data/*
 	rmdir Fairy-Max/data
 	rm Fairy-Max/*
 	rmdir Fairy-Max
 
 uninstall:
-	rm -f $(DESTDIR)/usr/share/games/fairymax/*
-	rmdir $(DESTDIR)/usr/share/games/fairymax
-	rm -f $(DESTDIR)/usr/share/man/man6/fairymax.6.gz
-	rm -f $(DESTDIR)/usr/games/fairymax
-	rm -f $(DESTDIR)/usr/games/shamax
-	rm -f $(DESTDIR)/usr/games/maxqi
+	rm -f $(DESTDIR)$(plugindir)/logos/fairymax.png
+	rm -f $(DESTDIR)$(plugindir)/logos/shamax.png
+	rm -f $(DESTDIR)$(plugindir)/logos/maxqi.png
+	rm -f $(DESTDIR)$(plugindir)/xboard/fairymax.eng
+	rm -f $(DESTDIR)$(plugindir)/xboard/shamax.eng
+	rm -f $(DESTDIR)$(plugindir)/xboard/maxqi.eng
+	rm -f $(DESTDIR)$(fairydir)/*
+	rmdir $(DESTDIR)$(fairydir)
+	rm -f $(DESTDIR)$(mandir)/man6/fairymax.6.gz
+	rm -f $(DESTDIR)$(bindir)/fairymax
+	rm -f $(DESTDIR)$(bindir)/shamax
+	rm -f $(DESTDIR)$(bindir)/maxqi
 
diff --git a/changelog b/changelog
index dcae037..29fe750 100644
--- a/changelog
+++ b/changelog
@@ -119,4 +119,129 @@
           Some game definitions using the Remarkable Rookies army (which
           uses a range-4 Rook) have been added as sub-variants of fairy.
 
+8/9/2014  Version 4.8T. Three bug fixes, some enhancements, two new variants:
+          * mark Rook non-virgin after castling, so it cannot gate in Seirawan
+          * Fix printing of variants feature in MaxQi
+          * Sending the setup command now also works with 3rd-rank Pawns
+          * Allow sending a parent variant with 'setup'
+          * Implement new method for indicating promo-zone width = 3
+          * Implement new variant nocastle
+          * Implement new variant ASEAN Chess
+          * Add option to play Makruk with Ai-Wok in stead of Met
 
+17/10/2014 Version 4.8U. Four new variants were added:
+          * Charge of the Light Brigade
+          * King of the Hill
+          * Bifurcator Chess
+          * Team-Mate Chess
+          General game-playing enhancements:
+          * Hoppers can now be specified as hopping over friendly pieces
+          only, and the point where the second move leg starts can be
+          moved to the step just before hitting the platform.
+          * Sliders will now toggle to their secondary move only once,
+          allowing bent riders at the expense of crooked ones.
+          * Code is added to recognize the situation 'bare King', and
+          give higher award for cornering it in that case, to make mating
+          with many weak pieces (as regularly occurs in Makruk) easier.
+          * When a mate of the bare King in one corner cannot be found,
+          points will be awarded to drive the King out of that corner to
+          another one, allowing it to successfully perform KBNK-like mates.
+          * Make it possible to mark pieces as invalid promotion choice
+          Embracement of new standards:
+          * Add logo, and install it according to new 'plugin standard'
+          * Install a (new) .eng file to comply with the plugin standard
+          * Issue the (new) XBoard 'piece' command for all non-standard pieces
+          New options:
+          * Fifty-move claiming can be adapted to the need of the variant
+          * A comment line can now be displayed with each variant through
+          an 'Info' button in the engine options
+          Bugfixes, two of fatal bugs:
+          * Fix printing of Seirawan gating moves
+          * Correct the moves of the Marshal in the Rookies army of CWDA
+          * suppress emission of a spurious (garbled) setup command at startup
+          * Fix positioning of Pawns in ASEAN Chess in setup command
+
+22/10/2014 Version 4.8V. Bugfix release for 4.8U:
+          * Fixes null move, which was broken by the bare King patch, as that
+          always set material (R) to 4, not just when bare King was detected.
+
+26/1/2016 Version 5.0a
+          A rather drastic enhancement of the general capabilities:
+          * Analyze mode is supported, meaning arrival of input is tested
+          during search. Both Linux and Windows code was added for this
+          * Move exclusion during analysis is supported (feature exclude=1)
+          * The number of board ranks is no longer fixed at 8, but can have
+          any value up to 16. This required the promotion 'upgrade' to come
+          from a table pt[], rather than being derived from rank number
+          through a hard-coded expression
+          * The promotion code now uses the true value of promotion pieces in
+          the search, rather than assuming Q and correcting it at game level
+          * Pawns can start on other ranks than the 2nd, and would normally
+          start at the edge of the promotion zone as indicated by the =N
+          suffix to the board size in the ini file
+          * A negative N in the =N suffix now does affect on which rank the
+          Pawns are placed, but leaved the promotion zone depth at 1 rank
+          * A spin-off of the table-driven promotion is that the promotion
+          piece can be made file-dependent. This is currently used to set
+          the choice to the piece that starts on that square, as a side
+          effect of starting the Pawns on 4th rank
+          * Initial triple pushes of Pawns can be e.p. captured on both
+          skipped squares on 10-rank boards, when they are specified as
+          first move on the white Pawn
+          * It is possible to define on Pawns a move that is both an
+          initial triple push as well as a double push when advanced only
+          one square. This uses the code that normally would be a 5-push
+          * Any pair of royals will now be subject to the procedure of
+          bare-King detection, and increase of its centralization weight,
+          rather than just piece 3 and 4. This makes it easier to order
+          the Kings last, for better LVA move sorting
+          * Stalemate can be configured as a win, currently triggered by
+          defining value -2 for the 9th piece (which then is a royal)
+          * The castling-through-check test now can test more than the
+          3 squares starting at the King from-square, and really tests
+          upto the square next to the King destination. This would work
+          for castlings of any King stride >= 2
+          * The castling emptiness test now works for strides up to 4,
+          on boards of any width (was 3, and flaky for K-side 10-wide)
+          * Repetition detection now also is done inside the tree,
+          making it possible to plan for sacrificial perpetuals
+          * Bare-King checkmating is improved, by clearing the hash
+          table after every move (except mate scores and game history).
+          * The case with color-bound pieces is now handled by changing
+          the centralization table as soon as the bare King visits
+          a corner square into one that penalizes only the adjacent
+          two corners
+          * Against bare King all reductions are switched off, and a new
+          2-ply extension is granted on a bare King leaving a corner.
+          This speeds up finding corner mates.
+          * A variant-specific file is used to pre-charge the hash table
+          with positions that are protected from overwrite. A file for
+          Makruk to help recognizing some difficult mates is included
+          in the install
+          * New engine-defined options 'Save in hash file' (button) and
+          'Automatic persistent-hash dialog' (checkbox) can be used to
+          add positions to this persistent hash file.
+          * moves with bent trajectories can now be defined in the ini
+          file by adding the desired secondary step as third parameter
+          * clear hash on null-move switch, rather than spoiling the key
+
+          These enhancements have made it possible to add many new
+          variants, all out of reach before:
+          * Los-Alamos Chess (6x6 without Bishops)
+          * Janus Chess (10x8 with two Archbishops, stride-4 castling)
+          * Roman Chess (10x10, with two Commoners)
+          * Mexican Chess (10x10 with 2 Camels and Pawn triple-push)
+          * Ciccolini's Chess (10x10 with Adjutants (BDD) and Zebras)
+          * Grande Acedrex (12x12, game from 1283AD with bent sliders)
+          * almost-Wildebeest (11x10, with Gnu and 2 Camels)
+
+17/2/2016 Version 5.0b
+          Mostly bug-fixes, and some small interface improvements:
+          * Input of Makruk promotion moves (broken by 5.0a) fixed
+          * Fix false game repetitions from undo messing up game history
+          * Fix dropping out of analysis mode in checkmate position
+          * Improve game-phase definition to prevent King chasing
+          * Grand Acedrex piece values set to encourage Zebra promotion
+          * Randomization obeys 'random' command, suppressed in analysis
+          * Print mate scores according to new CECP standard
+          * pieceToChar strings adapted to new XBoard piece order
diff --git a/data/fairymax.eng b/data/fairymax.eng
new file mode 100644
index 0000000..2157426
--- /dev/null
+++ b/data/fairymax.eng
@@ -0,0 +1,3 @@
+plugin spec 0.0
+fairymax
+chess,capablanca,seirawan,fairychess,shatranj,asean
diff --git a/data/fmax.ini b/data/fmax.ini
index 514f47c..0025ff3 100644
--- a/data/fmax.ini
+++ b/data/fmax.ini
@@ -73,13 +73,17 @@ b:150 14,7 18,7 -31,7 -33,7
 
 SEPARATE CAPTURES / NON-CAPTURES
 White Pawn:
-p:100 -16,6 -15,5 -17,5 -16,24
+p:100 -16,24 -16,6 -15,5 -17,5
 White Pawn (Shatranj, no double move):
 p:100 -16,6 -15,5 -17,5
 White Berolina Pawn
 p:74 -15,24 -17,24 -16,5 -15,6 -17,6 
 Black Pawn:
-p:100 16,6 15,5 17,5 16,24
+p:100 16,24 16,6 15,5 17,5
+Black Pawn with initial triple- and double-push (Mexican Chess)
+p:100 14,424 16,24 16,6 15,5 17,5
+Black Pawn with initial triple- and double-push, and double-push on 3rd rank (Wildebeest Chess)
+p:100 14,C24 16,24 16,6 15,5 17,5
 Pegasus (moves as Queen, captures as Rook):
 S:500 1,2 16,2 15,2 17,2 -1,2 -16,2 -15,2 -17,2 14,5 31,5 33,5 18,5 -14,5 -31,5 -33,5 -18,5
 Keen (moves as King, captures as Queen):
@@ -108,8 +112,6 @@ Canvasser:
 C:900 1,3 16,3 -1,3 -16,3 13,7 47,7 49,7 19,7 -13,7 -47,7 -49,7 -19,7
 Amazon:
 A:1150 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
-Crooked Bishop:
-B:900 15,1E003 17,1E003 -15,1E003 -17,1E003 15,FFFE0003 -17,FFFE0003 -15,FFFE0003 17,FFFE0003
 
 HOPPERS
 GrassHopper:
@@ -117,6 +119,16 @@ G:200 1,F8 16,F8 15,F8 17,F8 -1,F8 -16,F8 -15,F8 -17,F8
 Cannon:
 C:400 1,BA 16,BA -1,BA -16,BA
 
+BIFURCATORS
+Dimachaer:
+D:300 16,14B8 16,1F4B8 -16,14B8 -16,1F4B8 1,104B8 1,FFFF04B8 -1,104B8 -1,FFFF04B8
+Secutor:
+S:300 16,14BA 16,1F4BA -16,14BA -16,1F4BA 1,104BA 1,FFFF04BA -1,104BA -1,FFFF04BA
+Provocator:
+V:830 17,14B8 15,1F4B8 -15,14B8 -17,1F4B8 17,104B8 -15,FFFF04B8 -17,104B8 15,FFFF04B8
+Murmillo:
+M:830 17,14BA 15,1F4BA -15,14BA -17,1F4BA 17,104BA -15,FFFF04BA -17,104BA 15,FFFF04BA
+
 LAME LEAPERS
 Horse:
 N:5 16,1070 16,1F070 1,10070 1,FFFF0070 -16,1070 -16,1F070 -1,10070 -1,FFFF0070
@@ -126,9 +138,18 @@ E:1 15,70 17,70 -15,70 -17,70
 LIMITED-RANGE SLIDERS
 R3 (range-3 Rook):
 D:375 1,443 16,443 -1,443 -16,443
+R4 (range-3 Rook):
+D:425 1,843 16,843 -1,843 -16,843
+R5 (range-3 Rook):
+D:450 1,C43 16,C43 -1,C43 -16,C43
 B4 (range-4 Bishop):
 A:300 15,843 17,843 -15,843 -17,843
 
+BENT SLIDERS
+Griffon:
+G:830 17,1003 15,1F003 -15,1003 -17,1F003 17,10003 -15,FFFF0003 -17,10003 15,FFFF0003
+Aanca:
+A:780 16,1003 16,1F003 -16,1003 -16,1F003 1,10003 1,FFFF0003 -1,10003 -1,FFFF0003
 
 
 Syntax of a variant description:
@@ -136,20 +157,34 @@ Syntax of a variant description:
 Each variant starts with the label "Game:" followed by the variant name.
 After that follow upto 18 lines with the description.
 
-Line 1:     Board size (files x ranks). Ranks must currently still be 8.
+Line 1:     Board size (files x ranks), optionally folowed by zone depth.
 Line 2:     initial setup of white pieces on back rank
 Line 3:     initial setup of black pieces on back rank
 Line 4-18:  Description of piece types that can occur in the variant
+This can be followed by some optional info to be sent to GUI when it
+selects the variant, e.g. to tell it how some non-standard pieces move.
+
+The board size can run upto 16-L x 16, where L is the largest lateral leap
+of any piece. It can be suffixed with =N where the number N then indicates
+the depth of the promotion zone (which normally is just the last rank).
+Currently only n=3 is understood, and Pawns also start on 3rd rank then.
+A negative N leaves the zone at 1 rank, but puts the Pawns on the (1-N)th
+rank;
 
 There can be upto 15 piece types per variant, numbered 1 to 15.
 Numbers 1 and 2 are considered Pawns for white and black, respectively,
-and the 2nd and 7th rank of the opening setup will be filled with them.
+and the one rank of the opening setup will be filled with them.
 These pieces will automatically promote to piece number 7 when they 
-reach last rank. So in normal Chess, piece 7 should be programmed as Queen.
-There is one exception to this: if the initial setup does have a white
-piece 7, but not a black one, and black has a piece number 9, then
+reach the promotion zone. So in normal Chess, piece 7 should be programmed
+as Queen. There is an exception to this: if the initial setup does have
+a white piece 7, but not a black one, and black has a piece number 9, then
 black will always promote to the latter. (This can be useful in variants
-with different armies for black and white).
+with different armies for black and white). Currently, when the Pawns are
+configured to start on 4th rank, promotion will be to the piece that
+started on the promotion square in the initial setup, except for the King
+square, where it promotes to the piece on the a-side of it; future Fairy-
+Max versions might get a way to enable this feature independent from Pawn
+location. (But for now only Grande Acedrex needed this feature.)
 
 Castling can be done only with the original corner piece as specified
 by line 2 and 3. Any piece can in principle castle. (Subject to 
@@ -158,9 +193,16 @@ If you don't want that, remove the castling moves from the King description.
 If the castling initiator does not start in a central file, the results are 
 currently undefined.
 
+The variant name can be suffixed with some info to be sent to the GUI
+as a 'setup' command, behind a # character. In particular the piece-
+to-character table to define which symbols the GUI should use for
+the various pieces, and (after another #) the 'parent' variant.
+
 Most variant definitions can be seen at the end of this file.
 Other lines in this file (i.e. those not recognized as belonging to a
 variant description) are ignored. They can be used for comments.
+Fairy-Max' 'Info' option makes the GUI display the text of the comment
+line starting with '//' just before the start of the definition.
 
 
 
@@ -171,14 +213,17 @@ The piece-description lines have the following syntax:
 2) a colon
 3) the internal value to be used for the piece (in centiPawn; Royal = -1)
 4) for each direction it moves in, a ray descriptor consisting of:
-   a) the initial step vector (on a 16x8 board, so 16 = straight ahead)
+   a) the initial step vector (on a 16xN board, so 16 = straight ahead)
    b) a comma
    c) the move-mode descriptor, given in hexadecimal, as the
       individual bits specify the various options
+   optionally followed by
+   d) a comma
+   e) a secondary step vector
 
 The piece indicator character is used to set up positions, and for the
-promotion choice as 5th character of an input move. (Fairy-Max itself
-always promotes to "Queen", i.e. the 7th piece of the list.)
+promotion choice as extra character at the end of an input move. (Fairy-
+Max itself always promotes to "Queen", i.e. the 7th piece of the list.)
 If more pieces use the same letter, the first one is used for white,
 and the last one for black. If more than two have the same name, the 
 others cannot be indicated at all, but they could still occur in the
@@ -191,9 +236,13 @@ value assumed for them will be the absolute value of what you defined.
 With a value -1, however, loss of the first piece of that type loses the game.
 For royal piece types larger than 7 there is the special rule that it is not
 allowed to leave more than one of them under attack ('duple check').
+A royal value of -2 is currently used as a kludge to enable an alternative
+winning condition, namely when the royal piece reaches (and survives in)
+one of the four central squares.
 
-NOTE: piece value 181 for piece 7 is reserved for Makruk, and enables
-promotion on the 6th rank. Do not use it in other variants.
+NOTE: Any piece with a value that (in decimal notation) ends in '3' will
+not be  accepted as promotion choice. (And neither will be absolute royalty,
+i.e. piece value -1).
 
 The individual bits in the move-mode descriptor have the following meaning:
 In the last hexadecimal digit:
@@ -203,7 +252,7 @@ In the last hexadecimal digit:
     8 hop over non-empty square (normally occupied squares terminate a move)
 Bits set in the forelast digits TOGGLE the corresponding bits in the last
 digit. For hoppers when they hop over something, for the other pieces after
-every step (so for normal pieces, better not set those bits!).
+one to four steps (so for normal pieces, better not set those bits!).
 
 The digit before that indicates some special things; a 1 indicates the 
 board should be treated as a cylinder, pieces crossing the right edge 
@@ -211,12 +260,19 @@ re-entering the board at the left, and vice versa. The 2 bit indicates
 the move is a multi-path move, only used for the Falcon in Falcon Chess.
 The upper two bits (4 and 8) form a two-bit count, indicating how many
 steps the first toggle of the move mode of a slider should be postponed
-(4 = 1 step, 8 = 2 steps, C = 3 step). This can be used to define
+(4 = 1 step, 8 = 2 steps, C = 3 steps). This can be used to define
 'limited range' sliders or lame leapers skipping over several squares.
+For a hopper these bits have a different meaning: 8 indicates the
+hop can only be taken over a friendly piece, and 4 that the toggle
+to the second leg should be taken one step before the obstacle,
+rather than on top of it (for implementing colliding bifurators).
 
 The higher-order bits toggle corresponding bits in the step vector,
-to allow zig-zag paths. Better not set those either, if a straight
-path is desired.
+to allow bent paths. They should not be set explicitly; if a different
+step for the second part of the trajectory is required, it can be
+specified after a second comma, and Fairy-Max will calculate from this
+how to set the high-order toggle bits. In absence of a secondary step
+the latter will be assumed to be equal to the initial step. 
 
 Useful bit combinations for the last digit are:
     3   normal slider
@@ -231,19 +287,6 @@ Useful bit combinations for the last digit are:
     A   non-capture before hop (1st part of Cannon move)
     C   must hop immediately
 
-For example, if the initial step vector equals 1, and the descriptor
-is 11003, the piece is an alternator (as no hop bit is set), and alternates
-the mode from 3 to 3 (as the toggle digit is 0), i.e. all steps are moves
-that can both capture and non-capture, and only captures terminate the ray.
-The step vector is toggled by 11, though, and thus alternates between 1
-and 10 (hex) = 16. So the piece zig-zags over the board, right, forward, right,
-forward, etc. Had the move attributes been 11032, captures would only
-be allowed on the odd steps (after moving right), while the even steps could
-only be non-captures (both the 1 and 2 bit are toggled). With 11030 the
-odd steps can only be skipped (if empty), and the even steps can both capture
-and non-capture, meaning the piece moves like a Bishop that can be blocked
-by a piece just next to the diagonal.
-
 If the first step is a slider, a second step is made (if the square was
 empty), but if the mode toggles to leaper, the move stops there (e.g. Horse).
 
@@ -280,16 +323,17 @@ For the truly lazy, a few complete game descriptions can be found below:
 // FIDE Chess (a.k.a. Mad Queen variant)
 Game: normal
 8x8
-6 4 5 7 3 5 4 6
-6 4 5 7 3 5 4 6
+8 5 6 9 3 6 5 8
+8 5 6 9 4 6 5 8
 p:74 -16,24 -16,6 -15,5 -17,5 
 p:74  16,24 16,6 15,5 17,5
 k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
 n:259 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 b:296 15,3 17,3 -15,3 -17,3
-R:444 1,3 16,3 -1,3 -16,3
 Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
-f:481 13,FFFFF207 29,F207 46,F207 47,10207 49,10207 50,11207 35,11207 19,1207 -13,1207 -29,FFFF1207 -46,FFFF1207 -47,FFFF0207 -49,FFFF0207 -50,FFFEF207 -35,FFFEF207 -19,FFFFF207 
+R:444 1,3 16,3 -1,3 -16,3
+S:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 
 // Chess without castling (intended as shuffle variant)
 Game: nocastle
@@ -304,7 +348,7 @@ b:296 15,3 17,3 -15,3 -17,3
 R:444 1,3 16,3 -1,3 -16,3
 Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 
-// Arabic precursor of modern Chess
+// Arabic precursor of modern Chess, with weak Queen and Bishops
 Game: shatranj
 8x8
 6 4 5 3 7 5 4 6
@@ -319,38 +363,36 @@ q:180 15,7 17,7 -15,7 -17,7
 e:110 30,7 34,7 -30,7 -34,7
 f:180 15,7 17,7 -15,7 -17,7
 
-// ASEAN Chess. New form of Makruk
+// ASEAN Chess. New form of Makruk, with promotion of 8th rank only
 Game: asean
-8x8
-12 11 8 7 3 8 11 12
-12 11 9 7 3 9 11 12
+8x8=-2
+7 6 4 3 8 4 6 7
+7 6 5 3 9 5 6 7
 p:100 -16,6 -15,5 -17,5 
 p:100 16,6 15,5 17,5
-k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
-f:180 15,7 17,7 -15,7 -17,7
-m:180 15,7 17,7 -15,7 -17,7
-s:300 15,7 17,7 -15,7 -17,7 -16,7
 q:180 15,7 17,7 -15,7 -17,7
 b:300 15,7 17,7 -15,7 -17,7 -16,7
 b:300 15,7 17,7 -15,7 -17,7 16,7
-s:300 15,7 17,7 -15,7 -17,7 16,7
 n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 R:630 1,3 16,3 -1,3 -16,3
+k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
 
-// Thai Chess.
+// Thai Chess. Pawns promote on reaching 6th rank!
 Game: makruk
 8x8=3
-12 11 8 3 7 8 11 12
-12 11 9 7 3 9 11 12
+13 12 8 3 7 8 12 13
+13 12 9 7 4 9 12 13
 p:100 -16,6 -15,5 -17,5 
 p:100 16,6 15,5 17,5
 k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
 f:181 15,7 17,7 -15,7 -17,7
 q:181 15,7 17,7 -15,7 -17,7
-b:300 15,7 17,7 -15,7 -17,7 -16,7
 m:181 15,7 17,7 -15,7 -17,7
 s:300 15,7 17,7 -15,7 -17,7 -16,7
 s:300 15,7 17,7 -15,7 -17,7 16,7
+b:300 15,7 17,7 -15,7 -17,7 -16,7
 b:300 15,7 17,7 -15,7 -17,7 16,7
 n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 R:630 1,3 16,3 -1,3 -16,3
@@ -373,8 +415,11 @@ b:300 15,7 17,7 -15,7 -17,7 -16,7
 b:300 15,7 17,7 -15,7 -17,7 16,7
 n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 R:630 1,3 16,3 -1,3 -16,3
+#
+# K& KiN
+# M& FifD
 
-// Thai Chess variant with Ai-Wok (RNF).
+// Thai Chess variant with Ai-Wok super-piece (RNF).
 Game: Ai-wok
 8x8=3
 6 5 3 8 7 3 5 6
@@ -387,8 +432,11 @@ n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 R:630 1,3 16,3 -1,3 -16,3
 A:1350 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 1,3 16,3 -1,3 -16,3 15,7 17,7 -15,7 -17,7
 k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+#
+# A& NFR
 
 // Cambodian Chess using WinBoard's new engine-defined variant mechanism
+// Cambodian Chess. Like Makruk, but with extra initial King and Met moves
 Game: cambodian # PN.R.M....SKpn.r.m....sk # makruk
 8x8=3
 13 12 8 3 7 8 12 13
@@ -402,15 +450,16 @@ q:181 15,7 17,7 -15,7 -17,7 16,F4 -16,F4
 m:181 15,7 17,7 -15,7 -17,7 16,F4 -16,F4
 s:300 15,7 17,7 -15,7 -17,7 -16,7
 s:300 15,7 17,7 -15,7 -17,7 16,7
-
 b:300 15,7 17,7 -15,7 -17,7 -16,7
 b:300 15,7 17,7 -15,7 -17,7 16,7
-
 n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 R:630 1,3 16,3 -1,3 -16,3
-
+#
+# K& KiN
+# M& FifD
 
 // Ai-Wok using WinBoard's new engine-defined variant mechanism
+// Thai Chess variant with Ai-Wok super-piece (RNF).
 Game: ai-wok # PN.R...A..SKpn.r...a..sk # makruk
 8x8=3
 6 5 3 8 7 3 5 6
@@ -423,24 +472,27 @@ n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 R:630 1,3 16,3 -1,3 -16,3
 A:1350 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 1,3 16,3 -1,3 -16,3 15,7 17,7 -15,7 -17,7
 k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+#
+# A& NFR
 
 // Medieval intermediate between Shatranj and FIDE Chess
 Game: courier
 12x8
-6 4 8 5 10 3 7 9 5 8 4 6
-6 4 8 5 10 3 7 9 5 8 4 6
+11 9 5 10 8 3 7 6 10 5 9 11
+11 9 5 10 8 4 7 6 10 5 9 11
 p:65 -16,6 -15,5 -17,5 
 p:65 16,6 15,5 17,5
 k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
-n:300 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
-b:366 15,3 17,3 -15,3 -17,3
-R:550 1,3 16,3 -1,3 -16,3
-f:120 15,7 17,7 -15,7 -17,7
+k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
 e:70 30,7 34,7 -30,7 -34,7
 w:100 1,7 16,7 -1,7 -16,7
+f:120 15,7 17,7 -15,7 -17,7
 m:280 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 
+n:300 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:366 15,3 17,3 -15,3 -17,3
+R:550 1,3 16,3 -1,3 -16,3
 
-// The King moves as a Knight, and vice versa
+// The King (Unicorn) moves as a Knight, and vice versa. The Unicorn can castle!
 Game: knightmate
 8x8
 6 4 5 7 3 5 4 6
@@ -453,7 +505,7 @@ b:296 15,3 17,3 -15,3 -17,3
 R:444 1,3 16,3 -1,3 -16,3
 Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 
-// Modern variant with two new pieces (Archbishop and Chancellor) on 10x8 board
+// Modern variant with B+N and R+N compounds (Archbishop and Chancellor) on 10x8 board
 Game: capablanca
 10x8
 6 4 8 5 7 3 5 9 4 6
@@ -469,8 +521,7 @@ A:825 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 C:875 1,3 16,3 -1,3 -16,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 e:1000 15,7 17,7 -15,7 -17,7 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 -1,7 1,7 -16,7 16,7 -1,34 1,34 -16,34 16,34
 
-// Gothic Chess is protected through U.S. patent #6,481,716 by Ed Trice.
-// Spreading it without license might be a criminal offense!
+// Modern variant with B+N and R+N compounds (Archbishop and Chancellor) on 10x8 board
 Game: gothic
 10x8
 6 4 5 7 9 3 8 5 4 6
@@ -485,8 +536,21 @@ Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 A:825 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 C:875 1,3 16,3 -1,3 -16,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 
-// FalconChess is protected through U.S. patent #5,690,334 by George W. Duke.
-// The patent now expired, though.
+// Modern variant with two B+N compounds (Janus) on 10x8 board
+Game: janus
+10x8
+5 6 3 4 8 7 4 3 6 5
+5 6 3 4 8 7 4 3 6 5
+p:100 -16,24 -16,6 -15,5 -17,5 
+p:100 16,24 16,6 15,5 17,5
+n:310 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:350 15,3 17,3 -15,3 -17,3
+R:475 1,3 16,3 -1,3 -16,3
+A:825 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+k:-1  1,2034 -1,1034 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+
+// The Falcon can take any of the 3 shortest paths to its destination
 Game: falcon
 10x8
 6 4 5 8 7 3 8 5 4 6
@@ -501,8 +565,10 @@ Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 f:450 13,FFFFF207 29,F207 46,F207 47,10207 49,10207 50,11207 35,11207 19,1207 -13,1207 -29,FFFF1207 -46,FFFF1207 -47,FFFF0207 -49,FFFF0207 -50,FFFEF207 -35,FFFEF207 -19,FFFFF207 
 A:825 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 C:875 1,3 16,3 -1,3 -16,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+#
+# F& aflafrKafraflKafafsKafsafK
 
-// Cylinder Chess (WinBoard / XBoard legality testing should be off toplay this!)
+// Cylinder Chess: left and right board edges are connected
 Game: cylinder
 8x8
 6 4 5 7 3 5 4 6
@@ -514,8 +580,15 @@ n:350 14,107 31,107 33,107 18,107 -14,107 -31,107 -33,107 -18,107
 b:450 15,103 17,103 -15,103 -17,103
 R:525 1,103 16,3 -1,103 -16,3
 Q:1150 1,103 16,3 15,103 17,103 -1,103 -16,3 -15,103 -17,103
-
-// Berolina Chess. In WinBoard 4.3.15 you can play this with legality testing switched off
+#
+# P& fmWfceoFifmnD
+# N& oN
+# B& oB
+# R& oR
+# Q& oQ
+# K& oK
+
+// Berolina Chess. Pawns capture straight and move diagonally
 Game: berolina
 8x8
 6 4 5 7 3 5 4 6
@@ -527,6 +600,8 @@ n:259 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 b:296 15,3 17,3 -15,3 -17,3
 R:444 1,3 16,3 -1,3 -16,3
 Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+#
+# P& fmFfceWifmnA
 
 // Modern variant with four new pieces in randomly chosen setup on 8x8 board
 Game: super
@@ -549,7 +624,7 @@ g:640 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 2,7 30,7 32,7 34,7 -2,7 -30,7 -3
 m:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 16,70 -16,70
 w:340 1,7 16,7 -1,7 -16,7 2,7 32,7 -2,7 -32,7
 
-// Seirawan Chess (with Archbishop and Chancellor gated in during game)
+// Seirawan Chess; to 'gate in' Hawk (B+N) or Elephant (R+N), select it before moving
 Game: seirawan
 8x8
 5 3 4 7 6 4 3 5
@@ -565,24 +640,7 @@ k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
 h:780 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 E:814 1,3 16,3 -1,3 -16,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 
-// Spartan Chess, where black has a different army from white's orthodox FIDE, with two kings
-Game: fairy/Spartan # PNBRQ..............K....q.lwg.....c...hk
-8x8
-6 4 5 7 11 5 4 6
-3 10 12 8 8 12 9 3
-p:74 -16,64 -16,6 -15,5 -17,5 
-h:70  15,E4  17,E4 16,5 15,6 17,6
-l:290 15,7 17,7 -15,7 -17,7 30,7 34,7 -30,7 -34,7 1,6 -1,6
-n:259 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
-b:296 15,3 17,3 -15,3 -17,3
-R:444 1,3 16,3 -1,3 -16,3
-Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
-c:255 1,7 16,7 -1,7 -16,7 2,7 -2,7 32,7 -32,7
-w:790 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
-G:640 1,3 16,3 -1,3 -16,3 15,7 17,7 -15,7 -17,7
-k:-435 1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
-k:-435 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
-
+// The usual Persian army combats an entirely different gang of Spartans
 Game: spartan
 8x8
 6 4 5 7 11 5 4 6
@@ -600,7 +658,7 @@ G:640 1,3 16,3 -1,3 -16,3 15,7 17,7 -15,7 -17,7
 k:-435 1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
 k:-435 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
 
-// Set for Chess with Different Armies, FIDE vs Color-bound Cloberers (legality-testing off!)
+// Chess with Different Armies
 Game: fairy/FIDE-Clobberers # PNBRQ.........Kp.....eac....lk
 8x8
 6 4 5 7 10 5 4 6
@@ -617,7 +675,13 @@ A:875 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 k:-1  1,34 -1,1034 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 l:530 15,3 17,3 -15,3 -17,3 32,7 -32,7 2,7 -2,7
+#
+# e WA
+# c FAD
+# l BD
+# k KilO2rO3
 
+// Chess with Different Armies
 Game: fairy/Clobberers-FIDE # P.....EAC....LKpnbrq.........k
 8x8
 12 3 8 7 10 8 3 12
@@ -634,7 +698,13 @@ Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 k:-1  1,34 -1,1034 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 l:530 15,3 17,3 -15,3 -17,3 32,7 -32,7 2,7 -2,7
+#
+# E WA
+# C FAD
+# L BD
+# K KirO2lO3
 
+// Chess with Different Armies
 Game: fairy/FIDE-Nutters # PNBRQ................Kp...........h.t.c...uk
 8x8
 6 4 5 7 10 5 4 6
@@ -650,7 +720,14 @@ u:400 31,7 33,7 14,7 18,7 1,7 -1,7 -16,7 -15,7 -17,7
 C:935 16,3 1,3 -1,3 14,7 31,7 33,7 18,7 15,7 17,7 -16,7 -15,7 -17,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 t:485 16,3 1,3 -1,3 -16,7 -15,7 -17,7
-
+#
+# h vNF
+# t fsRbWbF
+# c fsRbWfhNF
+# u fhNbsWbF
+# k KisO2
+
+// Chess with Different Armies
 Game: fairy/Nutters-FIDE # P...........H.T.C...UKpnbrq................k
 8x8
 11 3 6 7 10 6 3 11
@@ -666,7 +743,14 @@ R:500 16,3 -16,3 -1,3 1,3
 Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 t:485 -16,3 1,3 -1,3 16,7 15,7 17,7
-
+#
+# H vNF
+# T fsRbWbF
+# C fsRbWfhNF
+# U fhNbsWbF
+# K KisO2
+
+// Chess with Different Armies
 Game: fairy/Clobberers-Nutters # P.....EAC....L.......Kp...........h.t.c...uk
 8x8
 6 4 5 7 10 5 4 6
@@ -683,7 +767,18 @@ C:935 16,3 1,3 -1,3 14,7 31,7 33,7 18,7 15,7 17,7 -16,7 -15,7 -17,7
 k:-1  1,34 -1,1034 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 t:485 16,3 1,3 -1,3 -16,7 -15,7 -17,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
-
+#
+# h vNF
+# t fsRbWbF
+# c fsRbWfhNF
+# u fhNbsWbF
+# E WA
+# C FAD
+# L BD
+# K KirO2lO3
+# k KisO2
+
+// Chess with Different Armies
 Game: fairy/Nutters-Clobberers # P...........H.T.C...UKp.....eac....l.......k
 8x8
 11 3 6 7 10 6 3 11
@@ -700,7 +795,18 @@ A:875 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 t:485 -16,3 1,3 -1,3 16,7 15,7 17,7
 k:-1  1,34 -1,1034 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
-
+#
+# H vNF
+# T fsRbWbF
+# C fsRbWfhNF
+# U fhNbsWbF
+# e WA
+# c FAD
+# l BD
+# K KisO2
+# k KilO2rO3
+
+// Chess with Different Armies
 Game: fairy/FIDE-Rookies # PNBRQ................Kp.............w.mh.s.k
 8x8
 6 4 5 7 11 5 4 6
@@ -713,10 +819,17 @@ b:350 15,3 17,3 -15,3 -17,3
 R:500 16,3 -16,3 -1,3 1,3
 Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 s:400 16,843 1,843 -1,843 -16,843
-M:935 16,3 1,3 -1,3 14,7 31,7 33,7 18,7 15,7 17,7 -16,7 -15,7 -17,7
+M:935 16,3 1,3 -1,3 14,7 31,7 33,7 18,7 -16,3 -14,7 -31,7 -33,7 -18,7
 h:480 15,7 17,7 -15,7 -17,7 2,7 32,7 -2,7 -32,7 3,7 48,7 -3,7 -48,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
-
+#
+# w WD
+# h HFD
+# s W4
+# m RN
+# k KisO2
+
+// Chess with Different Armies
 Game: fairy/Rookies-FIDE # P.............W.MH.S.Kpnbrq................k
 8x8
 6 3 10 7 11 10 3 6
@@ -727,12 +840,19 @@ w:310 1,7 16,7 -1,7 -16,7 2,7 32,7 -2,7 -32,7
 n:325 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 b:350 15,3 17,3 -15,3 -17,3
 s:400 16,843 1,843 -1,843 -16,843
-M:935 -16,3 1,3 -1,3 -14,7 -31,7 -33,7 -18,7 -15,7 -17,7 16,7 15,7 17,7
+M:935 -16,3 1,3 -1,3 -14,7 -31,7 -33,7 -18,7 16,3 14,7 31,7 33,7 18,7
 R:500 16,3 -16,3 -1,3 1,3
 Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
 h:480 15,7 17,7 -15,7 -17,7 2,7 32,7 -2,7 -32,7 3,7 48,7 -3,7 -48,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
-
+#
+# W WD
+# H HFD
+# S W4
+# M RN
+# K KisO2
+
+// Chess with Different Armies
 Game: fairy/Clobberers-Rookies # P.....EAC....L.......Kp.............w.mh.s.k
 8x8
 6 4 5 7 11 5 4 6
@@ -745,11 +865,22 @@ c:480 15,7 17,7 -15,7 -17,7 32,7 -32,7 2,7 -2,7 30,7 34,7 -30,7 -34,7
 l:530 15,3 17,3 -15,3 -17,3 32,7 -32,7 2,7 -2,7
 A:875 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 s:400 16,843 1,843 -1,843 -16,843
-M:935 16,3 1,3 -1,3 14,7 31,7 33,7 18,7 15,7 17,7 -16,7 -15,7 -17,7
+M:935 16,3 1,3 -1,3 14,7 31,7 33,7 18,7 -16,3 -14,7 -31,7 -33,7 -18,7
 h:480 15,7 17,7 -15,7 -17,7 2,7 32,7 -2,7 -32,7 3,7 48,7 -3,7 -48,7
 k:-1  1,34 -1,1034 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
-
+#
+# E WA
+# C FAD
+# L BD
+# w WD
+# h HFD
+# s W4
+# m RN
+# K KirO2ilO3
+# k KisO2
+
+// Chess with Different Armies
 Game: fairy/Rookies-Clobberers # P.............W.MH.S.Kp.....eac....l.......k
 8x8
 6 3 10 7 11 10 3 6
@@ -760,15 +891,78 @@ w:310 1,7 16,7 -1,7 -16,7 2,7 32,7 -2,7 -32,7
 e:320 30,7 34,7 -30,7 -34,7 16,7 -16,7 1,7 -1,7
 l:530 15,3 17,3 -15,3 -17,3 32,7 -32,7 2,7 -2,7
 s:400 16,843 1,843 -1,843 -16,843
-M:935 -16,3 1,3 -1,3 -14,7 -31,7 -33,7 -18,7 -15,7 -17,7 16,7 15,7 17,7
+M:935 -16,3 1,3 -1,3 -14,7 -31,7 -33,7 -18,7 16,3 14,7 31,7 33,7 18,7
 c:480 15,7 17,7 -15,7 -17,7 32,7 -32,7 2,7 -2,7 30,7 34,7 -30,7 -34,7
 A:875 15,3 17,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
 h:480 15,7 17,7 -15,7 -17,7 2,7 32,7 -2,7 -32,7 3,7 48,7 -3,7 -48,7
 k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
 k:-1  1,34 -1,1034 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
+#
+# W WD
+# H HFD
+# S W4
+# M RN
+# e WA
+# c FAD
+# l BD
+# K KisO2
+# k KilO2irO3
+
+// Chess with Different Armies
+Game: fairy/Nutters-Rookies # P...........H.T.C...UKp.............w.mh.s.k
+8x8
+6 4 5 7 11 5 4 6
+8 3 10 9 11 10 3 8
+p:100 -16,24 -16,6 -15,5 -17,5 
+p:100 16,24 16,6 15,5 17,5
+w:310 1,7 16,7 -1,7 -16,7 2,7 32,7 -2,7 -32,7
+h:310 31,7 33,7 15,7 17,7 -31,7 -33,7 -15,7 -17,7 
+u:400 -31,7 -33,7 -14,7 -18,7 1,7 -1,7 16,7 15,7 17,7
+t:485 -16,3 1,3 -1,3 16,7 15,7 17,7
+C:935 -16,3 1,3 -1,3 -14,7 -31,7 -33,7 -18,7 -15,7 -17,7 16,7 15,7 17,7
+s:400 16,843 1,843 -1,843 -16,843
+M:935 16,3 1,3 -1,3 14,7 31,7 33,7 18,7 -16,3 -14,7 -31,7 -33,7 -18,7
+h:480 15,7 17,7 -15,7 -17,7 2,7 32,7 -2,7 -32,7 3,7 48,7 -3,7 -48,7
+k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
+#
+# w WD
+# h HFD
+# s W4
+# m RN
+# H vNF
+# T fsRbWbF
+# C fsRbWfhNF
+# U fhNbsWbF
+# K& KisO2
+
+// Chess with Different Armies
+Game: fairy/Rookies-Nutters # P.............W.MH.S.Kp...........h.t.c...uk
+8x8
+4 3 5 7 11 5 3 4
+10 6 8 9 11 8 6 10
+p:100 -16,24 -16,6 -15,5 -17,5 
+p:100 16,24 16,6 15,5 17,5
+w:310 1,7 16,7 -1,7 -16,7 2,7 32,7 -2,7 -32,7
+s:400 16,843 1,843 -1,843 -16,843
+h:480 15,7 17,7 -15,7 -17,7 2,7 32,7 -2,7 -32,7 3,7 48,7 -3,7 -48,7
+h:310 31,7 33,7 15,7 17,7 -31,7 -33,7 -15,7 -17,7 
+M:935 -16,3 1,3 -1,3 -14,7 -31,7 -33,7 -18,7 16,3 14,7 31,7 33,7 18,7
+u:400 31,7 33,7 14,7 18,7 1,7 -1,7 -16,7 -15,7 -17,7
+C:935 16,3 1,3 -1,3 14,7 31,7 33,7 18,7 15,7 17,7 -16,7 -15,7 -17,7
+t:485 16,3 1,3 -1,3 -16,7 -15,7 -17,7
+k:-1  1,34 -1,34 1,7 -1,7 16,7 15,7 17,7 -16,7 -15,7 -17,7
+#
+# h vNF
+# t fsRbWbF
+# c fsRbWfhNF
+# u fhNbsWbF
+# W WD
+# H HFD
+# S W4
+# M RN
+# K& KisO2
 
 // Great Shatranj: modern variant with range-two leapers replacing sliders, on 10x8 board.
-// Must be played with legality testing off in XBoard 4.4.0.
 Game: great
 10x8
 6 4 5 8 3 10 9 5 4 6
@@ -783,5 +977,188 @@ s:280 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
 g:640 1,7 16,7 -1,7 -16,7 2,7 -2,7 32,7 -32,7 15,7 17,7 -15,7 -17,7 30,7 34,7 -30,7 -34,7
 h:640 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 15,7 17,7 -15,7 -17,7 30,7 34,7 -30,7 -34,7
 m:640 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 1,7 16,7 -1,7 -16,7 2,7 -2,7 32,7 -32,7
+#
+# P& fmWfcF
+# E& FA
+# W& WD
+# G& KAD
+# H& NAF
+# M& NWD
+
+// Charge of the Light Brigade (normal Chess rules)
+Game: light-brigade # PNBRQKpnbrqk # nocastle
+8x8
+0 7 0 7 3 0 7 0
+4 4 4 4 3 4 4 4
+p:74 -16,24 -16,6 -15,5 -17,5 
+p:74  16,24 16,6 15,5 17,5
+k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+n:444 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:400 15,3 17,3 -15,3 -17,3
+R:500 1,3 16,3 -1,3 -16,3
+Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+
+// King of the Hill (King MUST be #3 and have value -2 to trigger hill eval)
+// Apart from mate, reaching one of the 4 central squares with K also wins
+Game: king-of-the-hill # PNBRQKpnbrqk # fairy
+8x8
+6 4 5 7 3 5 4 6
+6 4 5 7 3 5 4 6
+p:66 -16,24 -16,6 -15,5 -17,5 
+p:66  16,24 16,6 15,5 17,5
+k:-2  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+n:259 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:296 15,3 17,3 -15,3 -17,3
+R:444 1,3 16,3 -1,3 -16,3
+Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+
+// Bifurcator Chess
+// slider moves split into two directions at the first friendly piece they meet
+Game: bifurcator # PNBRQKpnbrqk # fairy
+8x8
+6 4 5 7 3 5 4 6
+6 4 5 7 3 5 4 6
+p:66 -16,24 -16,6 -15,5 -17,5 
+p:66  16,24 16,6 15,5 17,5
+k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+n:259 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:370 15,3 17,3 -15,3 -17,3 15,1FCB8 17,1CB8 -15,1CB8 -17,1FCB8 15,FFFF0CB8 17,10CB8 -15,FFFF0CB8 -17,10CB8
+R:518 1,3 16,3 -1,3 -16,3 1,10CB8 16,1FCB8 -1,10CB8 -16,1FCB8 1,FFFF0CB8 16,1CB8 -1,FFFF0CB8 -16,1CB8
+Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+#
+# B& BtgabyabsB
+# R& RtgabyabsR
+
+// Variant where no single piece has mating potential
+Game: team-mate # PN....EF...M.A.J...CUKpn....ef...m.a.j...cuk # fairy
+8x8
+10 8 6 12 3 5 9 7
+10 8 6 12 4 5 9 7
+p:110 -16,24 -16,6 -15,5 -17,5 
+p:110 16,24 16,6 15,5 17,5
+k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+m:275 30,7 34,7 -30,7 -34,7 45,7 51,7 -45,7 -51,7 
+e:360 15,7 17,7 -15,7 -17,7 30,7 34,7 -30,7 -34,7
+c:600 14,FFFF1043 31,F043 33,31043 18,13043 -14,FFFF3043 -31,11043 -33,2F043 -18,11043
+f:360 30,7 34,7 -30,7 -34,7 1,7 -1,7 16,7 -16,7
+n:360 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+u:550 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 1,7 16,7 -1,7 -16,7 
+J:770 2,3 32,3 15,3 17,3 -2,3 -32,3 -15,3 -17,3
+A:883 16,1003 16,1F003 -16,1003 -16,1F003 1,10003 1,FFFF0003 -1,10003 -1,FFFF0003
+#
+# E& FA
+# F& WA
+# M& AG
+# U& WN
+# C& NmpafsafF
+# A& WyafsW
+# K& KisO2
+# J& BD0
+
+// Variant on a 6x6 board without
+Game: los-alamos # PN.RQKpn.rqk # fairy
+6x6
+6 4 7 3 4 6
+6 4 7 3 4 6
+p:99 -16,6 -15,5 -17,5 
+p:99  16,6 15,5 17,5
+k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+n:333 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:296 15,3 17,3 -15,3 -17,3
+R:444 1,3 16,3 -1,3 -16,3
+Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+
+// Variant from 1820 with Zebra ('Elephant') and Bishop - Dababbarider compound ('General')
+Game: ciccolini # PN.RQ..........G.......EKpn.rq..........g.......ek # fairy
+10x10
+5 4 6 3 7 8 3 6 4 5
+5 4 6 3 7 8 3 6 4 5
+p:100 -16,24 -16,6 -15,5 -17,5 
+p:100 16,24 16,6 15,5 17,5
+e:222 46,7 50,7 -46,7 -50,7 35,7 29,7 -35,7 -29,7
+n:310 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+R:475 1,3 16,3 -1,3 -16,3
+G:700 15,3 17,3 -15,3 -17,3 32,3 -32,3 2,3 -2,3
+Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+k:-1  1,34,2 -1,34,-2 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+#
+# E& Z
+# G& BD0
+
+// Mexican Chess: 10x10 variant with two 'Conquistadores' (move as Camel)
+Game: mexican # PNBRQ...................CKpnbrq...................ck # fairy
+10x10
+6 4 3 5 7 8 5 3 4 6
+6 4 3 5 7 8 5 3 4 6
+p:100 -16,424 -16,24 -16,6 -15,5 -17,5 
+p:100 16,424 16,24 16,6 15,5 17,5
+c:222 47,7 49,7 -47,7 -49,7 19,7 13,7 -13,7 -19,7
+n:310 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:332 15,3 17,3 -15,3 -17,3
+R:475 1,3 16,3 -1,3 -16,3
+Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+k:-1  1,34,2 -1,34,-2 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+#
+# P& fmWfceFifmW3
+# C& C
+
+// 12x12 variant from the Alfonso codex (1283 AD), with bent sliders and range-3 leapers
+Game: grande-acedrex # P.CR.............A..U..G........LKp.cr.............a..u..g........lk # shatranj
+12x12=-3
+8 7 9 5 6 10 3 6 5 9 7 8
+8 7 9 5 6 10 4 6 5 9 7 8
+p:95 -16,6 -15,5 -17,5 
+p:95  16,6 15,5 17,5
+k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 1,E4 -1,E4 -16,E4 -15,E4 -17,E4
+k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 1,E4 -1,E4 16,E4 15,E4 17,E4
+g:235 46,7 50,7 -46,7 -50,7 35,7 29,7 -35,7 -29,7
+c:340 15,3 17,3 -15,3 -17,3
+l:444 3,7 -3,7 48,7 -48,7 47,7 49,7 -47,7 -49,7 19,7 13,7 -19,7 -13,7
+R:481 1,3 16,3 -1,3 -16,3
+u:700 14,3,15 31,3,15 33,3,17 18,3,17 -14,3,-15 -31,3,-15 -33,3,-17 -18,3,-17
+A:830 17,3,16 15,3,16 -15,3,-16 -17,3,-16 17,3,1 -15,3,1 -17,3,-1 15,3,-1
+#
+# K& KimAimD
+# G& Z
+# L& HC
+# U& NmpafsyafW
+# A& FyafsF
+
+// Roman Chess: 10x10 variant with two 'Archers' (non-royal Kings)
+Game: roman # PNBRQ.....AKpnbrq.....ak # fairy
+10x10
+6 4 3 5 7 8 5 3 4 6
+6 4 3 5 7 8 5 3 4 6
+p:100 -16,24 -16,6 -15,5 -17,5 
+p:100 16,24 16,6 15,5 17,5
+a:290 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+n:310 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:332 15,3 17,3 -15,3 -17,3
+R:475 1,3 16,3 -1,3 -16,3
+Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+k:-1  1,34,2 -1,34,-2 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+
+// Approximation to Wildebeest Chess, with Gnu and Camels. One-step castling is not possible.
+Game: almost-wildebeest # PNBRQ...................C......GKpnbrq...................c......gk # fairy
+11x10
+6 4 5 5 7 9 8 3 3 4 6
+6 4 3 3 8 10 7 5 5 4 6
+p:100 -16,C24 -16,24 -16,6 -15,5 -17,5 
+p:100 16,C24 16,24 16,6 15,5 17,5
+c:223 47,7 49,7 -47,7 -49,7 19,7 13,7 -13,7 -19,7
+n:313 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
+b:333 15,3 17,3 -15,3 -17,3
+R:473 1,3 16,3 -1,3 -16,3
+Q:950 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3
+g:700 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 13,7 47,7 49,7 19,7 -13,7 -47,7 -49,7 -19,7
+k:-2  1,34,3 -1,34,-3 1,34,2 -1,34,-2 1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+k:-2  1,34,3 -1,34,-3 1,34,2 -1,34,-2 1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
+#
+# P& fmWfceFifmW3iifmnD
+# C& C
+# G& NC
+# K& KisO2isO3isO4
+
 
 // End of game file
diff --git a/data/logo.png b/data/logo.png
new file mode 100644
index 0000000..f3ccef3
Binary files /dev/null and b/data/logo.png differ
diff --git a/data/makruk.hash b/data/makruk.hash
new file mode 100644
index 0000000..14236f8
--- /dev/null
+++ b/data/makruk.hash
@@ -0,0 +1,48 @@
+79810814:752b613c=-7995
+0593bb0a:76e21832=-7995
+4c0c66d6:6c5f733c=-7995
+664f1151:60ad24e9=-7995
+90735259:f4213c2b=-7995
+6b0b6531:b73a8c78=-7995
+4bad1972:157d831a=-7995
+eea9ea6d:86734f88=-7995
+c3edf05e:60d37ccf=-7995
+664210c5:233831ba=-7995
+6972e2d3:910ee947=-7995
+7413432a:f64623b4=-7995
+7df305dc:45d5c62b=-7995
+58718bb8:7e791374=-7995
+e31c9489:e9b45d35=-7995
+a44ebb4c:4fe77158=-7995
+107dd42e:0e0d48d5=-7995
+7d448af3:06117aa2=-7995
+27105d6f:bac9d28e=-7995
+f60c2757:c59caf42=-7995
+add1c0af:89b8d507=-7995
+ae193a31:fed40d3f=-7995
+84014d91:e1ef4e15=-7995
+ca1dfd75:2314e6f7=-7995
+6a1458d7:c43fc8e5=-7995
+08bca616:1d9b065f=-7995
+fee5f0cf:406e7916=-7995
+e38cb9f1:41430da3=-7995
+f7ad75aa:b2b4a80a=-7995
+68f94879:62d5dbac=-7995
+47b3e75a:7dc8e54a=-7995
+1af24af9:9601be22=-7995
+1e990593:d4fb5b4e=-7995
+1c5b6f90:c528e66a=-7995
+f5b5e304:e5d33842=-7995
+d8513d27:ad078889=-7995
+89ffd5ff:13ea08b0=-7995
+54cd3c23:cc80cbef=-7995
+6ef0096d:b014045b=-7995
+14fe7120:b492a1b1=-7995
+b81cf1eb:c968b50a=-7995
+899108cb:8a7bb45e=-7995
+a67747bb:21822187=-7995
+697ecbce:6e7fb753=-7995
+7790fd86:0a73da65=-7995
+1725909f:7e4282dd=-7995
+68319730:e943f4c2=-7995
+a431cb24:b94e5557=-7995
diff --git a/data/maxqi.eng b/data/maxqi.eng
new file mode 100644
index 0000000..ea70718
--- /dev/null
+++ b/data/maxqi.eng
@@ -0,0 +1,3 @@
+plugin spec 0.0
+maxqi
+xiangqi
diff --git a/data/shamax.eng b/data/shamax.eng
new file mode 100644
index 0000000..a2ec202
--- /dev/null
+++ b/data/shamax.eng
@@ -0,0 +1,3 @@
+plugin spec 0.0
+shamax
+shatranj
diff --git a/fairymax.c b/fairymax.c
index 8b4ddb7..ca2971d 100644
--- a/fairymax.c
+++ b/fairymax.c
@@ -1,13 +1,16 @@
 /***************************************************************************/
-/*                               fairy-Max,                                */
+/*                               Fairy-Max,                                */
 /* Version of the sub-2KB (source) micro-Max Chess program, fused to a     */
 /* generic WinBoard interface, loading its move-generator tables from file */
 /***************************************************************************/
 
      /*****************************************************************/
      /*                      LICENCE NOTIFICATION                     */
-     /* Fairy-Max 4.8 is free software, and you have my permission do */
-     /* with it whatever you want, whether it is commercial or not.   */
+     /* Fairy-Max 5.0 is free software, released in the public domain */
+     /* so that you have my permission do with it whatever you want,  */
+     /* whether it is commercial or not, at your own risk. Those that */
+     /* are not comfortable with this, can also use or redistribute   */
+     /* it under the GNU Public License or the MIT License.           */
      /* Note, however, that Fairy-Max can easily be configured through*/
      /* its fmax.ini file to play Chess variants that are legally pro-*/
      /* tected by patents, and that to do so would also require per-  */
@@ -18,7 +21,7 @@
      /*****************************************************************/
 
 #define MULTIPATH
-#define VERSION "4.8T"
+#define VERSION "5.0b"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -26,16 +29,25 @@
 #include <signal.h>
 #include <time.h>
 
-#ifndef INI_FILE 
-#define INI_FILE "fmax.ini"
+#ifndef FAIRYDIR
+#define FAIRYDIR "."
 #endif
+#define INI_FILE FAIRYDIR "/fmax.ini"
 
 #ifdef WIN32 
 #    include <windows.h>
 #    define CPUtime 1000.*clock
+     int Input()
+     {  // checks for waiting input in pipe
+	static int init; static HANDLE inp; DWORD cnt;
+	if(!init) inp = GetStdHandle(STD_INPUT_HANDLE);
+	if(!PeekNamedPipe(inp, NULL, 0, NULL, &cnt, NULL)) return 1;
+	return cnt;
+    }
 #else
 #    include <sys/time.h>
 #    include <sys/times.h>
+#    include <sys/ioctl.h>
 #    include <unistd.h>
      int GetTickCount() // with thanks to Tord
      {	struct timeval t;
@@ -50,15 +62,22 @@
 	times(&cpuTimes);
 	return ((double)(cpuTimes.tms_utime + cpuTimes.tms_stime) * CLOCKS_PER_SEC * 1000)/cps;
      }
+     int Input()
+     {
+	int cnt;
+	if(ioctl(0, FIONREAD, &cnt)) return 1;
+	return cnt;
+     }
 #endif
 
 int StartKey;
 
+#define ANALYZE -2
 #define EMPTY -1
 #define WHITE 0
 #define BLACK 16
 
-#define STATE 128
+#define STATE 256
 
 /* The following macros indicate the differences between Fairy-Max and its */
 /* dedicated Shatranj derivative ShaMax so that these can now be compiled  */
@@ -99,95 +118,108 @@ int MaxDepth;
 int Post;
 int Fifty;
 int GameNr;
+int Randomize;
 int Resign;
 char Cambodian[80] = "makruk";
 int Threshold = 800;
+int drawMoves = 50;
 int Score;
-int makruk;
-int prom, pm, gating, succession;
+int zone, pRank, popup;
+int prom, pm, gating, succession, hill;
 char piecename[32], piecetype[32], blacktype[32];
 char selectedFairy[80];
 char *inifile = INI_FILE;
+char info[999], hashfile[256];
 
 int Ticks, tlim, Setup, SetupQ;
 
 int GameHistory[1024];
-char HistoryBoards[1024][STATE], setupPosition[162];
+char HistoryBoards[1024][STATE], setupPosition[290];
 int GamePtr, HistPtr;
+int map[1<<16];
 
+#define RBITS 12
 #define W while
 #define K(A,B) *(int*)(T+A+S*(B&31))
 #define J(A) K(y+A,b[y])-K(x+A,u)-K(H+A,t)
+#define SETKEY(Key,A) for(Key=i=0;i<=BE;i++)Key+=K(i+A,b[i])
 
 int U=(1<<23)-1;
-struct _ {int K,V;char X,Y,D,F;} *A;           /* hash table, 16M+8 entries*/
+struct _ {int K,V;unsigned char X,Y,D,F;} *A;  /* hash table, 16M+8 entries*/
 
-int M=136,S=128,I=8e3,Q,O,K,N,j,R,J,Z,LL,GT,   /* M=0x88                   */
-BW,BH,sh,
+int M=136,S=256,I=8e3,Q,O,K,N,j,R,J,Z,LL,GT,   /* M=0x88                   */
+BW,BH,BE,sh,RR,ab,CONS,L,ep,stale,wk,bk,bareK,bareL,score,R2,
+pt[513],                                       /* promotion bonus/upgrade  */
 w[16]={0,2,2,-1,7,8,12,23,7,5},                /* relative piece values    */
 o[256],
 oo[32],                                        /* initial piece setup      */
 of[256],
 od[16];                                        /* 1st dir. in o[] per piece*/
 
-signed char L,pl[32],
-b[513],                                        /* board: 16x8+dummy, + PST */
-T[4104],                                       /* hash translation table   */
+signed char pl[32],
+b[1025],                                       /* board: 16x8+dummy, + PST */
+T[8200],                                       /* hash translation table   */
 centr[32],
 n[]=".*XKNBRQEWFMACHG?x+knbrqewfmachg";        /* piece symbols on printout*/
 
 int pv[10000],*sp=pv; // triangular array
 int margin;
 
+int seed=76596595; int Rand() { return (seed = 1103515245*seed + 12345)*150610563>>14; }
+
 void pboard()
 {int i;
- i=-1;W(++i<128)printf(" %c",(i&15)==BW&&(i+=15-BW)?10:n[b[i]&31]);
+ i=-1;W(++i<S)printf(" %c",(i&15)==BW&&(i+=15-BW)?10:n[b[i]&31]);
 }
-         
 
+         
 D(k,q,l,e,E,z,n)        /* recursive minimax search, k=moving side, n=depth*/
 int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
 {                       /* e=score, z=prev.dest; J,Z=hashkeys; return score*/
- int j,r,m,v,d,h,i,F,G,P,V,f=J,g=Z,C,s,flag,FF,*ps=sp,kk=S;
- signed char t,p,u,x,y,X,Y,H,B,gt,rg,rk;
+ int j,r,m,v,d,h,i,F,G,P,V,f=J,g=Z,C,s,flag,FF,*ps=sp,kk=S,x,y,X,Y,H,B,rk;
+ signed char t,p,u,gt,rg,vf;
  struct _*a=A+(J+(k+S)*E&U);                   /* lookup pos. in hash table*/
- *sp++=0;
  q-=q<e;l-=l<=e;                               /* adj. window: delay bonus */
- d=a->D;m=a->V;X=a->F;Y=a->Y;                  /* resume at stored depth   */
- if(a->K-Z|z&S  |                              /* miss: other pos. or empty*/
-  !(m<=q|X&8&&m>=l|X&S))                       /*   or window incompatible */
+ d=a->D;m=a->V;X=a->F;Y=a->Y+S-1;              /* resume at stored depth   */
+ if(a->K-Z|z&S&&(X=8)||                        /* miss: other pos. or empty*/
+  !(m<=q|X&4&&m>=l|X&2))                       /*   or window incompatible */
   d=Y=0;                                       /* start iter. from scratch */
+ if(X&1)return 0;                              /* busy-flag set: rep-draw  */
+ *sp++=0;                                      /* initialize empty PV      */
  X=a->X;                                       /* start at best-move hint  */
  W(d++<n||d<3||              /*** min depth = 2   iterative deepening loop */
    z&S&&K==I&&(GetTickCount()-Ticks<tlim&d<=MaxDepth|| /* root: deepen upto time   */
    (K=X,L=Y&~S,Score=m,d=3)))                  /* time's up: go do best    */
  {x=B=X;                                       /* start scan at prev. best */
   h=Y&S;                                       /* request try noncastl. 1st*/
-  P=d>2&&l+I?D(16-k,-l,1-l,-e,2*S,2*S,d-3):I;  /* search null move         */
+  if(a->D<99)a->F=1,a->K=Z;                    /* mark hash entry 'busy'   */
+  P=d>2&&l+I?D(16-k,-l,1-l,-e,S,2*S,d-3):I;    /* search null move         */
   m=-P<l|R<5?d-2?-I:e:-P;   /*** prune if > beta  unconsidered:static eval */
   SHAMAX( if(pl[k]<=1&pl[16-k]>1)m=I-1; )      /* bare king loses          */
-  N++;                                         /* node count (for timing)  */
+  ab|=!(N++&4095)&&tlim>1e8&&Input();          /* node count (for timing)  */
   do{u=b[x];                                   /* scan board looking for   */
    if(u&&(u&16)==k)                            /*  own piece (inefficient!)*/
    {r=p=u&15;                                  /* p = piece type (set r>0) */
+    if(hill&&w[p]<0&b[769+x])m=I,d=98;         /* King on the hill: we won */
     j=od[p];                                   /* first step vector f.piece*/
     W(r=o[++j])                                /* loop over directions o[] */
     {A:                                        /* resume normal after best */
      flag=h?3:of[j];                           /* move modes (for fairies) */
-     y=x;F=FF=G=S;rg=flag>>10&3;               /* (x,y)=move, (F,G)=castl.R*/
+     y=x;F=FF=G=S;rg=flag>>10&3;vf=32;         /* (x,y)=move, (F,G)=castl.R*/
+     if(rg>p)rg=pt[x]&~u&2*u?(vf=0):1;
      do{                                       /* y traverses ray, or:     */
       H=y=h?Y^h:y+r;                           /* sneak in prev. best move */
       if(flag&1<<8)H=y=(y&15)>13?y+BW:(y&15)>=BW?y-BW:y; /* cylinder board */
-      if(y&S|(y&15)>=BW)break;                 /* board edge hit           */
+      if(y<0|y>BE|(y&15)>=BW)break;            /* board edge hit           */
 #ifdef MULTIPATH
       if(flag&1<<9)                            /* if multipath move        */
-      {t=flag>>12;                             /* get dir. stepped twice   */
+      {t=flag>>RBITS;                          /* get dir. stepped twice   */
        if(b[x+t]){if(b[y-2*t]|b[y-t])break;}else 
        if(b[x+2*t]&&b[y-t])break;              /* test if empty path exists*/
       }
 #endif
-      m=E<16|(E^112)<16&&flag&1&y-E<2&E-y<2?I:m;      /* bad castling  */
-      if(p<3&y==E&flag)H=z&127;                /* shift capt.sqr. H if e.p.*/
+      m=E<S&&(y<(z&S-1)?E-y<2:y-E<2)&flag?I:m; /* bad castling             */
+      if(p<3&flag)H=(y^E)&(E>>9^511)?H:z&S-1;  /* shift capt.sqr. H if e.p.*/
       t=b[H];
       if(flag&1+!t)                            /* mode (capt/nonc) allowed?*/
       {if(t&&(t&16)==k)break;                  /* capture own              */
@@ -198,27 +230,31 @@ int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
        v=d-1?e:i-p;                            /*** MVV/LVA scoring if d=1**/
        if(d-!t>1)                              /*** all captures if d=2  ***/
        {v=gt=0;G:                              /* retry move with gating   */
-        v+=centr[p]?b[x+257]-b[y+257]:0;       /* center positional pts.   */
-        if(G-S)b[FF]=(rk=b[G])|32,v+=50;       /* castling: put R & score  */
+        v+=centr[p]*(b[x+513]-b[y+513]);       /* center positional pts.   */
+        if(G-S)b[FF]=(rk=b[G])|32,v+=20;       /* castling: put R & score  */
         b[G]=b[H]=0;b[x]=gt;b[y]=u|32;         /* do move, set non-virgin  */
         pl[t&31]-=!!t;                         /* updat victim piece count */
-        v-=w[p]>0|R<EG?0:20;                   /*** freeze K in mid-game ***/
+        v-=w[p]>0|R<EG?0:20-30*((x-y+1&7)>2);  /*** freeze K in mid-game ***/
         if(p<3)                                /* pawns:                   */
-        {v-=9*((x-2&M||b[x-2]-u)+              /* structure, undefended    */
-               (x+2&M||b[x+2]-u)               /*        squares plus bias */
+        {v-=9*((b[x-2]!=u)+                    /* structure, undefended    */
+               (b[x+2]!=u)                     /*        squares plus bias */
               +(w[b[x^16]&15]<0))              /*** cling to magnetic K ***/
               +(R-76>>2);                      /* end-game Pawn-push bonus */
-         b[y]+=V=y+r+1&S?647-p|pm:2*(u&y+16&32);/*upgrade P or convert to Q*/
-         if(V&makruk)b[y]=u|7,V=480;           /* Makruk promotion on 6th  */
+         b[y]+=V=u&32?pt[y]:0;                 /*upgrade P or convert to Q */
          V>>=sh;                               /* for Shatranj promo to F  */
-         i+=V;                                 /* promotion / passer bonus */
-        } if(z&S && GamePtr<6) v+=(rand()>>10&31)-16;
+         i+=V+abs(w[b[y]&15])-w[p];            /* promotion / passer bonus */
+        }
+        if(z&S){
+         if(map[x+S*y]){v=-I;goto S;}          /* skip if excluded move    */
+         if(GamePtr<6&Randomize)v+=(Rand()>>10&31)-16;   /* randomize      */
+        }
         J+=J(0);Z+=J(4)+G-S;
         SHAMAX( pl[k]-=!!t; )                  /* count pieces per side    */
         v+=e+i;V=m>q?m:q;                      /*** new eval & alpha    ****/
         if(z&S)V=m-margin>q?m-margin:q;        /* multiPV                  */
         C=d-1-(d>5&p>2&!t&!h);                 /* nw depth, reduce non-cpt.*/
         C=R<EG|P-I|d<3||t&&w[p]>0?C:d;         /* extend 1 ply if in-check */
+        if(bareK)C=p==bareK&&2&b[769+x]?d+1:d-1; /* corner-leave extension */
         do
          s=C>2|v>V?-D(16-k,-l,-V,-v,/*** futility, recursive eval. of reply */
                                      F,y&255,C):v;
@@ -226,31 +262,32 @@ int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
         if(v>V&v<l){int *p=sp;
          sp=ps+1;
          W(*sp++=*p++);
-         *ps=256*x+y;
+         *ps=512*x+y;
         }
-        if(z&S&&K-I)                           /* move pending: check legal*/
+        if(z&8*S&&K-I)                         /* move pending: check legal*/
         {if(v+I&&x==K&y==L&gt==GT)             /*   if move found          */
-         {Q=-e-i;O=F;LL=L;prom=gt;
+         {Q=-e-i;O=F;LL=L;prom=gt&15;
           if(b[y]-u&15)prom=b[y]-=PromPiece,   /* (under-)promotion:       */
-           Q-=abs(w[prom&=15])-w[p]-(6*S>>sh), /*  correct piece & score & */
+           Q-=abs(w[prom&=15]),Q+=w[prom+PromPiece], /*  correct piece & score & */
                        Z+=PromPiece;           /*  invalidate hash         */
           a->D=99;a->V=0;                      /* lock game in hash as draw*/
-          R-=i/FAC;                            /*** total captd material ***/
+          R2-=i/FAC;                           /*** total captd material ***/
           Fifty = t|p<3?0:Fifty+1;
+          if(centr[p]>2)bareL=y;               /* remember location bare K */
           sp=ps;
                      return l;}                /*   & not in check, signal */
          v=m;                                  /* (prevent fail-lows on    */
         }                                      /*   K-capt. replies)       */
-        SHAMAX( pl[k]+=!!t; ) pl[t&31]+=!!t;
+        SHAMAX( pl[k]+=!!t; ) S:pl[t&31]+=!!t;
         b[G]=rk;b[FF]=b[y]=0;b[x]=u;b[H]=t;    /* undo move,G can be dummy */
        }                                       /*          if non-castling */
-       if(z&S&&K==I&d>2&v>V&v<l){int *p=ps;char X,Y;
+       if(z&S&&!ab&K==I&d>2&v>V&v<l){int *p=ps;char X,Y;
         if(Post){
-         printf("%2d ",d-2);
-         printf("%6d ",v);
+         printf("%2d ",d-2); score=v;
+         printf("%6d ", v > I-S ? 100000+I-v : v < S-I ? -100000-I-v : v);
          printf("%8d %10d",(GetTickCount()-Ticks)/10,N);
-         while(*p){X=*p>>8;Y=*p++;
-         printf(" %c%c%c%c",'a'+(X&15),'8'-(X>>4),'a'+(Y&15),'8'-(Y>>4&7));}
+         while(*p){X=*p>>9;Y=*p++;
+         printf(" %c%d%c%d",'a'+(X&15),BH-(X>>4&15)-(BH==10),'a'+(Y&15),BH-(Y>>4&15)-(BH==10));}
          printf("\n");fflush(stdout);
         }GT=gt;                                /* In root, remember gated  */
        }
@@ -262,29 +299,31 @@ int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
         W(++gt<k+43)if(pl[gt-27]){             /* look if more to gate     */
          pl[gt-27]--;v=10;goto G;              /* remove from hand & retry */
        }}
-       J=f;Z=g;
+       J=f;Z=g;                                /* restore hash keys        */
+       if(ab){a->F&=6;sp=ps;return 0;}         /* unwind search to abort   */
        if(h){h=0;goto A;}                      /* redo after doing old best*/
       }
-      s=t;v=r^flag>>12;                        /* calc. alternated vector  */
-      if(flag&15^4|u&32||                      /* no double or moved before*/
-         p>2&!(flag&S)&&                       /* no P & no virgin jump,   */
-         ((b[G=r<0?x&~15:BW-1|x&112]^32)<33    /* no virgin R in corner G, */
-         ||b[G^1]|b[G^2]|b[FF=y+v-r])          /* no 2 empty sq. next to R */
+      s=t&&2&~rg|~t&16^k;v=r^flag>>RBITS;      /* platform & toggled vector*/
+      if(flag&15^4|u&vf||                      /* no double or moved before*/
+         p>2&!(flag&128)&&                     /* no P & no virgin jump,   */
+         ((b[G=x&~15|(r>0)*(BW-1)]^32)<33      /* no virgin R in corner G, */
+         ||b[G-r]|b[G-2*r]|b[FF=y+v-r]|b[y+r]) /* no 2 empty sq. next to R */
         )t+=flag&4;                            /* fake capt. for nonsliding*/
-      else if(flag&64)t=flag&128?0:t,flag&=63;else F=y; /* enable e.p.     */
-      if(s&&flag&8)t=0,flag^=flag>>4&15;       /* hoppers go to next phase */
-      if(--rg<0&!(flag&S))                     /* zig-zag piece? (w. delay)*/
+      else if(flag&64)t=flag&128?0:t,flag&=63; /* e.p-immune initial step  */
+      else F=y+(p<3)*(ep&~u<<8);               /* set e.p. rights          */
+      if(s&&flag&8&&!(y=rg&1?y-r:y,t=0)        /* hoppers go to next phase */
+         ||!(flag&128)&&!rg--)                 /* zig-zag piece? (w. delay)*/
        r=v,flag^=flag>>4&15;                   /* alternate vector & mode  */
      }W(!t);                                   /* if not capt. continue ray*/
    }}
-   if((++x&15)>=BW)x=x+16&112;                 /* next sqr. of board, wrap */
+   if((++x&15)>=BW)x=x>BE?0:x+16&~15;          /* next sqr. of board, wrap */
   }W(x-B);           
-C:FMAX( m=m+I|P==I?m:(X=Y=0); )                /* if stalemate, draw-score */
+C:FMAX( m=m+stale|P==I?m:(X=Y=0); )            /* if stalemate, draw-score */
   if(a->D<99)                                  /* protect game history     */
    a->K=Z,a->V=m,a->D=d,a->X=X,                /* always store in hash tab */
-   a->F=8*(m>q)|S*(m<l),a->Y=Y;                /* move, type (bound/exact),*/
-  }                                            /*    encoded in X S,8 bits */
-if(z&4*S)K=X,L=Y&~S;
+   a->F=4*(m>q)|2*(m<l),a->Y=Y&S?Y+1:0;        /* move, type (bound/exact),*/
+ }                                             /*    encoded in X 2,4 bits */
+ if(z&4*S)K=X,L=Y&~S;
  sp=ps;
  return m+=m<e;                                /* delayed-loss bonus       */
 }
@@ -322,7 +361,7 @@ if(z&4*S)K=X,L=Y&~S;
 /* define this to the codes used in your engine,     */
 /* if the engine hasn't defined it already.          */
 
-int PrintResult(int s)
+int PrintResult(int s, int mode)
 {
         int j, k, cnt=0;
 
@@ -337,14 +376,12 @@ int PrintResult(int s)
             /* is the same, count it */
             if(++cnt > 1) /* third repeat */
             {
-                printf("1/2-1/2 {Draw by repetition}\n");
+                if(mode != EMPTY) printf("1/2-1/2 {Draw by repetition}\n");
                 return 1;
             }
           differs: ;
         }
-
-
-        K=I;
+        K=I;ab=0;
         cnt = D(s,-I,I,Q,O,LL|4*S,3);
 #ifdef SHATRANJ
         if(pl[s]==1 && pl[16-s]==1) {
@@ -375,8 +412,8 @@ int PrintResult(int s)
                 }
                 return 3;
         }
-        if(Fifty >=100) {
-                printf("1/2-1/2 {Draw by fifty move rule}\n");
+        if(Fifty >= 2*drawMoves) {
+                if(mode != EMPTY) printf("1/2-1/2 {Draw by fifty move rule}\n");
                 return 4;
         }
         return 0;
@@ -385,8 +422,8 @@ int PrintResult(int s)
 
 void InitEngine()
 {
- N=32*S+7;W(N-->S+3)T[N]=rand()>>9;
- srand(GetTickCount());
+ N=32*S+7;W(N-->S+3)T[N]=Rand()>>9;
+ seed=GetTickCount();
 }
 
 void InitGame()
@@ -398,21 +435,26 @@ void InitGame()
  for(i=0;i<16*BH;i++)b[i]=0;
  for(i=0;i<32;i++)pl[i]=0;
  K=BW;W(K--)
- {b[K]=oo[K+16]+16;b[K+112]=oo[K];b[K+16+16*!!makruk]=18;b[K+96-16*!!makruk]=1; /* initial board setup*/
+ {b[K]=oo[K+16]+16;b[K+(BH-1)*16]=oo[K];b[K+16*pRank]=18;b[K+(BH-1-pRank)*16]=1; /* initial board setup*/
   pl[oo[K+16]+16]++;pl[oo[K]]++;pl[18]++;pl[1]++;
   if(w[oo[K+16]+16] == -1)pl[oo[K+16]+16]=1;
   if(w[oo[K]] == -1)pl[oo[K]]=1;
-  L=8;W(L--)b[16*L+K+257]=(K-BW/2)*(K-BW/2)+(L-3.5)*(L-3.5); /* center-pts table   */
- }                                                   /*(in unused half b[])*/
+  L=BH;W(L--)b[16*L+K+513]=(K-BW/2+hill/2.)*(K-BW/2+hill/2.)+(L-(BH-1)/2.)*(L-(BH-1)/2.),pt[16*L+K]=0; /* center-pts table   */
+  pt[K+16]=pt[K+32]=pt[K+(BH-3)*16]=pt[K+(BH-2)*16]=64;pt[K+16*zone]=6-128;pt[K+(BH-1-zone)*16]=5-128; /* promotion bonus & piece upgrade */
+  if(pRank == 3) L=oo[K-(w[oo[K]]<0)],pt[K]=L-129,pt[K+(BH-1)*16]=L-130;
+ }
+ b[769+16*3+BW/2]=b[769+16*4+BW/2]=b[769+16*3+BW/2-1]=b[769+16*4+BW/2-1]=1; /* hill */
+ b[769]=b[769+16*(BH-1)]=b[769+16*(BH-1)+BW-1]=b[769+BW-1]=2;            /* corners */
  for(i=0; i<BW; i++) {
   R += abs(w[oo[i]])/FAC + abs(w[oo[i+16]])/FAC;
   Q += abs(w[oo[i]]) - abs(w[oo[i+16]]) + w[1] - w[2];
   if(w[oo[i]] < 0) k = w[oo[i]];
  }
- R -= 2*(-k/FAC);
+ RR = R2 = R -= 2*(-k/FAC);
  pl[WHITE] = pl[BLACK] = 2*BW; 
  pm = !pl[BLACK+7] && pl[BLACK+9] && pl[WHITE+7] ? 2 : 0; // Unlike white, black has no 'Q', so promote to 9, which he does have.
- if(gating) pl[14] = pl[15] = pl[30] = pl[31] = 1, R += 2*(w[9]/FAC + w[10]/FAC);
+ K=BW;W(K--)pt[K+(BH-1)*16]+=pm; // alter black promotion choice
+ if(gating) pl[14] = pl[15] = pl[30] = pl[31] = 1, R2 = R += 2*(w[9]/FAC + w[10]/FAC);
 }
 
 void CopyBoard(int s)
@@ -431,7 +473,7 @@ void PrintVariants(int combo)
         int count=0, total=0; char c=EOF+1, buf[80];
         FILE *f;
 
-        f = fopen(INI_FILE, "r");
+        f = fopen(inifile, "r");
         if(f==NULL) return;
 
         /* search for game names in definition file */
@@ -454,6 +496,7 @@ void PrintOptions()
 {
 	printf("feature option=\"Resign -check %d\"\n", Resign);
 	printf("feature option=\"Resign Threshold -spin %d 200 1200\"\n", Threshold);
+	printf("feature option=\"Claim draw after -spin %d 0 200\"\n", drawMoves);
 	printf("feature option=\"Ini File -file %s\"\n", inifile);
 	printf("feature option=\"Multi-PV Margin -spin %d 0 1000\"\n", margin);
 	printf("feature option=\"Variant fairy selects -combo "); PrintVariants(1); printf("\"\n");
@@ -461,13 +504,26 @@ void PrintOptions()
 	printf("feature option=\"Dummy Slider Example -slider 20 0 100\"\n");
 	printf("feature option=\"Dummy String Example -string happy birthday!\"\n");
 	printf("feature option=\"Dummy Path Example -path .\"\n");
+	printf("feature option=\"Automatic persistent-hash dialog -check %d\"\n", popup);
+	printf("feature option=\"Info -button\"\n");
+	printf("feature option=\"Save in hash file -button\"\n");
 	printf("feature option=\"Clear Hash -button\"\n");
 	printf("feature done=1\n");
 }
                                          
+void LoadHash(char *dir, char *name)
+{       // read persistent-hash file into hash table as protected entries that always cause cutoff
+        FILE *f;
+        snprintf(hashfile, 256, "%s/%s.hash", dir, name);
+        if(f = fopen(hashfile, "r")) {
+            while(fscanf(f, "%x:%x=%d", &J, &Z, &j) == 3) J&=U, A[J].V=j, A[J].K=Z, A[J].D=99, A[J].F=6;
+            fclose(f);
+        }
+}
+
 void LoadGame(char *name)
 {
-        int i, j, ptc, count=0; char c, buf[80], pieceToChar[80], parent[80];
+        int i, j, ptc=0, count=0, step2; char c, buf[80], pieceToChar[200], parent[80];
         static int currentVariant;
         FILE *f;
 
@@ -486,7 +542,9 @@ void LoadGame(char *name)
            if(!strcmp(name, "fairy")) name = selectedFairy;
            gating = !strcmp(name, "seirawan");
            while((ptc=fscanf(f, "Game: %s # %s # %s", buf, pieceToChar, parent))==0 || strcmp(name, buf) ) {
-               while((c = fgetc(f)) != EOF && c != '\n');
+               char *p = info;
+               while((c = fgetc(f)) != EOF && c != '\n') *p++ = c;
+               if(*info == '/') *p = 0; else *info = 0; // remember last line before Game if it was comment
                count++;
                if(c == EOF) {
                    printf("telluser variant %s not supported\n", name);
@@ -498,9 +556,10 @@ void LoadGame(char *name)
         }
 
         /* We have found variant, or if none specified, are at beginning of file */
-        if(fscanf(f, "%dx%d", &BW, &BH)!=2 || BW>12 || BH!=8)
+        if(fscanf(f, "%dx%d", &BW, &BH)!=2 || BW>12 || BH>16)
         { printf("telluser unsupported board size %dx%d\n",BW,BH); exit(0); }
-        makruk = 0; if(fscanf(f, "=%d", &i)) makruk=64; // new method to indicate deviant zone depth (for now assumes 3)
+        BE = (BH-1)*16 + BW-1; CONS = 799 + 16*(BH-8);   // highest valid square number and move-conversion constant
+        i = 1; fscanf(f, "=%d", &i); zone = i - 1;       // new method to indicate deviant zone depth
 
         for(i=0; i<BW; i++) fscanf(f, "%d", oo+i);
         for(i=0; i<BW; i++) fscanf(f, "%d", oo+i+16);
@@ -508,52 +567,59 @@ void LoadGame(char *name)
             A[i].K = A[i].D = A[i].X = A[i].Y = A[i].F = 0; /* clear hash */
         for(i=0; i<32; i++) piecetype[i] = blacktype[i] = 0;
 
-        i=0; j=-1; c=0;
-        while(fscanf(f, "%d,%x", o+j, of+j)==2 ||
+        i=0; j=-1; c=0; ep=1<<20; stale=I; bk=1; bareK=0; bareL=-1; step2 = 666;
+        while(fscanf(f, "%d,%x,%d", o+j, of+j, &step2)>=2 ||
                                       fscanf(f,"%c:%d",&c, w+i+1)==2)
         {   if(c)
             { od[++i]=j; centr[i] = c>='a';
               blacktype[c&31]=i; piecename[i]=c&31;
               if(piecetype[c&31]==0) piecetype[c&31]=i; // only first
               succession |= w[i] < -4;         // expendable royalty; assume we can promote to it
+              if(w[i]<0) wk=bk, bk=i;  // remember royals
             }
+            if(step2 != 666) of[j] += (step2 ^ o[j]) << RBITS, step2 = 666; // compute toggle-vector from 3rd move parameter
             j++; o[j]=0;
             /* printf("# c='%c' i=%d od[i]=%d j=%d (%3d,%8x)\n",c?c:' ',i,od[i],j,o[j-1],of[j-1]); /**/
             c=0; if(i>15 || j>255) break;
         }
 
-        fclose(f);
-	sh = w[7] < 250 ? 3 : 0;
+	if(BH == 10 && o[0] == -16 && of[0] & 0xC00) ep += 16<<9; // pawn with triple-push
+	sh = w[7] < 250 ? 3 : 0; hill = (w[3] == -2); stale -= (w[9] == -2); pRank = (zone ? zone : 1);
+        if(zone < 0) pRank = -1-zone, zone = 0; // negative =N suffix is kludge for configuring Pawn rank
         if(ptc > 1) { // setup board in GUI, by sending it pieceToCharTable and FEN
             if(ptc == 2) printf("setup (%s) ", pieceToChar);
             else printf("setup (%s) %dx%d+0_%s ", pieceToChar, BW, BH, parent);
             for(i=0; i<BW; i++) printf("%c", piecename[oo[i+16]]+'`'); printf("/");
-            if(makruk) printf("8/");
+            for(i=1; i<pRank; i++) printf("8/");
             for(i=0; i<BW; i++) printf("%c", piecename[2]+'`'); printf("/");
-            for(i=2+!!makruk; i<BH-2-!!makruk; i++) printf("%d/", BW);
+            for(i=1+pRank; i<BH-1-pRank; i++) printf("%d/", BW);
             for(i=0; i<BW; i++) printf("%c", piecename[1]+'@'); printf("/");
-            if(makruk) printf("8/");
-            for(i=0; i<BW; i++) printf("%c", piecename[oo[i]]+'@'); printf(" w KQkq - 0 1\n");
+            for(i=1; i<pRank; i++) printf("8/");
+            for(i=0; i<BW; i++) printf("%c", oo[i] ? piecename[oo[i]]+'@' : '1'); printf(" w KQkq - 0 1\n");
         }
+	while(fscanf(f, " # %[^\n]", pieceToChar)) printf("piece %s\n", pieceToChar);
+        fclose(f);
+        LoadHash(FAIRYDIR, name); LoadHash(".", name); // initialize persistent hash
 }
 
 int main(int argc, char **argv)
 {
         int Computer, MaxTime, MaxMoves, TimeInc, sec, i;
-        char line[256], command[256], c;
-        int m, nr;
+        char line[256], command[256], c, ff, ft;
+        int m, nr, rf, rt;
         double cpuT;
 
+        if(argc > 1 && !strcmp(argv[1], "-v")) argc++, argv--, printf("%s\n", VERSION), exit(0);
+
         if(argc>1 && sscanf(argv[1], "%d", &m)==1)
         { U = (1<<m)-1; argc--; argv++; }
         A = (struct _ *) calloc(U+1, sizeof(struct _));
         if(argc>1) inifile = argv[1];
 
 	signal(SIGINT, SIG_IGN);
+	setvbuf(stdin, NULL, _IONBF, 0); // suppress input buffering
         printf("tellics say     " NAME " " VERSION "\n");
         printf("tellics say     by H.G. Muller\n");
-        printf("tellics say Gothic Chess is protected by U.S. patent #6,481,716 by Ed Trice.\n");
-        printf("tellics say Falcon Chess is protected by U.S. patent #5,690,334 by George W. Duke\n");
         InitEngine();
         LoadGame(NULL);
         InitGame();
@@ -563,6 +629,17 @@ int main(int argc, char **argv)
 
         for (;;) {
 		fflush(stdout);
+                PromPiece = 0; /* Always promote to Queen ourselves */
+                for(N=K=0;K<S;K++)N+=b[K]?b[K]&16?S:1:0; /* count pieces for detecting bare King */
+                if(w[wk]<0&w[bk]<0){if(N<2*S)bareK=bk;if(!(N&S-2))bareK=wk;}
+                R = R2 - 2*abs(Q)/(3*FAC); if(R < 0) R=0;  /* treat strongly unbalanced as if later game phase */
+                if(bareK)centr[bareK]=1+Fifty/10,R=4;
+                SETKEY(J,0); SETKEY(Z,4); /* absolutize key, so it can be used for persistent hash */
+                K=(bareL&15);L=bareL>>4;
+                if(!K|K==BW-1&&!L|L==BH-1&&b[513+bareL])
+                 for(i=0;i<BH;i++)for(m=0;m<BW;m++)b[513+16*i+m]=abs(abs(i-L)-abs(m-K));
+                if(hill) centr[3] = R>20 ? 1 : 22-R;
+                Ticks = GetTickCount();
                 if (Side == Computer) {
                         /* think up & do move, measure time used  */
                         /* it is the responsibility of the engine */
@@ -573,21 +650,23 @@ int main(int argc, char **argv)
                         /* If MovesLeft<0 all remaining moves of  */
                         /* the game have to be done in this time. */
                         /* If MaxMoves=1 any leftover time is lost*/
-                        Ticks = GetTickCount();
                         cpuT = CPUtime(); printf("# times @ %u\n", Ticks);
                         m = MovesLeft<=0 ? 40 : MovesLeft;
                         tlim = (0.6-0.06*(BW-8))*(TimeLeft+(m-1)*TimeInc)/(m+7);
                         if(tlim>TimeLeft/15) tlim = TimeLeft/15;
-                        PromPiece = 0; /* Always promote to Queen ourselves */
-                        N=0;K=I;
-                        if (D(Side,-I,I,Q,O,LL|S,3)==I) {
+printf("# %d+%d pieces, centr = (%d,%d) R=%d\n", N&63, N>>8, centr[wk], centr[bk], R);
+                        if(bareK|RR>4^R>4) // with bare King or after switching on or off null move
+                            for(i=0;i<=U;i++)if(A[i].D<99&&abs(A[i].V)<I-S)A[i].K=0; // clear hash
+                        N=ab=0;K=I;RR=R;
+                        if (D(Side,-I,I,Q,O,LL|9*S,3)==I) {
                             Side ^= BLACK^WHITE;
                             m = GetTickCount() - Ticks;
                             printf("# times @ %u: real=%d cpu=%1.0f\n", m + Ticks, m,
                                       (CPUtime() - cpuT)/CLOCKS_PER_SEC);
+printf("# promo = %d (%c) GT = %d\n", prom, piecename[prom]+'`', GT); 
                             printf("move ");
-                            printf("%c%c%c%c",'a'+(K&15),'0'+BH-(K>>4),
-                                          'a'+(L&15),'0'+BH-(L>>4));
+                            printf("%c%d%c%d",'a'+(K&15),BH-(K>>4)-(BH==10),
+                                              'a'+(L&15),BH-(L>>4)-(BH==10));
 			    if(prom)printf("%c",piecename[prom]+'a'-1);
                             printf("\n");
 
@@ -605,15 +684,20 @@ int main(int argc, char **argv)
                             CopyBoard(HistPtr=HistPtr+1&1023);
 			    if(Resign && Score <= -Threshold) { 
 				printf("resign\n"); Computer=EMPTY;
-                            } else if(PrintResult(Side))
+                            } else if(PrintResult(Side, Computer))
                                 Computer = EMPTY;
                         } else {
-                            if(!PrintResult(Side))
+                            if(!PrintResult(Side, Computer))
                                 printf("resign { refuses own move }\n");
                             Computer = EMPTY;
                         }
                         continue;
 		}
+		if(Computer == ANALYZE) {
+			if(popup-- == 1) popup++, printf("askuser remember Save score in hash file (OK/Cancel)?\n");
+                        N=ab=0;K=I;tlim=1e9;
+			D(Side,-I,I,Q,O,LL|S,3);
+		}
 		if (!fgets(line, 256, stdin))
 			return 1;
 		if (line[0] == '\n')
@@ -623,7 +707,7 @@ int main(int argc, char **argv)
 			continue;
                 if (!strcmp(command, "protover")) {
                         printf("feature myname=\"" NAME " " VERSION "\"\n");
-                        printf("feature memory=1\n");
+                        printf("feature memory=1 exclude=1\n");
                         printf("feature setboard=0 xedit=1 ping=1 done=0\n");
                         printf("feature variants=\"");
                         PrintVariants(0);
@@ -643,13 +727,21 @@ int main(int argc, char **argv)
                 if (!strcmp(command, "memory")) {
                         int mem, mask;
 			sscanf(line+6, "%d", &mem); mem = (mem*1024*1024)/12; // max nr of hash entries
-			mask = 0x7FFFFFFF; while(mask > mem) mask >>= 1;
+			mask = 0x3FFFFFF; while(mask > mem) mask >>= 1;
 			if(mask != U) {
 			    free(A); U = mask;
 			    A = (struct _ *) calloc(U+1, sizeof(struct _));
 			}
 			continue;
                 }
+#		define CLEAR(X) for(i=0; i<S*S; i++) map[i] = X
+		if (!strcmp(command+2, "clude")) { // include / exclude
+			char *c=line+8, K=c[0]-16*c[1]+CONS, L=c[2]-16*c[3]+CONS, r = *command - 'i';
+			if(!strcmp(line+8, "all\n")) CLEAR(r);
+			else map[K+S*L] = r;
+			continue;
+		}
+		CLEAR(0);
 		if (!strcmp(command, "new")) {
                         /* start new game */
                         LoadGame("normal");
@@ -660,6 +752,7 @@ int main(int argc, char **argv)
                         Computer  = BLACK;
                         TimeLeft  = MaxTime;
                         MovesLeft = MaxMoves;
+                        Randomize = 0;
                         for(nr=0; nr<1024; nr++)
                             for(m=0; m<STATE; m++)
                                 HistoryBoards[nr][m] = 0;
@@ -668,9 +761,15 @@ int main(int argc, char **argv)
 		if (!strcmp(command, "quit"))
                         /* exit engine */
 			return 0;
-		if (!strcmp(command, "force")) {
+		if (!strcmp(command, "analyze")) {
                         /* computer plays neither */
-                        Computer = EMPTY;
+                        Computer = ANALYZE; Randomize *= 2;
+			continue;
+		}
+		if (!strcmp(command, "exit") ||
+		    !strcmp(command, "force")) {
+                        /* computer plays neither */
+                        Computer = EMPTY; Randomize = (Randomize > 0);
 			continue;
 		}
 		if (!strcmp(command, "white")) {
@@ -739,8 +838,16 @@ int main(int argc, char **argv)
 			continue;
 		}
 		if (!strcmp(command, "random")) {
+			Randomize = !Randomize;
 			continue;
 		}
+		if (!strcmp(command, "remember")) {
+			FILE *f = fopen(hashfile, "a"); // add current position to persistent hash
+			sscanf(line+8, "%d", &score);   // user can overrule score
+			if(f) fprintf(f, "%08x:%08x=%d\n", J+(S+Side)*O, Z, score), fclose(f);
+			popup = 2; // suppresses repeat of popup on restart of analysis search
+			continue;
+               }
 		if (!strcmp(command, "option")) {
 			int i; static char filename[80];
 			if(sscanf(line+7, "Resign=%d", &Resign) == 1) continue;
@@ -749,9 +856,16 @@ int main(int argc, char **argv)
 				inifile = filename; continue;
 			}
 			if(sscanf(line+7, "Clear Hash%c", &c) == 1) for(i=0; i<=U; i++) A->K = 0;
+			if(sscanf(line+7, "Info%c", &c) == 1) printf("telluser %s\n", info+3);
 			if(sscanf(line+7, "MultiVariation Margin=%d", &margin) == 1) continue;
 			if(sscanf(line+7, "Variant fairy selects=%s", selectedFairy+6) == 1) continue;
 			if(sscanf(line+7, "Makruk rules=%s", Cambodian) == 1) continue;
+			if(sscanf(line+7, "Claim draw after=%d", &drawMoves) == 1) continue;
+			if(sscanf(line+7, "Automatic persistent-hash dialog=%d", &popup) == 1) continue;
+			if(sscanf(line+7, "Save in hash file%c", &c) == 1 && Computer == ANALYZE) {
+			     FILE *f = fopen(hashfile, "a"); // add current position to persistent hash
+			     if(f) fprintf(f, "%08x:%08x=%d\n", J+(S+Side)*O, Z, score), fclose(f);
+			}
 			continue;
 		}
 		if (!strcmp(command, "go")) {
@@ -763,13 +877,13 @@ int main(int argc, char **argv)
 			continue;
 		}
 		if (!strcmp(command, "hint")) {
-                        Ticks = GetTickCount(); tlim = 1000;
+                        Ticks = GetTickCount(); tlim = 1000; ab = 0;
                         D(Side,-I,I,Q,O,LL|4*S,6);
                         if (K==0 && L==0)
 				continue;
                         printf("Hint: ");
-                        printf("%c%c%c%c",'a'+(K&7),'8'-(K>>4),
-                                          'a'+(L&7),'8'-(L>>4));
+                        printf("%c%d%c%d",'a'+(K&15),BH-(K>>4)-(BH==10),
+                                          'a'+(L&15),BH-(L>>4)-(BH==10));
                         printf("\n");
 			continue;
 		}
@@ -786,15 +900,15 @@ int main(int argc, char **argv)
                                 HistoryBoards[HistPtr+nr+1&1023][m] = 0;
                         InitGame();
 			if(Setup) {
-			    for(i=0; i<128; i++) b[i] = setupPosition[i];
-			    for(i=0; i<32; i++) pl[i] = setupPosition[i+130];
-			    Side = setupPosition[128]; Q = SetupQ;
-			    R = setupPosition[129];
+			    for(i=0; i<S; i++) b[i] = setupPosition[i];
+			    for(i=0; i<32; i++) pl[i] = setupPosition[i+S+2];
+			    Side = setupPosition[S]; Q = SetupQ;
+			    R2 = setupPosition[S+1];
 			}
-			for(i=0; i<=U; i++) A[i].D = A[i].K = 0; // clear hash table
+			for(i=0; i<=U; i++) if(A[i].D == 99) A[i].D = A[i].K = 0; // clear game history from hash table
                         for(nr=0; nr<GamePtr; nr++) {
-                            UNPACK_MOVE(GameHistory[nr]);
-                            D(Side,-I,I,Q,O,LL|S,3);
+                            UNPACK_MOVE(GameHistory[nr]); SETKEY(J,0); SETKEY(Z,4);
+                            ab=0;D(Side,-I,I,Q,O,LL|9*S,3);
                             Side ^= BLACK^WHITE;
                         }
 			continue;
@@ -820,7 +934,7 @@ int main(int argc, char **argv)
                                 m = line[0];
                                 if(m=='.') break;
                                 if(m=='#') {
-                                        for(i=0; i<128; i++) b[i]=0;
+                                        for(i=0; i<S; i++) b[i]=0;
                                         for(i=0; i<32; i++) pl[i]=0;
                                         Q=0; R=0; O=S;
                                         pl[WHITE]=pl[BLACK]=0;
@@ -840,22 +954,23 @@ int main(int argc, char **argv)
                                         continue;
                                     } else
                                     if(line[1] >= 'a' && line[1] <= 'a'+BW-1
-                                    && line[2] >= '1' && line[2] <= '0'+BH) {
-                                        m = line[1]-16*line[2]+799; r = m & 0x70;
+                                    && line[2] >= '0' && line[2] <= '0'+BH) {
+                                        line[2] = '0' + atoi(line + 2) + (BH==10); // allow 2-digit rank
+                                        m = line[1]-16*line[2]+CONS; r = m & 0xF0;
                                         switch(p)
                                         {
                                         case 1:
                                         case 2:
                                             if(color==WHITE)
-                                                 b[m]=r==0x10?161:r==0x20?97:r==0x60?1:33,
-                                                 Q+=w[1]+(r==0x10?S:r==0x20?64:0);
-                                            else b[m]=r==0x60?178:r==0x50?114:r==0x10?18:50,
-                                                 Q+=w[2]+(r==0x60?S:r==0x50?64:0);
+                                                 b[m]=r==0x10?161:r==0x20?97:r==16*(BH-2)?1:33,
+                                                 Q+=w[1]+(r==0x10?128:r==0x20?64:0);
+                                            else b[m]=r==16*(BH-2)?178:r==16*(BH-3)?114:r==0x10?18:50,
+                                                 Q+=w[2]+(r==16*(BH-2)?128:r==16*(BH-3)?64:0);
                                             break;
                                         default:
                                             b[m]=p+color+32; // assume non-virgin
 					    if(color==BLACK && m<0x10 && p==oo[m+16] || // but make virgin on original square
-                                               color==WHITE && m>0x6F && p==oo[m-0x70]) b[m] -= 32;
+                                               color==WHITE && m>=16*(BH-1) && p==oo[m-16*(BH-1)]) b[m] -= 32;
                                             if(w[p]<0) { // Royal piece on original square: virgin
                                                 Q-=w[p]; // assume value was flipped to indicate royalty
                                                 if(pl[p+color])R-=w[p]/FAC; // capturable King, add to material
@@ -871,21 +986,21 @@ int main(int argc, char **argv)
                         }
                         if(Side != color) Q = -Q;
 			GamePtr = HistPtr = 0; Setup = 1; SetupQ = Q; // start anew
-			for(i=0; i<128; i++) setupPosition[i] = b[i]; // remember position
-			setupPosition[128] = Side;
-			setupPosition[129] = R;
-			for(i=0; i<32; i++) setupPosition[i+130] = pl[i];
+			for(i=0; i<S; i++) setupPosition[i] = b[i]; // remember position
+			setupPosition[S] = Side;
+			setupPosition[S+1] = RR = R2 = R;
+			for(i=0; i<32; i++) setupPosition[i+S+2] = pl[i];
 			Computer = EMPTY; // after edit: force mode!
 			continue;
 		}
                 /* command not recognized, assume input move */
-                m = line[0]<'a' | line[0]>='a'+BW | line[1]<'1' | line[1]>='1'+BH |
-                    line[2]<'a' | line[2]>='a'+BW | line[3]<'1' | line[3]>='1'+BH;
-                if(line[4] == '\n') line[4] = 0;
-                GT = (Side == WHITE ? piecetype : blacktype)[line[4]&31];
-                if(GT) PromPiece = (Side == WHITE ? 7 : 7+pm) - GT, GT |= 32 + Side;
-                {char *c=line; K=c[0]-16*c[1]+799;L=c[2]-16*c[3]+799; }
-                if(w[GT&15] == -1) L = S; // spoil move for promotion to King
+                GT = 0; m = (sscanf(line, "%c%d%c%d%c", &ff, &rf, &ft, &rt, &c) < 5);
+                if(BH==10)rf++,rt++;
+                if(c != '\n') GT = (Side == WHITE ? piecetype : blacktype)[c&31];
+                K=ff-16*(rf+'0')+CONS;L=ft-16*(rt+'0')+CONS;
+                if(GT) PromPiece = (pt[L]&15) + 1 + (Side == BLACK) - GT, GT |= 32 + Side;
+                if(w[GT&15] == -1 || w[GT&15]%10 == 3) L = S; // spoil move for promotion to King (or when marked non-promoting)
+                if(pRank == 3 && PromPiece) L = S;            // no promotion choice, spoil move if not default piece
                 if (m & line[1] != '@')
                         /* doesn't have move syntax */
 			printf("Error (unknown command): %s\n", command);
@@ -894,7 +1009,8 @@ int main(int argc, char **argv)
                     { i=K; K = L; L = i>L ? i-1 : i+2; }
 		    if(w[GT&15] < -1) pl[GT&31]++, J+=89729; // promotion to royal piece
                     if((b[K]&15) < 3) GT = 0; // Pawn => true promotion rather than gating
-                    if(D(Side,-I,I,Q,O,LL|S,3)!=I) {
+                    ab=0;
+                    if(D(Side,-I,I,Q,O,LL|9*S,3)!=I) {
                         /* did have move syntax, but illegal move */
                         printf("Illegal move:%s\n", line);
                     } else {  /* legal move, perform it */
@@ -902,9 +1018,10 @@ int main(int argc, char **argv)
                         GameHistory[GamePtr++] = PACK_MOVE;
                         Side ^= BLACK^WHITE;
                         CopyBoard(HistPtr=HistPtr+1&1023);
-                        if(PrintResult(Side)) Computer = EMPTY;
+                        if(PrintResult(Side, Computer) && Computer != ANALYZE) Computer = EMPTY;
 		    }
 
 		}
 	}
+	return 0;
 }
diff --git a/fairymax.pod b/fairymax.pod
index 0c50363..52214e2 100644
--- a/fairymax.pod
+++ b/fairymax.pod
@@ -17,10 +17,15 @@ B<maxqi> [hashSize] [iniFile]
 B<fairymax> is a program that plays chess and chess variants. 
 It uses the xboard/winboard chess-engine protocol to communicate.
 Apart from 'regular' chess (also known as the Mad-Queen variant),
-it can play Capablanca chess, gothic chess, knightmate, cylinder chess, 
-berolina chess, superchess, makruk (Thai chess, also with Cambodian rules), 
+it can play Capablanca chess, gothic chess, janus chess, knightmate, cylinder chess, 
+berolina chess, superchess, makruk (Thai chess, and also some of its
+variants, Cambodian chess (Ouk), asean chess and ai-wok),
 courier chess, Seirawan chess, Spartan chess, falcon chess, great shatranj,
-shuffle chess without castling and chess with different armies.
+team-mate chess, charge of the light brigade, king of the hill, bifurcator chess,
+Los-Alamos chess, Mexican chess, Ciccolini's chess, grande acedrex,
+wildebeest chess (almost),
+shuffle chess without castling and chess with different armies
+(all combinations of the FIDE, Clobberers, Nutters and Rookies armies).
 Fairy-Max can be easily configured by the user to play other variants as well,
 by modifying the ini file.
 This ini file describes the rules of movement
@@ -29,8 +34,11 @@ of the participating pieces and the initial board setup.
 Fairy-Max can also play shatranj, 
 but in this case is not aware of the shatranj rule that a bare king loses.
 So it might play sub-optimally in the late end-game.
-A version of Fairy-Max adapted to implement the baring rule is
-available under the name B<shamax>.
+A version of Fairy-Max adapted to implement the baring rule
+(and the rule that stalemate is a win)
+is available under the name B<shamax>.
+Grande Acedrex and Courier Chess might also have had a baring rule,
+so you may want to play these with shamax instead of fairymax too.
 
 Similarly, a version of Fairy-Max adapted to play Xiang Qi (Chinese Chess)
 is included in the fairymax package as well, under the name B<maxqi>.
@@ -51,22 +59,26 @@ I/O routines that allow it to run with the xboard graphical user interface.
 
 See xboard(6) for instructions about how to use B<fairymax> through xboard. To
 start up quickly, you just need the command: B<xboard -fcp fairymax>.
-However, XBoard might not support symbols for every unorthodox piece in board sizes
-different from B<bulky>, B<middling> and B<petite>.
-It might thus be advisable to specify a board size as well, e.g.
-B<xboard -fcp shamax -boardSize middling -variant shatranj> 
-to get correct display of the elephant and general pieces in shatranj.
-Note that to be able to play the chess variants,
-you will need xboard 4.3.14 or later.
-
-Some of the variants Fairy-Max plays are only partially supported by XBoard,
-and can only be played whith the legality-testing function of the latter switched off.
-(This applies to cylinder chess, berolina chess, great shatranj,
-and chess with different armies.)
+Note that to be able to play the chess variants, it is recommended to use
+the latest XBoard version, as some of the recently added variants will use
+features not supported by older XBoard versions
+(in particular allowing an engine to reconfigure XBoard's ideas
+on the initial setup and how the pieces move).
+Problems with older XBoard versions might range from only being able to
+play the variant with legality testing switched off,
+inability to display some of the unorthodox pieces in board sizes other than
+B<Bulky>, B<Middling> or B<Petite>,
+not recognizing variants with non-standard names,
+to refusing even names that by now are standard XBoard variants.
+
 For some variants even the name is unknown to XBoard,
 and they are all grouped under the catchall name 'fairy'.
 Which variant is played by Fairy-Max when XBoard is set to 'fairy',
 can be determined by a combobox control in the XBoard 'Engine Settings' menu dialog.
+This currently applies to the various army combinations of chess with different armies.
+After having set this B<Variant fairy selects> option,
+activating XBoard's B<New game> menu when already in variant fairy,
+or selecting fairy from the B<New variant> menu dialog will then start the selected game.
 
 Fairymax supports multi-PV mode: by specifying a non-zero multi-PV margin in the
 Engine-Settings dialog of XBoard, Fairy-Max will not only print the
@@ -74,6 +86,7 @@ principal variation for the best move, but also for every move that approaches
 the score of this best move to within the set margin.
 (If it does not find the best move on the first try, this might lead to printing
 of a few extra lines below the threshold.)
+Fairy-Max now also supports analysis mode, and exclusion of moves from the analysis.
 
 The fmax.ini file from which Fairy-Max by default takes the piece and game definitions
 is a self-documenting text file,
@@ -91,8 +104,9 @@ such as the Chinese horse and elephant),
 limited-range sliders (upto range 5),
 and any combination thereof,
 in every possible direction.
-The board width is configurable upto a width of 14 squares,
+The board width is configurable upto a width of 14 files,
 and cylindrical boards (where left and right edge connect) are supported as well.
+The board height can be configured up to 16 ranks.
 
 =head1 OPTIONS
 
@@ -106,7 +120,7 @@ for its internal hash table.
 The default value for this argument, 22, would result in a memory usage of 48MB.
 Each next-higher number doubles the memory usage, each next-lower halves it.
 Running with less than 6MB (i.e. argument 19) is not recommended.
-When fairymax is running under xboard 4.3.15 the hash-table size can be set 
+When fairymax is running under xboard 4.3.15 or later the hash-table size can be set 
 through the xboard menus,
 making this argument superfluous.
 
@@ -128,7 +142,34 @@ and whether makruk is to be played with Thai or Cambodian rules
 You can also enable resigning, and set a score threshold for 
 when Fairy-Max should do it,
 and define the already mentioned multi-PV margin there.
-
+An 'Info' button in the settings dialog makes XBoard
+pop up a window with some info about the currently selected variant.
+
+=item B<Persistent hash>
+
+Some of the interactive options can be used to store the current position
+in a file bearing the name of the variant being played,
+with the extension '.hash' added to it, during analysis.
+Positions in that file will be loaded into Fairy-Max' hash table before
+every game, protected from overwrite.
+This can be used to create an opening or end-game book for the variant.
+The B<Save in hash file> button is convenient for saving the occasional position.
+For saving many positions in a row the option B<Automatic pesistent-hash dialog>
+can be ticked.
+This pops up a dialog at the start of every analysis search,
+in which the user then just has to press 'OK' to put the score from the analysis
+into the hash file.
+If a number is typed in that dialog before pressing 'OK',
+the position will be saved with that score (in centi-Pawn) rather than the score
+determined by the engine's own analysis.
+This can for instance be used to discourage opening lines the engine overrates.
+The file will be created in the current directory,
+but at the start of a game both this file,
+as well as one in Fairy-Max' private data files,
+will be loaded.
+The install does contain such a persistent hash file for makruk,
+to help Fairy-Max find the checkmate in the 'difficult' corners of the
+KMMMK and KNMMK (with like M) end-games.
 
 =back
 
diff --git a/windows/elephant.ico b/windows/elephant.ico
new file mode 100644
index 0000000..7715e4d
Binary files /dev/null and b/windows/elephant.ico differ
diff --git a/windows/fmax.rc b/windows/fmax.rc
new file mode 100644
index 0000000..a59ed58
--- /dev/null
+++ b/windows/fmax.rc
@@ -0,0 +1 @@
+ICON_WHITE              ICON    DISCARDABLE     "elephant.ico"
diff --git a/windows/fres.o b/windows/fres.o
new file mode 100644
index 0000000..451e95f
Binary files /dev/null and b/windows/fres.o differ

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/fairymax.git



More information about the Pkg-games-commits mailing list