本文整理汇总了Python中pychess.Utils.lutils.LBoard.LBoard.prepr方法的典型用法代码示例。如果您正苦于以下问题:Python LBoard.prepr方法的具体用法?Python LBoard.prepr怎么用?Python LBoard.prepr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pychess.Utils.lutils.LBoard.LBoard
的用法示例。
在下文中一共展示了LBoard.prepr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PyChessCECP
# 需要导入模块: from pychess.Utils.lutils.LBoard import LBoard [as 别名]
# 或者: from pychess.Utils.lutils.LBoard.LBoard import prepr [as 别名]
#.........这里部分代码省略.........
elif lines[0] == "level":
self.movestogo = int(lines[1])
inc = int(lines[3])
minutes = lines[2].split(":")
# Per protocol spec, strip off any non-numeric suffixes.
for i in range(len(minutes)):
minutes[i] = re.match(r'\d*', minutes[i]).group()
self.basetime = int(minutes[0]) * 60
if len(minutes) > 1 and minutes[1]:
self.basetime += int(minutes[1])
self.clock[:] = self.basetime, self.basetime
self.increment = inc, inc
elif lines[0] == "st":
self.searchtime = float(lines[1])
elif lines[0] == "sd":
self.sd = int(lines[1])
# Unimplemented: nps
elif lines[0] == "time":
self.clock[self.playingAs] = float(lines[1]) / 100.
elif lines[0] == "otim":
self.clock[1 - self.playingAs] = float(lines[1]) / 100.
elif lines[0] == "usermove":
self.__stopSearching()
try:
move = parseAny(self.board, lines[1])
except ParsingError as err:
self.print("Error (unknown command): %s" % lines[1])
self.print(self.board.prepr(ascii=ASCII))
continue
if not validateMove(self.board, move):
self.print("Illegal move: %s" % lines[1])
self.print(self.board.prepr(ascii=ASCII))
continue
self.board.applyMove(move)
self.playingAs = self.board.color
if not self.forced and not self.analyzing:
self.__go()
if self.analyzing:
self.__analyze()
elif lines[0] == "?":
if not self.forced and not self.analyzing:
self.__stopSearching()
elif lines[0] == "ping":
self.print("pong %s" % lines[1])
elif lines[0] == "draw":
if self.__willingToDraw():
self.print("offer draw")
elif lines[0] == "result":
# We don't really care what the result is at the moment.
pass
elif lines[0] == "setboard":
self.__stopSearching()
try:
self.board = LBoard(self.board.variant)
fen = " ".join(lines[1:])