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


Python Rules.calculate_next_state方法代码示例

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


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

示例1: _build_kill

# 需要导入模块: from rules import Rules [as 别名]
# 或者: from rules.Rules import calculate_next_state [as 别名]
    def _build_kill(self):
        for idx, cell in enumerate(self.state):
            if cell != 46:
                child_state = self.state.copy()
                child_state[idx] = 46
                Rules.calculate_next_state(child_state)

                child = Node(child_state, not self.my_turn, self, MoveType.KILL, idx)
                if cell == settings.PLAYER_ID:
                    self.best_kill_moves.append({'idx': idx, 'score': child.minimax_value})
                self.children.append(child)
开发者ID:PhilipCastiglione,项目名称:learning-machines,代码行数:13,代码来源:node.py

示例2: _build_birth

# 需要导入模块: from rules import Rules [as 别名]
# 或者: from rules.Rules import calculate_next_state [as 别名]
    def _build_birth(self):
        for idx, cell in enumerate(self.state):
            if cell == 46:
                for a, b in itertools.combinations(self.best_kill_moves, 2):
                    a_idx = a['idx']
                    b_idx = b['idx']

                    child_state = self.state.copy()
                    child_state[idx] = settings.PLAYER_ID
                    child_state[a_idx] = 46
                    child_state[b_idx] = 46
                    Rules.calculate_next_state(child_state)

                    child = Node(child_state, not self.my_turn, self, MoveType.BIRTH, idx, (a_idx, b_idx))
                    self.children.append(child)
开发者ID:PhilipCastiglione,项目名称:learning-machines,代码行数:17,代码来源:node.py

示例3: _build_pass

# 需要导入模块: from rules import Rules [as 别名]
# 或者: from rules.Rules import calculate_next_state [as 别名]
 def _build_pass(self):
     # passing doesn't change the intermediate state
     child_state = self.state.copy()
     Rules.calculate_next_state(child_state)
     child = Node(child_state, not self.my_turn, self, MoveType.PASS)
     self.children.append(child)
开发者ID:PhilipCastiglione,项目名称:learning-machines,代码行数:8,代码来源:node.py

示例4: calc1000

# 需要导入模块: from rules import Rules [as 别名]
# 或者: from rules.Rules import calculate_next_state [as 别名]
 def calc1000():
     for i in range(1, 1000):
         Rules.calculate_next_state(first_state)
开发者ID:PhilipCastiglione,项目名称:learning-machines,代码行数:5,代码来源:microbench.py


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