本文整理汇总了Python中table.Table.from_nested_list方法的典型用法代码示例。如果您正苦于以下问题:Python Table.from_nested_list方法的具体用法?Python Table.from_nested_list怎么用?Python Table.from_nested_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table.Table
的用法示例。
在下文中一共展示了Table.from_nested_list方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import from_nested_list [as 别名]
def setUp(self):
self.mines = Table.from_nested_list([
[False, False, False, False],
[False, True, False, False],
[False, False, False, False],
[False, False, False, False],
])
self.flags = Table.from_nested_list([
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
])
示例2: test_reveal_revealed_hint
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import from_nested_list [as 别名]
def test_reveal_revealed_hint(self):
self.flags = Table.from_nested_list([
[Flags.Revealed, Flags.Unknown, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Marked, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
])
game = Game(self.mines, self.flags)
self.assertEqual(True, game.reveal(0, 0))
self.assertEqual(self.flags, Table.from_nested_list([
[Flags.Revealed, Flags.Revealed, Flags.Unknown, Flags.Unknown],
[Flags.Revealed, Flags.Marked, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
]))
示例3: test_reveal_empty
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import from_nested_list [as 别名]
def test_reveal_empty(self):
game = Game(self.mines, self.flags)
self.assertEqual(True, game.reveal(3, 3))
self.assertEqual(self.flags, Table.from_nested_list([
[Flags.Unknown, Flags.Unknown, Flags.Revealed, Flags.Revealed],
[Flags.Unknown, Flags.Unknown, Flags.Revealed, Flags.Revealed],
[Flags.Revealed, Flags.Revealed, Flags.Revealed, Flags.Revealed],
[Flags.Revealed, Flags.Revealed, Flags.Revealed, Flags.Revealed],
]))
示例4: test_reveal_mine
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import from_nested_list [as 别名]
def test_reveal_mine(self):
game = Game(self.mines, self.flags)
self.assertEqual(False, game.reveal(1, 1))
self.assertEqual(self.flags, Table.from_nested_list([
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Revealed, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
[Flags.Unknown, Flags.Unknown, Flags.Unknown, Flags.Unknown],
]))