(self, node: Node)
| 54 | return child_node |
| 55 | |
| 56 | async def simulate_async(self, node: Node) -> float: |
| 57 | current_node = node |
| 58 | depth = 0 |
| 59 | logger.debug("Starting simulation") |
| 60 | while depth < self.max_depth: |
| 61 | if not current_node.children: |
| 62 | action = random.choice(self.actions) |
| 63 | current_node = await self.expand_async(current_node, action) |
| 64 | else: |
| 65 | current_node = random.choice(current_node.children) |
| 66 | depth += 1 |
| 67 | value = self.evaluate(current_node) |
| 68 | logger.debug(f"Simulation complete. Final value: {value}") |
| 69 | return value |
| 70 | |
| 71 | async def mcts_async(self, root_state: str) -> List[Node]: |
| 72 | root = Node(root_state, None) |
no test coverage detected