一键导入
frontier-based-explore
For graph exploration: frontier collection with configurable pop order, BFS/DFS/random via strategy change.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
For graph exploration: frontier collection with configurable pop order, BFS/DFS/random via strategy change.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Conducts iterative deep research on any topic using web search, progressive exploration, and structured synthesis. Use when asked for comprehensive research, deep investigation, thorough analysis, or multi-source exploration of any topic. Triggers: research, investigate, deep dive, comprehensive analysis, explore thoroughly, find everything about.
For cross-cutting concerns: add behavior without modifying functions, caching, timing, logging, validation wrappers.
For performance work: measure before changing, profile to find bottlenecks, compare before and after.
For symbolic computation: ASTs, mathematical expressions, code that manipulates code structure, expression transformations.
For ordered processing: A* search, Dijkstra, event simulation, task scheduling. Efficient min/max extraction with heap-based queue.
For dynamic programming: overlapping subproblems, recursive solutions with repeated computations, memoization to avoid redundant work.
| name | frontier-based-explore |
| description | For graph exploration: frontier collection with configurable pop order, BFS/DFS/random via strategy change. |
Maintain a frontier collection; how you pop determines traversal order.
from collections import deque
def explore(start, neighbors, pop_strategy=deque.pop):
"""Explore graph with configurable traversal order.
pop_strategy:
deque.pop -> DFS (depth-first, LIFO)
deque.popleft -> BFS (breadth-first, FIFO)
lambda d: d.pop(random.randrange(len(d))) -> Random
"""
visited = set()
frontier = deque([start])
while frontier:
current = pop_strategy(frontier)
if current in visited:
continue
visited.add(current)
yield current # Process node
for neighbor in neighbors(current):
if neighbor not in visited:
frontier.append(neighbor)
from collections import deque
import random
def random_tree(nodes, neighbors, pop=deque.pop):
"""Build spanning tree with configurable exploration.
Different pop strategies create different tree shapes:
- deque.pop (DFS): long winding paths
- deque.popleft (BFS): short bushy branches
- random pop: mixed/natural looking
"""
tree = set()
nodes = set(nodes)
root = nodes.pop()
frontier = deque([root])
while nodes:
current = pop(frontier)
unvisited = [n for n in neighbors(current) if n in nodes]
if unvisited:
chosen = random.choice(unvisited)
tree.add((current, chosen))
nodes.remove(chosen)
frontier.append(current)
frontier.append(chosen)
return tree
# Generate different maze styles
def dfs_maze(width, height):
"""Long, winding corridors."""
return random_tree(all_cells(width, height), grid_neighbors, deque.pop)
def bfs_maze(width, height):
"""Short, branching paths."""
return random_tree(all_cells(width, height), grid_neighbors, deque.popleft)
def random_maze(width, height):
"""Natural-looking structure."""
def random_pop(d):
i = random.randrange(len(d))
d[i], d[-1] = d[-1], d[i]
return d.pop()
return random_tree(all_cells(width, height), grid_neighbors, random_pop)