本文整理汇总了Python中Engine.Engine.get_one_ply_materialistic_move方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.get_one_ply_materialistic_move方法的具体用法?Python Engine.get_one_ply_materialistic_move怎么用?Python Engine.get_one_ply_materialistic_move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine.Engine
的用法示例。
在下文中一共展示了Engine.get_one_ply_materialistic_move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import get_one_ply_materialistic_move [as 别名]
class Game:
def __init__(self):
self.board = ChessBoard()
self.engine = Engine()
pass
def play_game(self, withAI=False, verbose=False):
while not self.is_game_over():
if verbose:
print self.board
if withAI:
if self.board.is_whites_turn():
self.play_move()
else:
self.play_ai_move()
else:
self.play_move()
print str(self.board) + "\n" + "Game Over! {}".format(self.board.outcome)
def auto_play(self):
while not self.is_game_over():
self.play_ai_move()
print str(self.board) + "\n" + "Game Over! {}".format(self.board.outcome)
def is_game_over(self):
return self.board.is_game_over
def play_move(self):
move = raw_input("Enter move: (example: e2e4): ")
if not self.board.attempt_to_make_move(move):
print "\n Invalid Move! \n"
def play_ai_move(self):
origin, destination = self.engine.get_one_ply_materialistic_move(self.board)
self.board.execute_move(origin, destination)
print "Computer plays: {}{}".format(origin, destination)