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


Python GameState.is_terminal方法代码示例

本文整理汇总了Python中gamestate.GameState.is_terminal方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.is_terminal方法的具体用法?Python GameState.is_terminal怎么用?Python GameState.is_terminal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gamestate.GameState的用法示例。


在下文中一共展示了GameState.is_terminal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_init

# 需要导入模块: from gamestate import GameState [as 别名]
# 或者: from gamestate.GameState import is_terminal [as 别名]
 def test_init(self):
     """Tests the initialization of a GameState"""
     GameStateTest.G.add_edge(0, 1)
     state = GameState(GameStateTest.G)
     self.assertEquals(state.turn, labels.RED)
     self.assertFalse(state.is_gameover())
     self.assertFalse(state.is_terminal())
开发者ID:Hydrotoast,项目名称:SnortSolver,代码行数:9,代码来源:test_gamestate.py

示例2: test_gameover_state

# 需要导入模块: from gamestate import GameState [as 别名]
# 或者: from gamestate.GameState import is_terminal [as 别名]
 def test_gameover_state(self):
     """Tests proper gameover state."""
     state = GameState(GameStateTest.G)
     state.make_move(0)
     state.make_move(1)
     state.make_move(2)
     self.assertEquals(state.turn, labels.RED)
     self.assertTrue(state.is_gameover())
     self.assertTrue(state.is_terminal())
开发者ID:Hydrotoast,项目名称:SnortSolver,代码行数:11,代码来源:test_gamestate.py

示例3: test_terminal_state

# 需要导入模块: from gamestate import GameState [as 别名]
# 或者: from gamestate.GameState import is_terminal [as 别名]
    def test_terminal_state(self):
        """Tests proper terminal state."""
        GameStateTest.G.add_edge(0, 1)
        GameStateTest.G.add_node(3)
        GameStateTest.G.add_edge(2, 3)
        state = GameState(GameStateTest.G)

        self.assertEquals(state.turn, labels.RED)
        state.make_move(0)
        state.alternate_turn()
        state.make_move(2)

        self.assertFalse(state.is_gameover())
        self.assertTrue(state.is_terminal())
开发者ID:Hydrotoast,项目名称:SnortSolver,代码行数:16,代码来源:test_gamestate.py

示例4: test_normal_play

# 需要导入模块: from gamestate import GameState [as 别名]
# 或者: from gamestate.GameState import is_terminal [as 别名]
    def test_normal_play(self):
        """Tests a normal game."""
        state = GameState(GameStateTest.G)

        self.assertEquals(state.turn, labels.RED)
        state.make_move(0)
        self.assertFalse(state.check_gameover)
        state.alternate_turn()

        self.assertEquals(state.turn, labels.BLUE)
        state.make_move(1)
        self.assertFalse(state.check_gameover)
        state.alternate_turn()

        self.assertEquals(state.turn, labels.RED)
        state.make_move(2)
        self.assertTrue(state.check_gameover)
        state.alternate_turn()

        self.assertEquals(state.turn, labels.BLUE)
        self.assertTrue(state.is_gameover())
        self.assertTrue(state.is_terminal())
        self.assertEquals(state.winner, labels.RED)
开发者ID:Hydrotoast,项目名称:SnortSolver,代码行数:25,代码来源:test_gamestate.py


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