本文整理汇总了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)
示例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)
示例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)
示例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)