diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 03b1ad601..ded865033 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,14 @@ is more important to get things right, than to be consistent with previous versions. Use this changelog to see what changed in a new release, because this might include API breaking changes. +New in v0.12.2 +-------------- + +Bugfixes: + +* Some Gaviota probe results were incorrect for positions where black could + capture en passant. + New in v0.12.1 -------------- diff --git a/chess/__init__.py b/chess/__init__.py index c213f092f..c33480c88 100644 --- a/chess/__init__.py +++ b/chess/__init__.py @@ -20,7 +20,7 @@ __email__ = "niklas.fiekas@tu-clausthal.de" -__version__ = "0.12.1" +__version__ = "0.12.2" import copy import re diff --git a/chess/gaviota.py b/chess/gaviota.py index c0f3dc9e5..950ebbe3b 100644 --- a/chess/gaviota.py +++ b/chess/gaviota.py @@ -1863,7 +1863,7 @@ def _setup_tablebase(self, req): req.is_reversed = True req.egkey = black_letters + white_letters req.white_piece_squares = [flip_ns(s) for s in req.black_squares] - req.white_piece_tyoes = req.black_types + req.white_piece_types = req.black_types req.black_piece_squares = [flip_ns(s) for s in req.white_squares] req.black_piece_types = req.white_types @@ -1907,7 +1907,8 @@ def egtb_get_dtm(self, req): capturer_b = 0 xed = 0 - if (req.side == 0): + # Flip for move generation. + if req.side == 0: xs = list(req.white_piece_squares) xp = list(req.white_piece_types) ys = list(req.black_piece_squares) @@ -1945,6 +1946,12 @@ def egtb_get_dtm(self, req): xs[i] = req.epsq removepiece(ys, yp, j) + # Flip back. + if req.side == 1: + xs, ys = ys, xs + xp, yp = yp, xp + + # Make subrequest. subreq = Request(xs, xp, ys, yp, opp(req.side), NOSQUARE) try: epscore = self._tb_probe(subreq) diff --git a/data/endgame-dm-4.epd b/data/endgame-dm-4.epd index f68dd56f4..7be25027b 100644 --- a/data/endgame-dm-4.epd +++ b/data/endgame-dm-4.epd @@ -4,6 +4,11 @@ 1k1K4/8/8/pP6/8/8/8/8 w - a6 dm 0; 4k3/8/8/2p5/8/6P1/6K1/8 w - c6 dm 0; +7K/k7/8/Pp6/8/8/8/8 w - - dm -15; +7K/k7/8/Pp6/8/8/8/8 w - b6 dm 0; +8/8/8/8/pP6/8/K7/7k b - - dm -15; +8/8/8/8/8/1p6/K7/7k w - - dm 0; +8/8/8/8/pP6/8/K7/7k b - b3 dm 0; 8/7k/8/8/3p4/1K6/2P5/8 b - - dm -19; # Long endgames.