Skip to content

Releases: niklasf/python-chess

python-chess v0.18.1

01 May 19:12
v0.18.1
Compare
Choose a tag to compare
Bugfixes:

* Crazyhouse drops were accepted as pseudo legal (and legal) even if the
  respective piece was not in the pocket.
* `CrazyhouseBoard.pop()` was failing to undo en passant moves.
* `CrazyhouseBoard.pop()` was always returning `None`.
* `Move.__copy__()` was failing to copy Crazyhouse drops.
* Fix ~ order (marker for promoted pieces) in FENs.
* Promoted pieces in Crazyhouse were not communicated with UCI engines.

Changes:

* `ThreeCheckBoard.uci_variant` changed from `threecheck` to `3check`.

python-chess v0.18.0

20 Apr 16:40
v0.18.0
Compare
Choose a tag to compare
Bugfixes:

* Fixed `Board.parse_uci()` for crazyhouse drops. Thanks to Ryan Delaney.
* Fixed `AtomicBoard.is_insufficient_material()`.
* Fixed signature of `SuicideBoard.was_into_check()`.
* Explicitly close input and output streams when a `chess.uci.PopenProcess`
  terminates.
* The documentation of `Board.attackers()` was wrongly stating that en passant
  capturable pawns are considered attacked.

Changes:

* `chess.SquareSet` is no longer hashable (since it is mutable).
* Removed functions and constants deprecated in v0.17.0.
* Dropped `gmpy2` and `gmpy` as optional dependencies. They were no longer
  improving performance.
* Various tweaks and optimizations for 5% improvement in PGN parsing and perft
  speed. (Signature of `_is_safe` and `_ep_skewered` changed).
* Rewritten `chess.svg.board()` using `xml.etree`. No longer supports *pre* and
  *post*. Use an XML parser if you need to modify the SVG. Now only inserts
  actually used piece defintions.
* Untangled UCI process and engine instanciation, changing signatures of
  constructors and allowing arbitrary arguments to `subprocess.Popen`.
* Coding style and documentation improvements.

New features:

* `chess.svg.board()` now supports arrows. Thanks to @rheber for implementing
  this feature.
* Let `chess.uci.PopenEngine` consistently handle Ctrl+C across platforms
  and Python versions. `chess.uci.popen_engine()` now supports a `setpgrp`
  keyword argument to start the engine process in a new process group.
  Thanks to @dubiousjim.
* Added `board.king(color)` to find the (royal) king of a given side.
* SVGs now have `viewBox` and `chess.svg.board(size=None)` supports and
  defaults to `None` (i.e. scaling to the size of the container).

python-chess v0.17.0

06 Mar 20:16
v0.17.0
Compare
Choose a tag to compare
Changes:

* Rewritten move generator, various performance tweaks, code simplications
  (500 lines removed) amounting to **doubled PGN parsing and perft speed**.
* Removed `board.generate_evasions()` and `board.generate_non_evasions()`.
* Removed `board.transpositions`. Transpositions are now counted on demand.
* `file_index()`, `rank_index()`, and `pop_count()` have been renamed to
  `square_file()`, `square_rank()` and `popcount()` respectively. Aliases will
  be removed in some future release.
* `STATUS_ILLEGAL_CHECK` has been renamed to `STATUS_RACE_CHECK`. The alias
  will be removed in a future release.
* Removed `DIAG_ATTACKS_NE`, `DIAG_ATTACKS_NW`, `RANK_ATTACKS` and
  `FILE_ATTACKS` as well as the corresponding masks. New attack tables
  `BB_DIAG_ATTACKS` (combined both diagonal tables), `BB_RANK_ATTACKS` and
  `BB_FILE_ATTACKS` are indexed by square instead of mask.
* `board.push()` no longer requires pseudo-legality.
* Documentation improvements.

Bugfixes:

* **Positions in variant end are now guaranteed to have no legal moves.**
  `board.is_variant_end()` has been added to test for special variant end
  conditions. Thanks to salvador-dali.
* `chess.svg`: Fixed a typo in the class names of black queens. Fixed fill
  color for black rooks and queens. Added SVG Tiny support. These combined
  changes fix display in a number of applications, including
  Jupyter Qt Console. Thanks to Alexander Meshcheryakov.
* `board.ep_square` was not consistently `None` instead of `0`.
* Detect invalid racing kings positions: `STATUS_RACE_OVER`,
  `STATUS_RACE_MATERIAL`.
* `SAN_REGEX`, `FEN_CASTLING_REGEX` and `TAG_REGEX` now try to match the
  entire string and no longer accept newlines.
* Fixed `Move.__hash__()` for drops.

New features:

* `board.remove_piece_at()` now returns the removed piece.
* Added `square_distance()` and `square_mirror()`.
* Added `msb()`, `lsb()`, `scan_reversed()` and `scan_forward()`.
* Added `BB_RAYS` and `BB_BETWEEN`.

python-chess v0.16.2

15 Jan 18:12
v0.16.2
Compare
Choose a tag to compare
Changes:

* `board.move_stack` now contains the exact move objects added with
  `Board.push()` (instead of normalized copies for castling moves).
  This ensures they can be used with `Board.variation_san()` amongst others.
* `board.ep_square` is now `None` instead of `0` for no en passant square.
* `chess.svg`: Better vector graphics for knights. Thanks to ProgramFox.
* Documentation improvements.

python-chess v0.16.1

12 Dec 20:44
v0.16.1
Compare
Choose a tag to compare
Bugfixes:

* Explosions in atomic chess were not destroying castling rights. Thanks to
  ProgramFOX for finding this issue.

python-chess v0.16.0

11 Dec 20:22
v0.16.0
Compare
Choose a tag to compare
Bugfixes:

* `pin_mask()`, `pin()` and `is_pinned()` make more sense when already
  in check. Thanks to Ferdinand Mosca.

New features:

* **Variant support: Suicide, Giveaway, Atomic, King of the Hill, Racing Kings,
  Horde, Three-check, Crazyhouse.** `chess.Move` now supports drops.
* More fine grained dependencies. Use *pip install python-chess[uci,gaviota]* to
  install dependencies for the full feature set.
* Added `chess.STATUS_EMPTY` and `chess.STATUS_ILLEGAL_CHECK`.
* The `board.promoted` mask keeps track of promoted pieces.
* Optionally copy boards without the move stack: `board.copy(stack=False)`.
* `examples/bratko_kopec` now supports avoid move (am), variants and
  displays fractional scores immidiately. Thanks to Daniel Dugovic.
* `perft.py` rewritten with multi-threading support and moved to
  `examples/perft`.
* `chess.syzygy.dependencies()`, `chess.syzygy.all_dependencies()` to generate
  Syzygy tablebase dependencies.

Changes:

* **Endgame tablebase probing (Syzygy, Gaviota):** `probe_wdl()` **,**
  `probe_dtz()` **and** `probe_dtm()` **now raise** `KeyError` **or**
  `MissingTableError` **instead of returning** *None*. If you prefer getting
  `None` in case  of an error use `get_wdl()`, `get_dtz()` and `get_dtm()`.
* `chess.pgn.BaseVisitor.result()` returns `True` by default and is no longer
  used by `chess.pgn.read_game()` if no game was found.
* Non-fast-forward update of the Git repository to reduce size (old binary
  test assets removed).
* `board.pop()` now uses a boardstate stack to undo moves.
* `uci.engine.position()` will send the move history only until the latest
  zeroing move.
* Optimize `board.clean_castling_rights()` and micro-optimizations improving
  PGN parser performance by around 20%.
* Syzygy tables now directly use the endgame name as hash keys.
* Improve test performance (especially on Travis CI).
* Documentation updates and improvements.

python-chess v0.15.3

21 Sep 16:37
Compare
Choose a tag to compare
Bugfixes:

* `pgn.Game.errors` was not populated as documented. Thanks to Ryan Delaney
  for reporting.

New features:

* Added `pgn.GameNode.add_line()` and `pgn.GameNode.main_line()` which make
  it easier to work with list of moves as variations.

python-chess v0.15.1

12 Sep 20:09
Compare
Choose a tag to compare
Bugfixes:

* Fix a bug where `shift_up_right()` and `shift_up_left()` were producing
  integers larger than 64bit when shifting squares off the board.

New features:

* Replaced __html__ with experimental SVG rendering for IPython.

python-chess v0.15.0

11 Aug 19:23
Compare
Choose a tag to compare
Changes:

* `chess.uci.Score` **no longer has** `upperbound` **and** `lowerbound`
  **attributes**. Previously these were always false.

* Significant improvements of move generation speed, around **2.3x faster
  PGN parsing**. Removed the following internal attributes and methods of
  the `Board` class: `attacks_valid`, `attacks_to`, `attacks_from`,
  `_pinned()`, `attacks_valid_stack`, `attacks_from_stack`, `attacks_to_stack`,
  `generate_attacks()`.

* UCI: Do not send *isready* directly after go. Though allowed by the UCI
  protocol specification it is just not nescessary and many engines were having
  trouble with this.

* Polyglot: Use less memory for uniform random choices from big opening books
  (reservoir sampling).

* Documentation improvements.

Bugfixes:

* Allow underscores in PGN header tags. Found and fixed by Bajusz Tamás.

New features:

* Added `Board.chess960_pos()` to identify the Chess960 starting position
  number of positions.

* Added `chess.BB_BACKRANKS` and `chess.BB_PAWN_ATTACKS`.

python-chess v0.14.1

07 Jun 21:03
Compare
Choose a tag to compare
Bugfixes:

* Backport Bugfix for Syzygy DTZ related to en-passant.
  See official-stockfish/Stockfish@6e2ca97d93812b2.

Changes:

* Added optional argument *max_fds=128* to `chess.syzygy.open_tablebases()`.
  An LRU cache is used to keep at most *max_fds* files open. This allows using
  many tables without running out of file descriptors.
  Previously all tables were opened at once.

* Syzygy and Gaviota now store absolute tablebase paths, in case you change
  the working directory of the process.

* The default implementation of `chess.uci.InfoHandler.score()` will no longer
  store score bounds in `info["score"]`, only real scores.

* Added `Board.set_chess960_pos()`.

* Documentation improvements.