Skip to content

Releases: niklasf/python-chess

python-chess v0.14.0

07 Apr 14:04
Compare
Choose a tag to compare
Changes:

* `Board.attacker_mask()` **has been renamed to** `Board.attackers_mask()` for
  consistency.

* **The signature of** `Board.generate_legal_moves()` **and**
  `Board.generate_pseudo_legal_moves()` **has been changed.** Previously it
  was possible to select piece types for selective move generation:

  `Board.generate_legal_moves(castling=True, pawns=True, knights=True, bishops=True, rooks=True, queens=True, king=True)`

  Now it is possible to select arbitrary sets of origin and target squares.
  `to_mask` uses the corresponding rook squares for castling moves.

  `Board.generate_legal_moves(from_mask=BB_ALL, to_mask=BB)`

  To generate all knight and queen moves do:

  `board.generate_legal_moves(board.knights | board.queens)`

  To generate only castling moves use:

  `Board.generate_castling_moves(from_mask=BB_ALL, to_mask=BB_ALL)`

* Additional hardening has been added on top of the bugfix from v0.13.3.
  Diagonal skewers on the last double pawn move are now handled correctly,
  even though such positions can not be reached with a sequence of legal moves.

* `chess.syzygy` now uses the more efficient selective move generation.

New features:

* The following move generation methods have been added:
  `Board.generate_pseudo_legal_ep(from_mask=BB_ALL, to_mask=BB_ALL)`,
  `Board.generate_legal_ep(from_mask=BB_ALL, to_mask=BB_ALL)`,
  `Board.generate_pseudo_legal_captures(from_mask=BB_ALL, to_mask=BB_ALL)`,
  `Board.generate_legal_captures(from_mask=BB_ALL, to_mask=BB_ALL)`.

python-chess v0.13.3

07 Apr 14:03
Compare
Choose a tag to compare
**This is a bugfix release for a move generation bug.** Other than the bugfix
itself there are only minimal fully backwardscompatible changes.
You should update immediately.

Bugfixes:

* When capturing en passant, both the capturer and the captured pawn disappear
  from the fourth or fifth rank. If those pawns were covering a horizontal
  attack on the king, then capturing en passant should not have been legal.

  `Board.generate_legal_moves()` and `Board.is_into_check()` have been fixed.

  The same principle applies for diagonal skewers, but nothing has been done
  in this release: If the last double pawn move covers a diagonal attack, then
  the king would have already been in check.

  v0.14.0 adds additional hardening for all cases. It is recommended you
  upgrade to v0.14.0 as soon as you can deal with the
  non-backwards compatible changes.

Changes:

* `chess.uci` now uses `subprocess32` if applicable (and available).
  Additionally a lock is used to work around a race condition in Python 2, that
  can occur when spawning engines from multiple threads at the same time.

* Consistently handle tabs in UCI engine output.

python-chess v0.13.2

19 Jan 12:51
Compare
Choose a tag to compare
Changes:

* `chess.syzygy.open_tablebases()` now raises if the given directory
  does not exist.

* Allow visitors to handle invalid `FEN` tags in PGNs.

* Gaviota tablebase probing fails faster for piece counts > 5.

Minor new features:

* Added `chess.pgn.Game.from_board()`.

python-chess v0.13.1

20 Dec 17:06
Compare
Choose a tag to compare
Changes:

* Missing *SetUp* tags in PGNs are ignored.

* Incompatible comparisons on `chess.Piece`, `chess.Move`, `chess.Board`
  and `chess.SquareSet` now return *NotImplemented* instead of *False*.

Minor new features:

* Factored out basic board operations to `chess.BaseBoard`. This is inherited
  by `chess.Board` and extended with the usual move generation features.

* Added optional *claim_draw* argument to `chess.Base.is_game_over()`.

* Added `chess.Board.result(claim_draw=False)`.

* Allow `chess.Board.set_piece_at(square, None)`.

* Added `chess.SquareSet.from_square(square)`.

python-chess v0.13.0

10 Nov 17:55
Compare
Choose a tag to compare
* `chess.pgn.Game.export()` and `chess.pgn.GameNode.export()` have been
  removed and replaced with a new visitor concept.

* `chess.pgn.read_game()` no longer takes an `error_handler` argument. Errors
  are now logged. Use the new visitor concept to change this behaviour.

python-chess v0.12.5

17 Oct 22:15
Compare
Choose a tag to compare
Bugfixes:

* Context manager support for pure Python Gaviota probing code. Various
  documentation fixes for Gaviota probing. Thanks to Jürgen Précour for
  reporting.

* PGN variation start comments for variations on the very first move were
  assigned to the game. Thanks to Norbert Räcke for reporting.

python-chess v0.12.4

13 Oct 16:11
Compare
Choose a tag to compare
Bugfixes:

* Another en passant related Bugfix for pure Python Gaviota tablebase probing.

New features:

* Added `pgn.GameNode.is_end()`.

Changes:

* Big speedup for `pgn` module. Boards are cached less agressively. Board
  move stacks are copied faster.

* Added tox.ini to specify test suite and flake8 options.

python-chess v0.12.3

09 Oct 08:35
Compare
Choose a tag to compare
Bugfixes:

* Some invalid castling rights were silently ignored by `Board.set_fen()`. Now
  it is ensured information is stored for retrieval using `Board.status()`.

python-chess v0.12.2

07 Oct 16:21
Compare
Choose a tag to compare
Bugfixes:

* Some Gaviota probe results were incorrect for positions where black could
  capture en passant.

python-chess v0.12.1

07 Oct 14:02
Compare
Choose a tag to compare
Changes:

* Robust handling of invalid castling rights. You can also use the new
  method `Board.clean_castling_rights()` to get the subset of strictly valid
  castling rights.