当前位置: 首页>>代码示例>>Python>>正文


Python Board.drawGrid方法代码示例

本文整理汇总了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()
开发者ID:AlejandroSalgadoG,项目名称:MachineLearning,代码行数:34,代码来源:Search.py

示例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)
开发者ID:AlejandroSalgadoG,项目名称:MachineLearning,代码行数:25,代码来源:Main.py


注:本文中的Board.drawGrid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。