Home > パズル


6パズルの解法:BFSマトリックス

コード例1: Pythonfrom collections import deque def solve_puzzle(start_state, goal_state): queue = deque([(start_state, [])]) visited = set([start_state]) while queue: current_state, path = queue.popleft() if current_state == goal_state: return path for nex>>More