本文整理汇总了Python中pychess.Utils.lutils.LBoard.LBoard.plyCount方法的典型用法代码示例。如果您正苦于以下问题:Python LBoard.plyCount方法的具体用法?Python LBoard.plyCount怎么用?Python LBoard.plyCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pychess.Utils.lutils.LBoard.LBoard
的用法示例。
在下文中一共展示了LBoard.plyCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_variation
# 需要导入模块: from pychess.Utils.lutils.LBoard import LBoard [as 别名]
# 或者: from pychess.Utils.lutils.LBoard.LBoard import plyCount [as 别名]
def add_variation(self, board, moves, comment="", score=""):
board0 = board
board = board0.clone()
board.board.prev = None
variation = [board]
for move in moves:
new = board.move(move)
if len(variation) == 1:
new.board.prev = board0.board
variation[0].board.next = new.board
else:
new.board.prev = board.board
board.board.next = new.board
variation.append(new)
board = new
if board0.board.next is None:
# If we are in the latest played board, and want to add a variation
# we have to add a not played yet board first
# which can hold the variation as his child
from pychess.Utils.lutils.LBoard import LBoard
null_board = LBoard()
null_board.prev = board0.board
null_board.plyCount = board0.board.plyCount + 1
board0.board.next = null_board
board0.board.next.children.append([board.board for board in variation])
head = None
for vari in self.variations:
if board0 in vari:
head = vari
break
variation[0] = board0
self.variations.append(head[: board0.ply - self.lowply] + variation)
self.needsSave = True
self.emit("variation_added", board0.board.next.children[-1], board0.board.next, comment, score)
return self.variations[-1]