當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。