本文整理汇总了Python中canvas.Canvas.check_white方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.check_white方法的具体用法?Python Canvas.check_white怎么用?Python Canvas.check_white使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canvas.Canvas
的用法示例。
在下文中一共展示了Canvas.check_white方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import check_white [as 别名]
canvas.total_num += 1
refresh()
whether_clicked = True # 标记为已经落子
if not whether_black:
# 黑色不能落子
black_turn.undraw()
white_turn.draw(win)
canvas.total_num += 1
whether_clicked = True
if whether_clicked:
# 如果黑色已经落子,则轮到白色方落子
# 如果白色可以落子
if canvas.check_white():
sleep(0.2)
# AI--------------------------------------------------
# 找出白色的最佳落子坐标
# [best_x, best_y] = find_the_best(canvas)
a = calculate.intArray(64)
for i in xrange(8):
for j in xrange(8):
a[i * 8 + j] = canvas.board[i][j].color
best_place = calculate.find_the_best(a, -1)
best_x = best_place / 10
best_y = best_place % 10
logging.info('WHITE places at (%s, %s)' % (best_x, best_y))
canvas.click(best_x, best_y, 1)
canvas.piece_num[1] += 1
示例2: sleep
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import check_white [as 别名]
if not blackHasValidMove:
# 黑色不能落子
t_skip_black.draw(win)
sleep(1)
t_skip_black.undraw()
black_turn.undraw()
white_turn.draw(win)
# canvas.total_num += 1
blackClicked = True
# 黑色已落子
if blackClicked:
# 如果黑色已经落子,则轮到白色方落子
# 如果白色可以落子
whiteHasValidMove = canvas.check_white()
if whiteHasValidMove:
# Human VS Human
if playerType == 0:
quitFlag = False
whiteClicked = False
while 1:
if whiteClicked:
break
p4 = win.getMouse()
if b_qt.clicked(p4): # 如果点击quit按钮
quitFlag = True
break