Recent Releases of python-chess
python-chess - python-chess v0.10.0
New dependencies:
- If you are using Python < 3.2 you have to install futures in order to
use the chess.uci module.
Changes:
- There are big changes in the UCI module. Most notably in async mode multiple
commands can be executed at the same time (e.g. go infinite and then
stop or go ponder and then ponderhit).
go infinite and go ponder will now wait for a result, i.e. you may have
to call stop or ponderhit from a different thread or run the commands
asynchronously.
stop and ponderhit no longer have a result.
- The values of the color constants chess.WHITE and chess.BLACK have been
changed. Previously WHITE was 0, BLACK was 1. Now WHITE is True,
BLACK is False. The recommended way to invert color is using
not color.
- The pseudo piece type chess.NONE has been removed in favor of just using
None.
- Changed the Board(fen) constructor. If the optional fen argument is not
given behavior did not change. However if None is passed explicitly an
empty board is created. Previously the starting position would have been
set up.
- Board.fen() will now only show completely legal en-passant squares.
- Board.set_piece_at() and Board.remove_piece_at() will now clear the
move stack, because the old moves may not be valid in the changed position.
- Board.parse_uci() and Board.push_uci() will now accept null moves.
- Changed shebangs from #!/usr/bin/python to #!/usr/bin/env python for
better virtualenv support.
- Removed unused game data files from repository.
Bugfixes:
- PGN: Prefer the game result from the game termination marker over * in the
header. These should be identical in standard compliant PGNs. Thanks to
Skyler Dawson for reporting this.
- Polyglot: minimum_weight for find(), find_all() and choice() was
not respected.
- Polyglot: Negative indexing of opening books was raising IndexError.
- Various documentation fixes and improvements.
New features: - Experimental probing of Gaviota tablebases via libgtb. - New methods to construct boards:
```
chess.Board.empty() Board('8/8/8/8/8/8/8/8 w - - 0 1') ```
```
board, ops = chess.Board.fromepd("4k3/8/8/8/8/8/8/4K3 b - - fmvn 17; hmvc 13") board Board('4k3/8/8/8/8/8/8/4K3 b - - 13 17') ops {'fmvn': 17, 'hmvc': 13} ``
- AddedBoard.copy()and hooks to let the copy module to the right thing. - AddedBoard.hascastlingrights(color),Board.haskingsidecastlingrights(color)andBoard.hasqueensidecastlingrights(color). - AddedBoard.clearstack(). - Support common set operations onchess.SquareSet()`.
- Python
Published by niklasf over 10 years ago
python-chess - python-chess v0.9.1
Bugfixes:
- UCI module could not handle castling ponder moves. Thanks to Marco Belli for
reporting.
- The initial move number in PGNs was missing, if black was to move in the
starting position. Thanks to Jürgen Précour for reporting.
- Detect more impossible en-passant squares in Board.status(). There already
was a requirement for a pawn on the fifth rank. Now the sixth and seventh
rank must be empty, additionally. We do not do further retrograde analisys,
because these are the only cases affecting move generation.
- Python
Published by niklasf over 10 years ago
python-chess - python-chess v0.8.3
Bugfixes:
- The initial move number in PGNs was missing, if black was to move in the
starting position. Thanks to Jürgen Précour for reporting.
- Detect more impossible en-passant squares in Board.status(). There already
was a requirement for a pawn on the fifth rank. Now the sixth and seventh
rank must be empty, additionally. We do not do further retrograde analysis,
because these are the only cases affecting move generation.
- Python
Published by niklasf over 10 years ago
python-chess - python-chess v0.9.0
This is a big update with quite a few breaking changes. Carefully review the changes before upgrading. It's no problem if you can not update right now. The 0.8.x branch still gets bugfixes.
Incompatible changes: - Removed castling right constants. Castling rights are now represented as a bitmask of the rook square. For example:
.. code:: python
```
board = chess.Board()
Standard castling rights.
board.castlingrights == chess.BBA1 | chess.BBH1 | chess.BBA8 | chess.BB_H8 True
Check for the presence of a specific castling right.
canwhitecastlequeenside = chess.BBA1 & board.castling_rights ```
Castling moves were previously encoded as the corresponding king movement in
UCI, e.g. e1f1 for white kingside castling. Now castling moves are
encoded as a move to the corresponding rook square (UCI_Chess960-style),
e.g. e1a1.
You may use the new methods Board.uci(move, chess960=True),
Board.parse_uci(uci) and Board.push_uci(uci) to handle this
transparently.
The uci module takes care of converting moves when communicating with an
engine that is not in UCI_Chess960 mode.
- The get_entries_for_position(board) method of polyglot opening book readers
has been changed to find_all(board, minimum_weight=1). By default entries
with weight 0 are excluded.
- The Board.pieces lookup list has been removed.
- In 0.8.1 the spelling of repetition (was repitition) was fixed.
can_claim_threefold_repetition() and is_fivefold_repetition() are the
affected method names. Aliases are now removed.
- Board.set_epd() will now interpret bm, am as a list of moves for the
current position and pv as a variation (represented by a list of moves).
Thanks to Jordan Bray for reporting this.
- Removed uci.InfoHandler.pre_bestmove() and
uci.InfoHandler.post_bestmove().
- uci.InfoHandler().info["score"] is now relative to multipv. Use
.. code:: python
```
with info_handler as info: ... if 1 in info["score"]: ... cp = info["score"][1].cp ```
where you were previously using
.. code:: python
```
with infohandler as info: ... if "score" in info: ... cp = info["score"].cp ``
- Clearuci.InfoHandler()dictionary at the start of new searches (newongo()), not at the end of searches. - RenamedPseudoLegalMoveGenerator.bitboardandLegalMoveGenerator.bitboardtoPseudoLegalMoveGenerator.boardandLegalMoveGenerator.board`, respectively. - Scripts removed. - Python 3.2 compability dropped. Use Python 3.3 or higher. Python 2.7 support is not affected.
New features:
- Introduced Chess960 support. Board(fen) and Board.set_fen(fen) now
support X-FENs. Added Board.shredder_fen().
Board.status(allow_chess960=True) has an optional argument allowing to
insist on standard chess castling rules.
Added Board.is_valid(allow_chess960=True).
- Improved move generation using Shatranj-style direct lookup
<http://arxiv.org/pdf/0704.3773.pdf>. Removed rotated bitboards. Perft
speed has been more than doubled.
- Added choice(board) and `weightedchoice(board)for polyglot opening book
readers.
- AddedBoard.attacks(square)to determine attacks _from_ a given square.
There already wasBoard.attackers(color, square)returning attacks _to_
a square.
- AddedBoard.isenpassant(move),Board.iscapture(move)and
Board.iscastling(move).
- AddedBoard.pin(color, square)andBoard.ispinned(color, square).
- There is a new methodBoard.pieces(piecetype, color)to get a set of
squares with the specified pieces.
- Do expensive Syzygy table initialization on demand.
- Allow promotions likee8Q(usuallye8=Q) inBoard.parsesan()and
PGN files.
- Patch by Richard C. Gerkin: AddedBoard.unicode()just like
Board.str()but with unicode pieces.
- Patch by Richard C. Gerkin: AddedBoard.html_()`.
- Python
Published by niklasf over 10 years ago
python-chess - python-chess v0.8.2
Bugfixes:
- pgn.Game.setup() with the standard starting position was failing when the
standard starting position was already set. Thanks to Jordan Bray for
reporting this.
Optimizations:
- Remove bswap() from Syzygy decompression hot path. Directly read integers
with the correct endianness.
- Python
Published by niklasf over 10 years ago