260 lines
7.6 KiB
JSON
260 lines
7.6 KiB
JSON
{
|
|
"schema": "moonbit-pathfinding.examples-guard.v1",
|
|
"generated_at": "2026-05-31T18:24:35.1543038+08:00",
|
|
"generated_by": "scripts/examples_guard.ps1",
|
|
"moon_version": "moon 0.1.20260427 (48d7def 2026-04-27)\n\nFeature flags enabled: rr_moon_pkg",
|
|
"status": "pass",
|
|
"examples": [
|
|
{
|
|
"name": "maze_solver",
|
|
"package": "examples\\maze_solver",
|
|
"command": [
|
|
"moon",
|
|
"run",
|
|
"examples\\maze_solver"
|
|
],
|
|
"exit_code": 0,
|
|
"output": [
|
|
"moonbit-pathfinding · maze_solver example",
|
|
"Algorithm: BFS (unweighted shortest path, 4-connected grid)",
|
|
"Legend: '#'=wall, '.'=open, 'S'=start, 'G'=goal, '*'=path",
|
|
"",
|
|
"=== Scenario 1: straight corridor ===",
|
|
"Input maze:",
|
|
"S...G",
|
|
"",
|
|
"Solved path (steps = 4):",
|
|
"S***G",
|
|
"",
|
|
"=== Scenario 2: 5x5 open room ===",
|
|
"Input maze:",
|
|
"S....",
|
|
".....",
|
|
"..#..",
|
|
".....",
|
|
"....G",
|
|
"",
|
|
"Solved path (steps = 8):",
|
|
"S....",
|
|
"*....",
|
|
"*.#..",
|
|
"*....",
|
|
"****G",
|
|
"",
|
|
"=== Scenario 3: serpentine 7x9 ===",
|
|
"Input maze:",
|
|
"S........",
|
|
"########.",
|
|
".........",
|
|
".########",
|
|
".........",
|
|
"########.",
|
|
".......G.",
|
|
"",
|
|
"Solved path (steps = 31):",
|
|
"S********",
|
|
"########*",
|
|
"*********",
|
|
"*########",
|
|
"*********",
|
|
"########*",
|
|
".......G*",
|
|
"",
|
|
"=== Scenario 4: unreachable goal (walled-off) ===",
|
|
"Input maze:",
|
|
"S..#..G",
|
|
".###...",
|
|
"",
|
|
"No path from S to G.",
|
|
"",
|
|
"=== Scenario 5: 9x13 canyon ===",
|
|
"Input maze:",
|
|
"S............",
|
|
"###########..",
|
|
"............#",
|
|
"..##########.",
|
|
".............",
|
|
".#########...",
|
|
".........####",
|
|
"####.........",
|
|
"...........G.",
|
|
"",
|
|
"Solved path (steps = 41):",
|
|
"S***********.",
|
|
"###########*.",
|
|
".***********#",
|
|
".*##########.",
|
|
"**...........",
|
|
"*#########...",
|
|
"*****....####",
|
|
"####*........",
|
|
"....*******G.",
|
|
""
|
|
],
|
|
"required_markers": [
|
|
"moonbit-pathfinding · maze_solver example",
|
|
"Scenario 1: straight corridor",
|
|
"Solved path (steps = 4):",
|
|
"Scenario 4: unreachable goal (walled-off)",
|
|
"No path from S to G.",
|
|
"Solved path (steps = 41):"
|
|
],
|
|
"missing_markers": [],
|
|
"status": "pass"
|
|
},
|
|
{
|
|
"name": "network_routing",
|
|
"package": "examples\\network_routing",
|
|
"command": [
|
|
"moon",
|
|
"run",
|
|
"examples\\network_routing"
|
|
],
|
|
"exit_code": 0,
|
|
"output": [
|
|
"moonbit-pathfinding · network_routing example",
|
|
"Algorithm : Dijkstra (non-negative weighted shortest path)",
|
|
"Weight : Double (link latency in milliseconds)",
|
|
"Inspiration: NSLB (Network Simulation Lab / 网络模拟实验) — routers A..J",
|
|
"",
|
|
"--- Network topology (10 routers, directed links) ---",
|
|
"Router A -> { Router B [5 ms], Router D [8 ms] }",
|
|
"Router B -> { Router A [5 ms], Router C [12.5 ms], Router F [20 ms] }",
|
|
"Router C -> { Router B [12.5 ms], Router D [3.5 ms], Router E [7 ms] }",
|
|
"Router D -> { Router A [8 ms], Router C [3.5 ms], Router H [15 ms] }",
|
|
"Router E -> { Router C [7 ms], Router F [4 ms], Router I [11 ms] }",
|
|
"Router F -> { Router B [20 ms], Router E [4 ms], Router G [6.5 ms] }",
|
|
"Router G -> { Router F [6.5 ms], Router H [2 ms], Router I [9 ms] }",
|
|
"Router H -> { Router D [15 ms], Router G [2 ms] }",
|
|
"Router I -> { Router E [11 ms], Router G [9 ms], Router J [3 ms] }",
|
|
"Router J : (no outgoing links — ingress-only monitor)",
|
|
"",
|
|
"Query: Router A -> Router J (cross-backbone, shortest-latency route)",
|
|
" Route: Router A -> Router D -> Router C -> Router E -> Router I -> Router J",
|
|
" Hops : 5",
|
|
" Total latency: 32.5 ms",
|
|
"",
|
|
"Query: Router C -> Router H (mid-network routing, dense-region query)",
|
|
" Route: Router C -> Router D -> Router H",
|
|
" Hops : 2",
|
|
" Total latency: 18.5 ms",
|
|
"",
|
|
"Query: Router J -> Router A (asymmetric link — expected to be unreachable)",
|
|
" No route available (destination is unreachable from Router J).",
|
|
""
|
|
],
|
|
"required_markers": [
|
|
"moonbit-pathfinding · network_routing example",
|
|
"Router J : (no outgoing links",
|
|
"Route: Router A -> Router D -> Router C -> Router E -> Router I -> Router J",
|
|
"Total latency: 32.5 ms",
|
|
"No route available (destination is unreachable from Router J)."
|
|
],
|
|
"missing_markers": [],
|
|
"status": "pass"
|
|
},
|
|
{
|
|
"name": "eight_puzzle",
|
|
"package": "examples\\eight_puzzle",
|
|
"command": [
|
|
"moon",
|
|
"run",
|
|
"examples\\eight_puzzle"
|
|
],
|
|
"exit_code": 0,
|
|
"output": [
|
|
"moonbit-pathfinding · eight_puzzle example",
|
|
"Algorithm: A* with sum-of-Manhattan-distances heuristic",
|
|
"Node type: String (9 chars, digits '0'..'8', '0' is blank)",
|
|
"Goal state: \"123456780\" (blank bottom-right)",
|
|
"",
|
|
"=== Scenario 1: easy (1-step swap) ===",
|
|
"Initial board:",
|
|
"1 2 3",
|
|
"4 5 _",
|
|
"7 8 6",
|
|
"",
|
|
"Heuristic (sum of Manhattan dist.) = 1",
|
|
"Solved in 1 moves (A* total cost = 1).",
|
|
"Solution trace:",
|
|
"Step 0:",
|
|
"1 2 3",
|
|
"4 5 _",
|
|
"7 8 6",
|
|
"",
|
|
"Step 1:",
|
|
"1 2 3",
|
|
"4 5 6",
|
|
"7 8 _",
|
|
"",
|
|
"",
|
|
"=== Scenario 2: medium (~6 moves) ===",
|
|
"Initial board:",
|
|
"1 5 2",
|
|
"7 4 3",
|
|
"_ 8 6",
|
|
"",
|
|
"Heuristic (sum of Manhattan dist.) = 6",
|
|
"Solved in 6 moves (A* total cost = 6).",
|
|
"Solution trace:",
|
|
"Step 0:",
|
|
"1 5 2",
|
|
"7 4 3",
|
|
"_ 8 6",
|
|
"",
|
|
"Step 1:",
|
|
"1 5 2",
|
|
"_ 4 3",
|
|
"7 8 6",
|
|
"",
|
|
"Step 2:",
|
|
"1 5 2",
|
|
"4 _ 3",
|
|
"7 8 6",
|
|
"",
|
|
"Step 3:",
|
|
"1 _ 2",
|
|
"4 5 3",
|
|
"7 8 6",
|
|
"",
|
|
"Step 4:",
|
|
"1 2 _",
|
|
"4 5 3",
|
|
"7 8 6",
|
|
"",
|
|
"Step 5:",
|
|
"1 2 3",
|
|
"4 5 _",
|
|
"7 8 6",
|
|
"",
|
|
"Step 6:",
|
|
"1 2 3",
|
|
"4 5 6",
|
|
"7 8 _",
|
|
"",
|
|
"",
|
|
"=== Scenario 3: challenging (Manhattan >= 12) ===",
|
|
"Initial board:",
|
|
"7 2 4",
|
|
"5 _ 6",
|
|
"8 3 1",
|
|
"",
|
|
"Heuristic (sum of Manhattan dist.) = 14",
|
|
"Solved in 20 moves (A* total cost = 20).",
|
|
""
|
|
],
|
|
"required_markers": [
|
|
"moonbit-pathfinding · eight_puzzle example",
|
|
"Scenario 1: easy (1-step swap)",
|
|
"Solved in 1 moves (A* total cost = 1).",
|
|
"Solved in 6 moves (A* total cost = 6).",
|
|
"Scenario 3: challenging (Manhattan >= 12)",
|
|
"Solved in 20 moves (A* total cost = 20)."
|
|
],
|
|
"missing_markers": [],
|
|
"status": "pass"
|
|
}
|
|
],
|
|
"failures": []
|
|
}
|