python创建一个国际象棋棋盘_python-chess: 一个纯Python国际象棋库

本次更新包括了多项改进,如用函数替代查找表提高初始化及运行时性能;新增抽象方法强制子类实现;移除辅助属性并采用类型字典;修正了多个已知问题;增加了新特性如检查判断方法等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Changes:

* Replaced lookup table `chess.BB_BETWEEN[a][b]` with a function

`chess.between(a, b)`. Improves initialization and runtime performance.

* `chess.pgn.BaseVisitor.result()` is now an abstract method, forcing

subclasses to implement it.

* Removed helper attributes from `chess.engine.InfoDict`. Instead it is now

a `TypedDict`.

* `chess.engine.PovScore` equality is now semantic instead of structural:

Scores compare equal to the negative score from the opposite point of view.

Bugfixes:

* `chess.Board.is_irreversible()` now considers ceding legal en-passant

captures as irreversible. Also documented that false-negatives due to forced

lines are by design.

* Fixed stack overflow in `chess.pgn` when exporting, visiting or getting the

final board of a very long game.

* Clarified documentation regarding board validity.

* `chess.pgn.GameNode.__repr__()` no longer errors if the root node has invalid

FEN or Variant headers.

* Carriage returns are no longer allowed in PGN header values, fixing

reparsability.

* Fixed type error when XBoard name or egt features have a value that looks

like an integer.

* `chess.engine` is now passing type checks with mypy.

* `chess.gaviota` is now passing type checks with mypy.

Features:

* Added `chess.Board.gives_check()`.

* `chess.engine.AnalysisResult.wait()` now returns `chess.engine.BestMove`.

* Added `empty_square` parameter for `chess.Board.unicode()` with better

aligned default (⭘).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值