本文整理汇总了Python中Board.drawGrid方法的典型用法代码示例。如果您正苦于以下问题:Python Board.drawGrid方法的具体用法?Python Board.drawGrid怎么用?Python Board.drawGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board.drawGrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: import Board [as 别名]
# 或者: from Board import drawGrid [as 别名]
def setup():
global board,players
win = GraphWin("Search", widthSize, heightSize)
win.setBackground("black")
player1 = Player(2, p1Color, p1Pos)
player2 = Player(3, p2Color, p2Pos)
players = [player1, player2]
board = Board(players)
board.drawGrid(win, "white")
board.drawPlayer(win, *p1Pos, player1)
board.drawPlayer(win, *p2Pos, player2)
while True:
pos = win.getMouse()
if win.checkKey():
break
pos = (pos.x//rectSize, pos.y//rectSize)
board.createObstacle(win, *pos)
board.drawGrid(win, "black")
executePlayer(win, board, players[0])
win.getMouse()
示例2: setup
# 需要导入模块: import Board [as 别名]
# 或者: from Board import drawGrid [as 别名]
def setup():
win = GraphWin("Hex", widthSize+2, heightSize+2)
win.setBackground("black")
player1 = Player(p1Id, p1Color)
player2 = Player(p2Id, p2Color)
players = [player1, player2]
board = Board(players)
board.drawGrid(win)
move = agente(board.board, p1Id)
board.drawMove(win, move[0], move[1], player1)
while True:
x,y = board.getMouse(win)
if x < 0 or x > 10 or y < 0 or y > 10:
continue
else:
board.drawMove(win, x, y, player2)