本文整理匯總了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)