From 0a8207c5bba7eac72a459e18be5cbd8df35b1704 Mon Sep 17 00:00:00 2001
From: H.G. Muller <h.g.muller@hccnet.nl>
Date: Sat, 16 Feb 2013 18:05:46 +0100
Subject: [PATCH] Fix check extension

Check extension in micro-Max was not be awarded when a piece other than King
captured the checker. In the code this was still tested assuming the piece
number of the King would always be 3, while in Fairy-Max every piece can be
Royal, based on the sign of its piece value w[]. In many game definitions
piece 3 was actually not a King at all.
---
 changelog  |    1 +
 fairymax.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/changelog b/changelog
index e8a3654..06089ba 100644
--- a/changelog
+++ b/changelog
@@ -110,6 +110,7 @@
           * Spurious result claims after under-promotion
           * False mate claims in Spartan when promotion to K was possible
           * Fix bug in Berolina e.p. capture that is actually non-capture
+          * Fix conditions for check extension on capture of checker
           * Fix Clear Hash option, which did not work at all
           * Fix addition of 6th & 7th-rank Pawn bonus when setting up position
           * Adapt score by true piece value in case of (under-)promotion
diff --git a/fairymax.c b/fairymax.c
index 6f420ae..769da7f 100644
--- a/fairymax.c
+++ b/fairymax.c
@@ -218,7 +218,7 @@ int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
         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&&p-3?C:d;            /* extend 1 ply if in-check */
+        C=R<EG|P-I|d<3||t&&w[p]>0?C:d;         /* extend 1 ply if in-check */
         do
          s=C>2|v>V?-D(16-k,-l,-V,-v,/*** futility, recursive eval. of reply */
                                      F,y&255,C):v;
-- 
1.7.0.4