本文整理汇总了Python中bot.Bot.play_move方法的典型用法代码示例。如果您正苦于以下问题:Python Bot.play_move方法的具体用法?Python Bot.play_move怎么用?Python Bot.play_move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bot.Bot
的用法示例。
在下文中一共展示了Bot.play_move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: POST
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import play_move [as 别名]
def POST(self):
""" Handle request to get a bot's move """
# Make sure responses aren't cached by client
web.header('Content-Type', 'text/plain')
web.header('Cache-Control', 'no-cache, no-store, no-transform')
web.header('Expires', '0')
web.header('Pragma', 'no-cache')
if web.input()['state']:
from state import State
from move import COLLAPSE
# Load the state of the game
game = State(web.input()['state'])
last_move = game.moves[-1]
response = ""
from bot import Bot
# Is it the bot's turn?
if not game.outcome and last_move and \
last_move.player == 1 and \
last_move.type != COLLAPSE:
# if response = self.debug(game): return response
response = Bot.play_move(game, int(web.input()['difficulty']))
# Is the game over?
if game.outcome: Bot.learn(game)
return response