本文整理汇总了Python中Grid.Grid.printGrid方法的典型用法代码示例。如果您正苦于以下问题:Python Grid.printGrid方法的具体用法?Python Grid.printGrid怎么用?Python Grid.printGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid.Grid
的用法示例。
在下文中一共展示了Grid.printGrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Grid import Grid [as 别名]
# 或者: from Grid.Grid import printGrid [as 别名]
class GridManager:
# Constructor
def __init__(self):
self.__grid = Grid()
self.__gamePlayer = GamePlayer()
self.__userPlayer = UserPlayer()
# Start Game
def startGame(self):
# Will continue toggling between
# Game and User turns until the
# Grid is Full (which is a loss)
# or a 2048 tile is encountered
# (which is a win)
while (not self.__grid.gridContains(2048)):
self.__gamePlayer.makeMove(self.__grid)
self.__grid.printGrid()
if (not self.__userPlayer.makeMove(self.__grid)):
print "User Lost!"
break
if (self.__grid.gridContains(2048)):
print "User Won!"
示例2: main
# 需要导入模块: from Grid import Grid [as 别名]
# 或者: from Grid.Grid import printGrid [as 别名]
def main():
userAI = UserAI()
grid = Grid()
grid.addTile(2, 0, 0)
grid.addTile(2, 1, 0)
grid.addTile(4, 1, 0)
grid.printGrid()
userAI.decisionMaker(grid)