本文整理汇总了Python中Grid.Grid.print_grid方法的典型用法代码示例。如果您正苦于以下问题:Python Grid.print_grid方法的具体用法?Python Grid.print_grid怎么用?Python Grid.print_grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid.Grid
的用法示例。
在下文中一共展示了Grid.print_grid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: World
# 需要导入模块: from Grid import Grid [as 别名]
# 或者: from Grid.Grid import print_grid [as 别名]
class World():
# avoid ctor parameters since this is a singleton
def __init__(self):
pass
def update_counter(self):
self.jam_counter+=1
def get_counter(self):
return self.jam_counter
def reset_counter(self):
self.jam_counter = 0
def setup(self, parameters):
self._parameters = parameters
print("** Simulation parameters: %s" % self._parameters)
self.jam_counter = 0
self._grid = Grid(parameters.grid_width, parameters.grid_height)
self._agents = [Agent(i, self) for i in xrange(parameters.n_agents)]
self._timelord = TimeLord()
self._timelord.setup(self._parameters.steps_per_day)
def get_parameters(self):
return self._parameters
def get_grid(self):
return self._grid
def print_grid(self):
return self._grid.print_grid()
def update_grid(self):
self._grid.update_grid()
def get_agents(self):
return self._agents
示例2: print
# 需要导入模块: from Grid import Grid [as 别名]
# 或者: from Grid.Grid import print_grid [as 别名]
move_count = 0
# False=Continue the game True=Stop the game
winner = False
# Start game!
while not winner:
# player1's turn
player_id = move_count%2
print("\n Player %d 's Turn. \n" %(player_id+1))
if player[player_id].move():
print("Player %d Wins!" %(player_id+1))
winner = True
# print the board
grid.print_grid()
# update total move count
move_count = move_count + 1
if move_count > 8:
break
# check for tie game
if not winner and move_count > 8:
print("\n Tie Game! \n")
print("Thank you for playing!")
# End Game