Skip to content

Commit

Permalink
Emergency Gaviota black en passant release
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Oct 7, 2015
1 parent 4cec6a1 commit 1383e5f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------

Expand Down
2 changes: 1 addition & 1 deletion chess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

__email__ = "[email protected]"

__version__ = "0.12.1"
__version__ = "0.12.2"

import copy
import re
Expand Down
11 changes: 9 additions & 2 deletions chess/gaviota.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions data/endgame-dm-4.epd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1383e5f

Please sign in to comment.