Datasets:

Modalities:
Text
Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
Harbor
License:
lewtun HF Staff commited on
Commit
5599b0f
·
verified ·
1 Parent(s): 161a2d3

s3-maze: 32 trees from seed 115, the maze service, the grader, the move budget (210) and the checks (huggingface/flock#115) (part 2)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/maze-t16/environment/docker-compose.yaml +25 -0
  2. tasks/maze-t16/environment/maze/Dockerfile +9 -0
  3. tasks/maze-t16/environment/maze/engine.py +93 -0
  4. tasks/maze-t16/environment/maze/export.py +40 -0
  5. tasks/maze-t16/environment/maze/service.py +167 -0
  6. tasks/maze-t16/environment/maze/success.py +29 -0
  7. tasks/maze-t16/environment/maze/tree.json +1569 -0
  8. tasks/maze-t16/instruction.md +26 -0
  9. tasks/maze-t16/solution/solve.sh +7 -0
  10. tasks/maze-t16/task.toml +48 -0
  11. tasks/maze-t16/tests/Dockerfile +5 -0
  12. tasks/maze-t16/tests/expected.json +6 -0
  13. tasks/maze-t16/tests/grade.py +117 -0
  14. tasks/maze-t16/tests/test.sh +12 -0
  15. tasks/maze-t17/environment/agent/Dockerfile +8 -0
  16. tasks/maze-t17/environment/agent/maze +53 -0
  17. tasks/maze-t17/environment/docker-compose.yaml +25 -0
  18. tasks/maze-t17/environment/maze/Dockerfile +9 -0
  19. tasks/maze-t17/environment/maze/engine.py +93 -0
  20. tasks/maze-t17/environment/maze/export.py +40 -0
  21. tasks/maze-t17/environment/maze/service.py +167 -0
  22. tasks/maze-t17/environment/maze/success.py +29 -0
  23. tasks/maze-t17/environment/maze/tree.json +1569 -0
  24. tasks/maze-t17/instruction.md +26 -0
  25. tasks/maze-t17/solution/solve.sh +7 -0
  26. tasks/maze-t17/task.toml +48 -0
  27. tasks/maze-t17/tests/Dockerfile +5 -0
  28. tasks/maze-t17/tests/expected.json +6 -0
  29. tasks/maze-t17/tests/grade.py +117 -0
  30. tasks/maze-t17/tests/test.sh +12 -0
  31. tasks/maze-t18/environment/agent/Dockerfile +8 -0
  32. tasks/maze-t18/environment/agent/maze +53 -0
  33. tasks/maze-t18/environment/docker-compose.yaml +25 -0
  34. tasks/maze-t18/environment/maze/Dockerfile +9 -0
  35. tasks/maze-t18/environment/maze/engine.py +93 -0
  36. tasks/maze-t18/environment/maze/export.py +40 -0
  37. tasks/maze-t18/environment/maze/service.py +167 -0
  38. tasks/maze-t18/environment/maze/success.py +29 -0
  39. tasks/maze-t18/environment/maze/tree.json +1569 -0
  40. tasks/maze-t18/instruction.md +26 -0
  41. tasks/maze-t18/solution/solve.sh +7 -0
  42. tasks/maze-t18/task.toml +48 -0
  43. tasks/maze-t18/tests/Dockerfile +5 -0
  44. tasks/maze-t18/tests/expected.json +6 -0
  45. tasks/maze-t18/tests/grade.py +117 -0
  46. tasks/maze-t18/tests/test.sh +12 -0
  47. tasks/maze-t19/environment/agent/Dockerfile +8 -0
  48. tasks/maze-t19/environment/agent/maze +53 -0
  49. tasks/maze-t19/environment/docker-compose.yaml +25 -0
  50. tasks/maze-t19/environment/maze/Dockerfile +9 -0
tasks/maze-t16/environment/docker-compose.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # maze-t16: the agent's container (main) and its own maze service. The service holds
2
+ # the tree and answers only `maze look` and `maze move ROOM`, on a network only main reaches.
3
+ services:
4
+ main:
5
+ image: s3-maze-agent:7ecf229faaac
6
+ build:
7
+ context: ./agent
8
+ networks: [default, maze]
9
+ security_opt: [no-new-privileges:true]
10
+ depends_on: [maze]
11
+ maze:
12
+ image: s3-maze-service:maze-t16-635d525f2722
13
+ build:
14
+ context: ./maze
15
+ networks: [maze]
16
+ environment:
17
+ MAZE_AGENT: ${COMPOSE_PROJECT_NAME:-} # the Trial, for the move log
18
+ cap_drop: [ALL]
19
+ security_opt: [no-new-privileges:true]
20
+ pids_limit: 64
21
+ mem_limit: 256m
22
+ networks:
23
+ default: {} # main's way out (Flock replaces it with the agent's own network)
24
+ maze:
25
+ internal: true
tasks/maze-t16/environment/maze/Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The maze service: the tree (private, never in the agent's container), the walk's state and
3
+ # move log, the success check and the collect hook. Standard library only.
4
+ COPY engine.py service.py success.py export.py /app/
5
+ COPY tree.json /private/tree.json
6
+ RUN mkdir -p /var/lib/maze /evidence && chmod 0700 /private /var/lib/maze
7
+ ENV MAZE_TREE=/private/tree.json MAZE_STATE_DIR=/var/lib/maze
8
+ WORKDIR /app
9
+ CMD ["python3", "-I", "-S", "-B", "/app/service.py"]
tasks/maze-t16/environment/maze/engine.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The maze: one agent's walk through its own copy of a tree of rooms (s3-maze).
2
+
3
+ The service (service.py) holds one Walk per Trial; budget.py simulates searches on this same
4
+ code. Python 3.10+, standard library only.
5
+
6
+ A tree is `{"start", "exit", "budget", "doors": {room: [neighbour, ...]}}`: each room lists its
7
+ doors in the order fixed when the tree was generated, the same for every agent and every visit.
8
+ """
9
+
10
+ import json
11
+
12
+ DEAD_END = "Dead end: its only door leads back the way you came."
13
+
14
+
15
+ class Maze:
16
+ def __init__(self, tree: dict):
17
+ self.start = tree["start"]
18
+ self.exit = tree["exit"]
19
+ self.budget = int(tree["budget"])
20
+ self.doors = {room: list(doors) for room, doors in tree["doors"].items()}
21
+
22
+ @classmethod
23
+ def load(cls, path: str) -> "Maze":
24
+ with open(path, encoding="utf-8") as f:
25
+ return cls(json.load(f))
26
+
27
+
28
+ class Walk:
29
+ """One agent's position and its accepted moves. Looking is free; a refused move costs
30
+ nothing; at most `budget` moves are accepted, and none once the exit is reached."""
31
+
32
+ def __init__(self, maze: Maze, room: str | None = None, arrived_from: str | None = None,
33
+ moves: int = 0, refused: int = 0):
34
+ self.maze = maze
35
+ self.room = room or maze.start
36
+ self.arrived_from = arrived_from
37
+ self.moves = moves
38
+ self.refused = refused
39
+
40
+ @property
41
+ def reached(self) -> bool:
42
+ return self.room == self.maze.exit
43
+
44
+ def look(self) -> dict:
45
+ """The paper's observation (s3, Appendix H), plus the moves left."""
46
+ doors = self.maze.doors[self.room]
47
+ out = {"room": self.room, "doors": list(doors), "exit": self.reached,
48
+ "arrived_from": self.arrived_from, "moves_left": self.maze.budget - self.moves}
49
+ if len(doors) == 1 and not self.reached:
50
+ out["notice"] = DEAD_END
51
+ return out
52
+
53
+ def refusal(self, room) -> str | None:
54
+ """Why a move into `room` is refused (a short code), or None."""
55
+ if self.reached:
56
+ return "at_exit"
57
+ if self.moves >= self.maze.budget:
58
+ return "no_moves_left"
59
+ if not isinstance(room, str) or room not in self.maze.doors[self.room]:
60
+ return "not_a_door"
61
+ return None
62
+
63
+ def move(self, room) -> tuple[dict, str | None]:
64
+ """(the observation after moving into `room`, None), or (an error and the current
65
+ observation, the refusal's code)."""
66
+ why = self.refusal(room)
67
+ if why is not None:
68
+ self.refused += 1
69
+ return {"error": MESSAGES[why].format(room=_short(room), here=self.room,
70
+ budget=self.maze.budget), **self.look()}, why
71
+ self.arrived_from, self.room = self.room, room
72
+ self.moves += 1
73
+ return self.look(), None
74
+
75
+ def state(self) -> dict:
76
+ return {"room": self.room, "arrived_from": self.arrived_from, "moves": self.moves,
77
+ "refused": self.refused, "reached": self.reached}
78
+
79
+ @classmethod
80
+ def from_state(cls, maze: Maze, state: dict) -> "Walk":
81
+ return cls(maze, state["room"], state["arrived_from"], state["moves"], state["refused"])
82
+
83
+
84
+ MESSAGES = {
85
+ "at_exit": "You are at the exit: the task is solved.",
86
+ "no_moves_left": "No moves left: your budget of {budget} moves is used up.",
87
+ "not_a_door": "{room} is not a door of {here}: move into one of the doors listed for it.",
88
+ }
89
+
90
+
91
+ def _short(value) -> str:
92
+ text = value if isinstance(value, str) else json.dumps(value)
93
+ return text if len(text) <= 40 else text[:40] + "..."
tasks/maze-t16/environment/maze/export.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Harbor's [[verifier.collect]] hook for s3-maze, run in this maze service once the agent is done
2
+ (its container already stopped): `python3 -I -S /app/export.py`.
3
+
4
+ Writes the service's own record of the walk to /evidence, which Harbor collects as artifacts
5
+ and hands to the grader in a fresh container: `final.json` (the state file, marked as exported
6
+ here) and `moves.jsonl` (the move log). Nothing in /evidence comes from the agent's container.
7
+ """
8
+
9
+ import json
10
+ import os
11
+
12
+ STATE_DIR = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze")
13
+ EVIDENCE = os.environ.get("MAZE_EVIDENCE_DIR", "/evidence")
14
+ LIMIT = 16 << 20
15
+
16
+
17
+ def read(name: str) -> bytes:
18
+ fd = os.open(os.path.join(STATE_DIR, name), os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
19
+ with os.fdopen(fd, "rb") as f:
20
+ return f.read(LIMIT)
21
+
22
+
23
+ def write(name: str, data: bytes) -> None:
24
+ path = os.path.join(EVIDENCE, name)
25
+ temp = path + ".tmp"
26
+ fd = os.open(temp, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
27
+ with os.fdopen(fd, "wb") as f:
28
+ f.write(data)
29
+ os.replace(temp, path)
30
+
31
+
32
+ os.makedirs(EVIDENCE, exist_ok=True)
33
+ state = json.loads(read("state.json"))
34
+ try:
35
+ moves = read("moves.jsonl")
36
+ except FileNotFoundError: # no move was ever asked for
37
+ moves = b""
38
+ write("moves.jsonl", moves)
39
+ write("final.json", json.dumps({**state, "exported_by": "maze"}).encode())
40
+ print("exported", state.get("moves"), "moves; exit reached:", state.get("reached"))
tasks/maze-t16/environment/maze/service.py ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The maze service: one agent's own copy of the maze, behind `maze look` and `maze move ROOM`.
2
+
3
+ Two routes answer, `GET /look` and `POST /move` (`{"room": <a door>}`), each with the current
4
+ room's observation (engine.Walk.look); every other request gets a 404 that names nothing. So the
5
+ tree and the exit stay in this container: an agent learns a room's doors only by standing in it,
6
+ and that a room is the exit only by reaching it.
7
+
8
+ Every move, accepted or refused, is appended to the move log (agent, from, to, time) before it is
9
+ answered, and the walk's state file is replaced after it: success.py (flock's success_check)
10
+ and export.py (Harbor's collect hook, for the grader) read those two files. A restarted
11
+ container resumes from them. Python 3.10+, standard library only.
12
+ """
13
+
14
+ import hashlib
15
+ import json
16
+ import os
17
+ import sys
18
+ import threading
19
+ from datetime import datetime, timezone
20
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
21
+
22
+ sys.dont_write_bytecode = True # -I ignores PYTHONDONTWRITEBYTECODE
23
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
24
+ from engine import Maze, Walk # noqa: E402
25
+
26
+ TREE = os.environ.get("MAZE_TREE", "/private/tree.json")
27
+ STATE_DIR = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze")
28
+ PORT = int(os.environ.get("MAZE_PORT", "8000"))
29
+ # The Trial whose maze this is: compose's project name, `<swarm>-<agent>-tN__env`
30
+ AGENT = os.environ.get("MAZE_AGENT", "").removesuffix("__env") or "agent"
31
+ BODY_LIMIT = 4096
32
+
33
+
34
+ def now() -> str:
35
+ return datetime.now(timezone.utc).isoformat(timespec="milliseconds")
36
+
37
+
38
+ class Service:
39
+ def __init__(self, tree_path: str, state_dir: str, agent: str):
40
+ with open(tree_path, "rb") as f:
41
+ raw = f.read()
42
+ self.maze = Maze(json.loads(raw))
43
+ self.tree_sha256 = hashlib.sha256(raw).hexdigest()
44
+ self.agent = agent
45
+ self.state_path = os.path.join(state_dir, "state.json")
46
+ self.log_path = os.path.join(state_dir, "moves.jsonl")
47
+ self.lock = threading.Lock()
48
+ os.makedirs(state_dir, exist_ok=True)
49
+ self.reached_at = None
50
+ if os.path.exists(self.state_path): # a restarted container
51
+ with open(self.state_path, encoding="utf-8") as f:
52
+ saved = json.load(f)
53
+ self.walk = Walk.from_state(self.maze, saved)
54
+ self.reached_at = saved.get("reached_at")
55
+ else:
56
+ self.walk = Walk(self.maze)
57
+ self.save()
58
+
59
+ def save(self) -> None:
60
+ state = {"agent": self.agent, "start": self.maze.start, "budget": self.maze.budget,
61
+ "tree_sha256": self.tree_sha256, **self.walk.state(),
62
+ "reached_at": self.reached_at}
63
+ temp = self.state_path + ".tmp"
64
+ with open(temp, "w", encoding="utf-8") as f:
65
+ json.dump(state, f)
66
+ f.flush()
67
+ os.fsync(f.fileno())
68
+ os.replace(temp, self.state_path)
69
+
70
+ def look(self) -> dict:
71
+ with self.lock:
72
+ return self.walk.look()
73
+
74
+ def move(self, room) -> tuple[dict, str | None]:
75
+ with self.lock:
76
+ here = self.walk.room
77
+ body, why = self.walk.move(room)
78
+ if why is None and self.walk.reached:
79
+ self.reached_at = now()
80
+ self.log(here, _logged(room), why)
81
+ return body, why
82
+
83
+ def bad_request(self) -> None:
84
+ """A move request without a room: refused, and logged like any other."""
85
+ with self.lock:
86
+ self.walk.refused += 1
87
+ self.log(self.walk.room, None, "bad_request")
88
+
89
+ def log(self, here: str, to, why: str | None) -> None:
90
+ record = {"agent": self.agent, "from": here, "to": to, "time": now(), "ok": why is None,
91
+ "moves": self.walk.moves}
92
+ if why is not None:
93
+ record["refused"] = why
94
+ with open(self.log_path, "a", encoding="utf-8") as f:
95
+ f.write(json.dumps(record) + "\n")
96
+ f.flush()
97
+ os.fsync(f.fileno())
98
+ self.save()
99
+
100
+
101
+ def _logged(room):
102
+ """What the agent asked to move into, as the log keeps it (a string, at most 64 chars)."""
103
+ text = room if isinstance(room, str) else json.dumps(room)
104
+ return text[:64]
105
+
106
+
107
+ def handler(service: Service):
108
+ class Handler(BaseHTTPRequestHandler):
109
+ server_version = "maze"
110
+ sys_version = ""
111
+
112
+ def reply(self, code: int, body: dict) -> None:
113
+ data = json.dumps(body).encode()
114
+ self.send_response(code)
115
+ self.send_header("Content-Type", "application/json")
116
+ self.send_header("Content-Length", str(len(data)))
117
+ self.end_headers()
118
+ self.wfile.write(data)
119
+
120
+ def not_found(self) -> None:
121
+ self.reply(404, {"error": "not found: use `maze look` or `maze move ROOM`"})
122
+
123
+ def do_GET(self): # noqa: N802
124
+ if self.path == "/look":
125
+ self.reply(200, service.look())
126
+ else:
127
+ self.not_found()
128
+
129
+ def do_POST(self): # noqa: N802
130
+ if self.path != "/move":
131
+ return self.not_found()
132
+ try:
133
+ length = int(self.headers.get("Content-Length") or 0)
134
+ except ValueError:
135
+ length = -1
136
+ room = None
137
+ if 0 < length <= BODY_LIMIT:
138
+ try:
139
+ room = json.loads(self.rfile.read(length)).get("room")
140
+ except (ValueError, AttributeError):
141
+ pass
142
+ if room is None:
143
+ service.bad_request()
144
+ return self.reply(400, {"error": 'send {"room": "<a door of your room>"}'})
145
+ body, why = service.move(room)
146
+ self.reply(200 if why is None else 409, body)
147
+
148
+ def do_PUT(self): # noqa: N802
149
+ self.not_found()
150
+
151
+ do_DELETE = do_PATCH = do_HEAD = do_OPTIONS = do_PUT # noqa: N815
152
+
153
+ def log_message(self, *args): # the move log is the record
154
+ pass
155
+
156
+ return Handler
157
+
158
+
159
+ def main() -> None:
160
+ service = Service(TREE, STATE_DIR, AGENT)
161
+ server = ThreadingHTTPServer(("0.0.0.0", PORT), handler(service))
162
+ server.daemon_threads = True
163
+ server.serve_forever()
164
+
165
+
166
+ if __name__ == "__main__":
167
+ main()
tasks/maze-t16/environment/maze/success.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """flock's success_check for s3-maze (`stop_on_success`), run in this maze service, never in the
2
+ agent's container: `python3 -I -S /app/success.py`.
3
+
4
+ Read-only: it prints `{"success": <the exit was reached>, "evidence": {...}}` from the walk's
5
+ state file, which only service.py writes. No state yet, or one that can't be read, is not a
6
+ success.
7
+ """
8
+
9
+ import json
10
+ import os
11
+
12
+ STATE = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze") + "/state.json"
13
+
14
+
15
+ def read_state() -> dict | None:
16
+ try:
17
+ fd = os.open(STATE, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
18
+ with os.fdopen(fd, "rb") as f:
19
+ state = json.loads(f.read(1 << 16))
20
+ return state if isinstance(state, dict) else None
21
+ except (OSError, ValueError):
22
+ return None
23
+
24
+
25
+ state = read_state()
26
+ reached = bool(state) and state.get("reached") is True
27
+ evidence = ({"exit_reached": reached, "moves": state.get("moves"),
28
+ "reached_at": state.get("reached_at")} if state else {"state": "unreadable"})
29
+ print(json.dumps({"success": reached, "evidence": evidence}))
tasks/maze-t16/environment/maze/tree.json ADDED
@@ -0,0 +1,1569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "start": "R7074",
3
+ "exit": "R9936",
4
+ "budget": 210,
5
+ "doors": {
6
+ "R7074": [
7
+ "R5707",
8
+ "R9041",
9
+ "R3702"
10
+ ],
11
+ "R9041": [
12
+ "R6349",
13
+ "R7074"
14
+ ],
15
+ "R6349": [
16
+ "R9041",
17
+ "R3544"
18
+ ],
19
+ "R3544": [
20
+ "R6349",
21
+ "R3513"
22
+ ],
23
+ "R3513": [
24
+ "R7383",
25
+ "R3544"
26
+ ],
27
+ "R7383": [
28
+ "R1171",
29
+ "R3513"
30
+ ],
31
+ "R1171": [
32
+ "R1206",
33
+ "R7383"
34
+ ],
35
+ "R1206": [
36
+ "R1171",
37
+ "R3616"
38
+ ],
39
+ "R3616": [
40
+ "R6530",
41
+ "R1206"
42
+ ],
43
+ "R6530": [
44
+ "R3958",
45
+ "R3616"
46
+ ],
47
+ "R3958": [
48
+ "R6530",
49
+ "R1222",
50
+ "R7348",
51
+ "R8992"
52
+ ],
53
+ "R3702": [
54
+ "R5021",
55
+ "R7074"
56
+ ],
57
+ "R5021": [
58
+ "R3702",
59
+ "R4071"
60
+ ],
61
+ "R4071": [
62
+ "R5556",
63
+ "R5021"
64
+ ],
65
+ "R5556": [
66
+ "R1800",
67
+ "R4071"
68
+ ],
69
+ "R1800": [
70
+ "R5556",
71
+ "R1299"
72
+ ],
73
+ "R1299": [
74
+ "R1800",
75
+ "R2033"
76
+ ],
77
+ "R2033": [
78
+ "R1299",
79
+ "R5796"
80
+ ],
81
+ "R5796": [
82
+ "R2081",
83
+ "R2033"
84
+ ],
85
+ "R2081": [
86
+ "R5796",
87
+ "R5894"
88
+ ],
89
+ "R5894": [
90
+ "R4876",
91
+ "R2081",
92
+ "R5377",
93
+ "R8012"
94
+ ],
95
+ "R5707": [
96
+ "R6677",
97
+ "R7074"
98
+ ],
99
+ "R6677": [
100
+ "R5707",
101
+ "R9932"
102
+ ],
103
+ "R9932": [
104
+ "R7204",
105
+ "R6677"
106
+ ],
107
+ "R7204": [
108
+ "R9118",
109
+ "R9932"
110
+ ],
111
+ "R9118": [
112
+ "R7204",
113
+ "R7516"
114
+ ],
115
+ "R7516": [
116
+ "R9118",
117
+ "R5812"
118
+ ],
119
+ "R5812": [
120
+ "R7516",
121
+ "R8944"
122
+ ],
123
+ "R8944": [
124
+ "R8178",
125
+ "R5812"
126
+ ],
127
+ "R8178": [
128
+ "R8944",
129
+ "R8983"
130
+ ],
131
+ "R8983": [
132
+ "R8178",
133
+ "R3355",
134
+ "R6590",
135
+ "R5547"
136
+ ],
137
+ "R7348": [
138
+ "R3958",
139
+ "R5952"
140
+ ],
141
+ "R5952": [
142
+ "R3296",
143
+ "R7348"
144
+ ],
145
+ "R3296": [
146
+ "R5952",
147
+ "R8490"
148
+ ],
149
+ "R8490": [
150
+ "R6101",
151
+ "R3296"
152
+ ],
153
+ "R6101": [
154
+ "R2009",
155
+ "R8490"
156
+ ],
157
+ "R2009": [
158
+ "R9425",
159
+ "R6101"
160
+ ],
161
+ "R9425": [
162
+ "R2722",
163
+ "R2009"
164
+ ],
165
+ "R2722": [
166
+ "R4350",
167
+ "R9425"
168
+ ],
169
+ "R4350": [
170
+ "R2722",
171
+ "R6726"
172
+ ],
173
+ "R6726": [
174
+ "R6977",
175
+ "R1670",
176
+ "R9473",
177
+ "R4350"
178
+ ],
179
+ "R1222": [
180
+ "R9489",
181
+ "R3958"
182
+ ],
183
+ "R9489": [
184
+ "R2051",
185
+ "R1222"
186
+ ],
187
+ "R2051": [
188
+ "R4543",
189
+ "R9489"
190
+ ],
191
+ "R4543": [
192
+ "R5410",
193
+ "R2051"
194
+ ],
195
+ "R5410": [
196
+ "R4543",
197
+ "R4645"
198
+ ],
199
+ "R4645": [
200
+ "R5410",
201
+ "R8643"
202
+ ],
203
+ "R8643": [
204
+ "R3630",
205
+ "R4645"
206
+ ],
207
+ "R3630": [
208
+ "R8643",
209
+ "R4905"
210
+ ],
211
+ "R4905": [
212
+ "R3630",
213
+ "R3197"
214
+ ],
215
+ "R3197": [
216
+ "R9644",
217
+ "R4905",
218
+ "R7394",
219
+ "R1933"
220
+ ],
221
+ "R8992": [
222
+ "R3958",
223
+ "R3019"
224
+ ],
225
+ "R3019": [
226
+ "R8992",
227
+ "R9203"
228
+ ],
229
+ "R9203": [
230
+ "R3013",
231
+ "R3019"
232
+ ],
233
+ "R3013": [
234
+ "R9203",
235
+ "R9293"
236
+ ],
237
+ "R9293": [
238
+ "R3013",
239
+ "R7130"
240
+ ],
241
+ "R7130": [
242
+ "R9293",
243
+ "R4211"
244
+ ],
245
+ "R4211": [
246
+ "R5971",
247
+ "R7130"
248
+ ],
249
+ "R5971": [
250
+ "R4211",
251
+ "R5173"
252
+ ],
253
+ "R5173": [
254
+ "R7458",
255
+ "R5971"
256
+ ],
257
+ "R7458": [
258
+ "R5548",
259
+ "R6723",
260
+ "R2162",
261
+ "R5173"
262
+ ],
263
+ "R8012": [
264
+ "R6365",
265
+ "R5894"
266
+ ],
267
+ "R6365": [
268
+ "R5510",
269
+ "R8012"
270
+ ],
271
+ "R5510": [
272
+ "R9631",
273
+ "R6365"
274
+ ],
275
+ "R9631": [
276
+ "R1998",
277
+ "R5510"
278
+ ],
279
+ "R1998": [
280
+ "R1985",
281
+ "R9631"
282
+ ],
283
+ "R1985": [
284
+ "R1998",
285
+ "R4825"
286
+ ],
287
+ "R4825": [
288
+ "R8278",
289
+ "R1985"
290
+ ],
291
+ "R8278": [
292
+ "R6712",
293
+ "R4825"
294
+ ],
295
+ "R6712": [
296
+ "R3347",
297
+ "R8278"
298
+ ],
299
+ "R3347": [
300
+ "R3051",
301
+ "R6712",
302
+ "R3632",
303
+ "R6912"
304
+ ],
305
+ "R4876": [
306
+ "R2608",
307
+ "R5894"
308
+ ],
309
+ "R2608": [
310
+ "R4876",
311
+ "R7327"
312
+ ],
313
+ "R7327": [
314
+ "R2608",
315
+ "R9806"
316
+ ],
317
+ "R9806": [
318
+ "R7327",
319
+ "R9420"
320
+ ],
321
+ "R9420": [
322
+ "R9806",
323
+ "R6067"
324
+ ],
325
+ "R6067": [
326
+ "R7880",
327
+ "R9420"
328
+ ],
329
+ "R7880": [
330
+ "R6067",
331
+ "R6680"
332
+ ],
333
+ "R6680": [
334
+ "R7880",
335
+ "R6059"
336
+ ],
337
+ "R6059": [
338
+ "R6680",
339
+ "R6091"
340
+ ],
341
+ "R6091": [
342
+ "R6059",
343
+ "R1360",
344
+ "R1195",
345
+ "R1901"
346
+ ],
347
+ "R5377": [
348
+ "R5894",
349
+ "R4496"
350
+ ],
351
+ "R4496": [
352
+ "R9849",
353
+ "R5377"
354
+ ],
355
+ "R9849": [
356
+ "R6504",
357
+ "R4496"
358
+ ],
359
+ "R6504": [
360
+ "R9849",
361
+ "R8464"
362
+ ],
363
+ "R8464": [
364
+ "R5558",
365
+ "R6504"
366
+ ],
367
+ "R5558": [
368
+ "R7567",
369
+ "R8464"
370
+ ],
371
+ "R7567": [
372
+ "R5558",
373
+ "R4154"
374
+ ],
375
+ "R4154": [
376
+ "R7567",
377
+ "R2870"
378
+ ],
379
+ "R2870": [
380
+ "R9432",
381
+ "R4154"
382
+ ],
383
+ "R9432": [
384
+ "R5391",
385
+ "R8887",
386
+ "R2870",
387
+ "R9284"
388
+ ],
389
+ "R3355": [
390
+ "R3017",
391
+ "R8983"
392
+ ],
393
+ "R3017": [
394
+ "R8109",
395
+ "R3355"
396
+ ],
397
+ "R8109": [
398
+ "R3017",
399
+ "R8318"
400
+ ],
401
+ "R8318": [
402
+ "R2211",
403
+ "R8109"
404
+ ],
405
+ "R2211": [
406
+ "R3178",
407
+ "R8318"
408
+ ],
409
+ "R3178": [
410
+ "R4064",
411
+ "R2211"
412
+ ],
413
+ "R4064": [
414
+ "R3178",
415
+ "R2771"
416
+ ],
417
+ "R2771": [
418
+ "R4064",
419
+ "R1994"
420
+ ],
421
+ "R1994": [
422
+ "R2771",
423
+ "R2184"
424
+ ],
425
+ "R2184": [
426
+ "R6660",
427
+ "R3909",
428
+ "R1994",
429
+ "R6804"
430
+ ],
431
+ "R6590": [
432
+ "R8983",
433
+ "R2090"
434
+ ],
435
+ "R2090": [
436
+ "R3645",
437
+ "R6590"
438
+ ],
439
+ "R3645": [
440
+ "R4251",
441
+ "R2090"
442
+ ],
443
+ "R4251": [
444
+ "R3645",
445
+ "R6338"
446
+ ],
447
+ "R6338": [
448
+ "R4251",
449
+ "R1874"
450
+ ],
451
+ "R1874": [
452
+ "R4160",
453
+ "R6338"
454
+ ],
455
+ "R4160": [
456
+ "R1874",
457
+ "R3733"
458
+ ],
459
+ "R3733": [
460
+ "R4160",
461
+ "R5861"
462
+ ],
463
+ "R5861": [
464
+ "R3469",
465
+ "R3733"
466
+ ],
467
+ "R3469": [
468
+ "R4983",
469
+ "R5861",
470
+ "R9955",
471
+ "R4353"
472
+ ],
473
+ "R5547": [
474
+ "R9789",
475
+ "R8983"
476
+ ],
477
+ "R9789": [
478
+ "R5547",
479
+ "R5723"
480
+ ],
481
+ "R5723": [
482
+ "R7453",
483
+ "R9789"
484
+ ],
485
+ "R7453": [
486
+ "R6079",
487
+ "R5723"
488
+ ],
489
+ "R6079": [
490
+ "R7453",
491
+ "R1707"
492
+ ],
493
+ "R1707": [
494
+ "R3922",
495
+ "R6079"
496
+ ],
497
+ "R3922": [
498
+ "R8903",
499
+ "R1707"
500
+ ],
501
+ "R8903": [
502
+ "R3922",
503
+ "R8369"
504
+ ],
505
+ "R8369": [
506
+ "R8903",
507
+ "R9763"
508
+ ],
509
+ "R9763": [
510
+ "R8264",
511
+ "R3900",
512
+ "R8105",
513
+ "R8369"
514
+ ],
515
+ "R9473": [
516
+ "R4720",
517
+ "R6726"
518
+ ],
519
+ "R4720": [
520
+ "R9473",
521
+ "R7833"
522
+ ],
523
+ "R7833": [
524
+ "R3238",
525
+ "R4720"
526
+ ],
527
+ "R3238": [
528
+ "R8852",
529
+ "R7833"
530
+ ],
531
+ "R8852": [
532
+ "R3345",
533
+ "R3238"
534
+ ],
535
+ "R3345": [
536
+ "R8852",
537
+ "R2705"
538
+ ],
539
+ "R2705": [
540
+ "R3345",
541
+ "R9896"
542
+ ],
543
+ "R9896": [
544
+ "R2102",
545
+ "R2705"
546
+ ],
547
+ "R2102": [
548
+ "R3853",
549
+ "R9896"
550
+ ],
551
+ "R3853": [
552
+ "R2102"
553
+ ],
554
+ "R6977": [
555
+ "R6726",
556
+ "R3108"
557
+ ],
558
+ "R3108": [
559
+ "R6977",
560
+ "R4265"
561
+ ],
562
+ "R4265": [
563
+ "R3108",
564
+ "R6309"
565
+ ],
566
+ "R6309": [
567
+ "R8110",
568
+ "R4265"
569
+ ],
570
+ "R8110": [
571
+ "R6309",
572
+ "R9964"
573
+ ],
574
+ "R9964": [
575
+ "R7927",
576
+ "R8110"
577
+ ],
578
+ "R7927": [
579
+ "R9964",
580
+ "R1055"
581
+ ],
582
+ "R1055": [
583
+ "R7927",
584
+ "R1846"
585
+ ],
586
+ "R1846": [
587
+ "R8730",
588
+ "R1055"
589
+ ],
590
+ "R8730": [
591
+ "R1846"
592
+ ],
593
+ "R1670": [
594
+ "R6726",
595
+ "R9890"
596
+ ],
597
+ "R9890": [
598
+ "R2398",
599
+ "R1670"
600
+ ],
601
+ "R2398": [
602
+ "R9890",
603
+ "R6816"
604
+ ],
605
+ "R6816": [
606
+ "R6713",
607
+ "R2398"
608
+ ],
609
+ "R6713": [
610
+ "R6421",
611
+ "R6816"
612
+ ],
613
+ "R6421": [
614
+ "R8465",
615
+ "R6713"
616
+ ],
617
+ "R8465": [
618
+ "R9794",
619
+ "R6421"
620
+ ],
621
+ "R9794": [
622
+ "R3142",
623
+ "R8465"
624
+ ],
625
+ "R3142": [
626
+ "R9794",
627
+ "R8125"
628
+ ],
629
+ "R8125": [
630
+ "R3142"
631
+ ],
632
+ "R1933": [
633
+ "R3197",
634
+ "R6272"
635
+ ],
636
+ "R6272": [
637
+ "R7135",
638
+ "R1933"
639
+ ],
640
+ "R7135": [
641
+ "R6272",
642
+ "R5645"
643
+ ],
644
+ "R5645": [
645
+ "R1141",
646
+ "R7135"
647
+ ],
648
+ "R1141": [
649
+ "R5645",
650
+ "R8482"
651
+ ],
652
+ "R8482": [
653
+ "R1141",
654
+ "R9564"
655
+ ],
656
+ "R9564": [
657
+ "R8482",
658
+ "R7297"
659
+ ],
660
+ "R7297": [
661
+ "R9564",
662
+ "R2921"
663
+ ],
664
+ "R2921": [
665
+ "R8207",
666
+ "R7297"
667
+ ],
668
+ "R8207": [
669
+ "R2921"
670
+ ],
671
+ "R9644": [
672
+ "R2814",
673
+ "R3197"
674
+ ],
675
+ "R2814": [
676
+ "R9644",
677
+ "R9530"
678
+ ],
679
+ "R9530": [
680
+ "R2814",
681
+ "R8316"
682
+ ],
683
+ "R8316": [
684
+ "R9530",
685
+ "R1915"
686
+ ],
687
+ "R1915": [
688
+ "R8316",
689
+ "R3944"
690
+ ],
691
+ "R3944": [
692
+ "R1915",
693
+ "R1287"
694
+ ],
695
+ "R1287": [
696
+ "R2789",
697
+ "R3944"
698
+ ],
699
+ "R2789": [
700
+ "R6851",
701
+ "R1287"
702
+ ],
703
+ "R6851": [
704
+ "R2789",
705
+ "R1961"
706
+ ],
707
+ "R1961": [
708
+ "R6851"
709
+ ],
710
+ "R7394": [
711
+ "R2459",
712
+ "R3197"
713
+ ],
714
+ "R2459": [
715
+ "R4948",
716
+ "R7394"
717
+ ],
718
+ "R4948": [
719
+ "R7013",
720
+ "R2459"
721
+ ],
722
+ "R7013": [
723
+ "R6531",
724
+ "R4948"
725
+ ],
726
+ "R6531": [
727
+ "R7013",
728
+ "R7317"
729
+ ],
730
+ "R7317": [
731
+ "R6531",
732
+ "R9699"
733
+ ],
734
+ "R9699": [
735
+ "R7317",
736
+ "R1269"
737
+ ],
738
+ "R1269": [
739
+ "R6327",
740
+ "R9699"
741
+ ],
742
+ "R6327": [
743
+ "R1269",
744
+ "R2840"
745
+ ],
746
+ "R2840": [
747
+ "R6327"
748
+ ],
749
+ "R6723": [
750
+ "R7458",
751
+ "R4523"
752
+ ],
753
+ "R4523": [
754
+ "R6723",
755
+ "R9880"
756
+ ],
757
+ "R9880": [
758
+ "R4523",
759
+ "R8808"
760
+ ],
761
+ "R8808": [
762
+ "R1179",
763
+ "R9880"
764
+ ],
765
+ "R1179": [
766
+ "R8808",
767
+ "R3080"
768
+ ],
769
+ "R3080": [
770
+ "R1179",
771
+ "R4837"
772
+ ],
773
+ "R4837": [
774
+ "R5947",
775
+ "R3080"
776
+ ],
777
+ "R5947": [
778
+ "R9731",
779
+ "R4837"
780
+ ],
781
+ "R9731": [
782
+ "R5947",
783
+ "R8087"
784
+ ],
785
+ "R8087": [
786
+ "R9731"
787
+ ],
788
+ "R5548": [
789
+ "R7458",
790
+ "R8801"
791
+ ],
792
+ "R8801": [
793
+ "R6656",
794
+ "R5548"
795
+ ],
796
+ "R6656": [
797
+ "R8801",
798
+ "R8181"
799
+ ],
800
+ "R8181": [
801
+ "R6656",
802
+ "R8861"
803
+ ],
804
+ "R8861": [
805
+ "R9092",
806
+ "R8181"
807
+ ],
808
+ "R9092": [
809
+ "R8861",
810
+ "R4622"
811
+ ],
812
+ "R4622": [
813
+ "R9092",
814
+ "R1599"
815
+ ],
816
+ "R1599": [
817
+ "R6457",
818
+ "R4622"
819
+ ],
820
+ "R6457": [
821
+ "R4042",
822
+ "R1599"
823
+ ],
824
+ "R4042": [
825
+ "R6457"
826
+ ],
827
+ "R2162": [
828
+ "R7054",
829
+ "R7458"
830
+ ],
831
+ "R7054": [
832
+ "R2220",
833
+ "R2162"
834
+ ],
835
+ "R2220": [
836
+ "R2107",
837
+ "R7054"
838
+ ],
839
+ "R2107": [
840
+ "R2220",
841
+ "R9727"
842
+ ],
843
+ "R9727": [
844
+ "R2107",
845
+ "R3933"
846
+ ],
847
+ "R3933": [
848
+ "R9727",
849
+ "R8723"
850
+ ],
851
+ "R8723": [
852
+ "R3933",
853
+ "R9544"
854
+ ],
855
+ "R9544": [
856
+ "R8723",
857
+ "R8517"
858
+ ],
859
+ "R8517": [
860
+ "R9544",
861
+ "R9204"
862
+ ],
863
+ "R9204": [
864
+ "R8517"
865
+ ],
866
+ "R6912": [
867
+ "R1112",
868
+ "R3347"
869
+ ],
870
+ "R1112": [
871
+ "R4612",
872
+ "R6912"
873
+ ],
874
+ "R4612": [
875
+ "R1112",
876
+ "R1291"
877
+ ],
878
+ "R1291": [
879
+ "R8996",
880
+ "R4612"
881
+ ],
882
+ "R8996": [
883
+ "R6384",
884
+ "R1291"
885
+ ],
886
+ "R6384": [
887
+ "R2824",
888
+ "R8996"
889
+ ],
890
+ "R2824": [
891
+ "R6384",
892
+ "R1190"
893
+ ],
894
+ "R1190": [
895
+ "R9975",
896
+ "R2824"
897
+ ],
898
+ "R9975": [
899
+ "R1190",
900
+ "R3676"
901
+ ],
902
+ "R3676": [
903
+ "R9975"
904
+ ],
905
+ "R3051": [
906
+ "R3347",
907
+ "R2190"
908
+ ],
909
+ "R2190": [
910
+ "R3051",
911
+ "R7931"
912
+ ],
913
+ "R7931": [
914
+ "R2190",
915
+ "R6015"
916
+ ],
917
+ "R6015": [
918
+ "R7931",
919
+ "R4504"
920
+ ],
921
+ "R4504": [
922
+ "R6015",
923
+ "R4438"
924
+ ],
925
+ "R4438": [
926
+ "R6386",
927
+ "R4504"
928
+ ],
929
+ "R6386": [
930
+ "R4438",
931
+ "R7305"
932
+ ],
933
+ "R7305": [
934
+ "R6386",
935
+ "R4768"
936
+ ],
937
+ "R4768": [
938
+ "R1794",
939
+ "R7305"
940
+ ],
941
+ "R1794": [
942
+ "R4768"
943
+ ],
944
+ "R3632": [
945
+ "R3872",
946
+ "R3347"
947
+ ],
948
+ "R3872": [
949
+ "R4215",
950
+ "R3632"
951
+ ],
952
+ "R4215": [
953
+ "R7557",
954
+ "R3872"
955
+ ],
956
+ "R7557": [
957
+ "R4215",
958
+ "R3427"
959
+ ],
960
+ "R3427": [
961
+ "R7865",
962
+ "R7557"
963
+ ],
964
+ "R7865": [
965
+ "R4337",
966
+ "R3427"
967
+ ],
968
+ "R4337": [
969
+ "R7865",
970
+ "R1570"
971
+ ],
972
+ "R1570": [
973
+ "R4337",
974
+ "R9086"
975
+ ],
976
+ "R9086": [
977
+ "R2114",
978
+ "R1570"
979
+ ],
980
+ "R2114": [
981
+ "R9086"
982
+ ],
983
+ "R1360": [
984
+ "R6091",
985
+ "R5731"
986
+ ],
987
+ "R5731": [
988
+ "R2030",
989
+ "R1360"
990
+ ],
991
+ "R2030": [
992
+ "R5731",
993
+ "R1945"
994
+ ],
995
+ "R1945": [
996
+ "R2030",
997
+ "R1187"
998
+ ],
999
+ "R1187": [
1000
+ "R1945",
1001
+ "R6348"
1002
+ ],
1003
+ "R6348": [
1004
+ "R5300",
1005
+ "R1187"
1006
+ ],
1007
+ "R5300": [
1008
+ "R7285",
1009
+ "R6348"
1010
+ ],
1011
+ "R7285": [
1012
+ "R5300",
1013
+ "R5333"
1014
+ ],
1015
+ "R5333": [
1016
+ "R2478",
1017
+ "R7285"
1018
+ ],
1019
+ "R2478": [
1020
+ "R5333"
1021
+ ],
1022
+ "R1195": [
1023
+ "R6091",
1024
+ "R3649"
1025
+ ],
1026
+ "R3649": [
1027
+ "R5368",
1028
+ "R1195"
1029
+ ],
1030
+ "R5368": [
1031
+ "R3649",
1032
+ "R4386"
1033
+ ],
1034
+ "R4386": [
1035
+ "R5368",
1036
+ "R9922"
1037
+ ],
1038
+ "R9922": [
1039
+ "R4386",
1040
+ "R9690"
1041
+ ],
1042
+ "R9690": [
1043
+ "R9922",
1044
+ "R5505"
1045
+ ],
1046
+ "R5505": [
1047
+ "R6947",
1048
+ "R9690"
1049
+ ],
1050
+ "R6947": [
1051
+ "R3127",
1052
+ "R5505"
1053
+ ],
1054
+ "R3127": [
1055
+ "R6947",
1056
+ "R2572"
1057
+ ],
1058
+ "R2572": [
1059
+ "R3127"
1060
+ ],
1061
+ "R1901": [
1062
+ "R6091",
1063
+ "R6748"
1064
+ ],
1065
+ "R6748": [
1066
+ "R1901",
1067
+ "R2044"
1068
+ ],
1069
+ "R2044": [
1070
+ "R6748",
1071
+ "R7176"
1072
+ ],
1073
+ "R7176": [
1074
+ "R2044",
1075
+ "R6962"
1076
+ ],
1077
+ "R6962": [
1078
+ "R7176",
1079
+ "R1535"
1080
+ ],
1081
+ "R1535": [
1082
+ "R9025",
1083
+ "R6962"
1084
+ ],
1085
+ "R9025": [
1086
+ "R1535",
1087
+ "R7972"
1088
+ ],
1089
+ "R7972": [
1090
+ "R7419",
1091
+ "R9025"
1092
+ ],
1093
+ "R7419": [
1094
+ "R4619",
1095
+ "R7972"
1096
+ ],
1097
+ "R4619": [
1098
+ "R7419"
1099
+ ],
1100
+ "R9284": [
1101
+ "R6885",
1102
+ "R9432"
1103
+ ],
1104
+ "R6885": [
1105
+ "R9284",
1106
+ "R4889"
1107
+ ],
1108
+ "R4889": [
1109
+ "R1619",
1110
+ "R6885"
1111
+ ],
1112
+ "R1619": [
1113
+ "R4889",
1114
+ "R7796"
1115
+ ],
1116
+ "R7796": [
1117
+ "R2677",
1118
+ "R1619"
1119
+ ],
1120
+ "R2677": [
1121
+ "R7732",
1122
+ "R7796"
1123
+ ],
1124
+ "R7732": [
1125
+ "R5197",
1126
+ "R2677"
1127
+ ],
1128
+ "R5197": [
1129
+ "R7732",
1130
+ "R3379"
1131
+ ],
1132
+ "R3379": [
1133
+ "R4977",
1134
+ "R5197"
1135
+ ],
1136
+ "R4977": [
1137
+ "R3379"
1138
+ ],
1139
+ "R5391": [
1140
+ "R1125",
1141
+ "R9432"
1142
+ ],
1143
+ "R1125": [
1144
+ "R4382",
1145
+ "R5391"
1146
+ ],
1147
+ "R4382": [
1148
+ "R7166",
1149
+ "R1125"
1150
+ ],
1151
+ "R7166": [
1152
+ "R4382",
1153
+ "R4081"
1154
+ ],
1155
+ "R4081": [
1156
+ "R2872",
1157
+ "R7166"
1158
+ ],
1159
+ "R2872": [
1160
+ "R4081",
1161
+ "R4207"
1162
+ ],
1163
+ "R4207": [
1164
+ "R8221",
1165
+ "R2872"
1166
+ ],
1167
+ "R8221": [
1168
+ "R9163",
1169
+ "R4207"
1170
+ ],
1171
+ "R9163": [
1172
+ "R8221",
1173
+ "R1947"
1174
+ ],
1175
+ "R1947": [
1176
+ "R9163"
1177
+ ],
1178
+ "R8887": [
1179
+ "R9432",
1180
+ "R8104"
1181
+ ],
1182
+ "R8104": [
1183
+ "R8887",
1184
+ "R1077"
1185
+ ],
1186
+ "R1077": [
1187
+ "R3798",
1188
+ "R8104"
1189
+ ],
1190
+ "R3798": [
1191
+ "R1077",
1192
+ "R4235"
1193
+ ],
1194
+ "R4235": [
1195
+ "R3798",
1196
+ "R4104"
1197
+ ],
1198
+ "R4104": [
1199
+ "R4235",
1200
+ "R1057"
1201
+ ],
1202
+ "R1057": [
1203
+ "R4104",
1204
+ "R8158"
1205
+ ],
1206
+ "R8158": [
1207
+ "R1057",
1208
+ "R6749"
1209
+ ],
1210
+ "R6749": [
1211
+ "R8158",
1212
+ "R6807"
1213
+ ],
1214
+ "R6807": [
1215
+ "R6749"
1216
+ ],
1217
+ "R6804": [
1218
+ "R3521",
1219
+ "R2184"
1220
+ ],
1221
+ "R3521": [
1222
+ "R6804",
1223
+ "R5304"
1224
+ ],
1225
+ "R5304": [
1226
+ "R3521",
1227
+ "R4519"
1228
+ ],
1229
+ "R4519": [
1230
+ "R2530",
1231
+ "R5304"
1232
+ ],
1233
+ "R2530": [
1234
+ "R5850",
1235
+ "R4519"
1236
+ ],
1237
+ "R5850": [
1238
+ "R2827",
1239
+ "R2530"
1240
+ ],
1241
+ "R2827": [
1242
+ "R4704",
1243
+ "R5850"
1244
+ ],
1245
+ "R4704": [
1246
+ "R2827",
1247
+ "R7523"
1248
+ ],
1249
+ "R7523": [
1250
+ "R4704",
1251
+ "R9802"
1252
+ ],
1253
+ "R9802": [
1254
+ "R7523"
1255
+ ],
1256
+ "R3909": [
1257
+ "R2184",
1258
+ "R6222"
1259
+ ],
1260
+ "R6222": [
1261
+ "R3909",
1262
+ "R8186"
1263
+ ],
1264
+ "R8186": [
1265
+ "R6222",
1266
+ "R6121"
1267
+ ],
1268
+ "R6121": [
1269
+ "R5965",
1270
+ "R8186"
1271
+ ],
1272
+ "R5965": [
1273
+ "R6121",
1274
+ "R7211"
1275
+ ],
1276
+ "R7211": [
1277
+ "R5965",
1278
+ "R9460"
1279
+ ],
1280
+ "R9460": [
1281
+ "R5049",
1282
+ "R7211"
1283
+ ],
1284
+ "R5049": [
1285
+ "R7577",
1286
+ "R9460"
1287
+ ],
1288
+ "R7577": [
1289
+ "R5049",
1290
+ "R9977"
1291
+ ],
1292
+ "R9977": [
1293
+ "R7577"
1294
+ ],
1295
+ "R6660": [
1296
+ "R8365",
1297
+ "R2184"
1298
+ ],
1299
+ "R8365": [
1300
+ "R6660",
1301
+ "R7272"
1302
+ ],
1303
+ "R7272": [
1304
+ "R1070",
1305
+ "R8365"
1306
+ ],
1307
+ "R1070": [
1308
+ "R2807",
1309
+ "R7272"
1310
+ ],
1311
+ "R2807": [
1312
+ "R5781",
1313
+ "R1070"
1314
+ ],
1315
+ "R5781": [
1316
+ "R2807",
1317
+ "R9299"
1318
+ ],
1319
+ "R9299": [
1320
+ "R5781",
1321
+ "R1782"
1322
+ ],
1323
+ "R1782": [
1324
+ "R9299",
1325
+ "R8245"
1326
+ ],
1327
+ "R8245": [
1328
+ "R1782",
1329
+ "R6188"
1330
+ ],
1331
+ "R6188": [
1332
+ "R8245"
1333
+ ],
1334
+ "R9955": [
1335
+ "R3469",
1336
+ "R7202"
1337
+ ],
1338
+ "R7202": [
1339
+ "R3964",
1340
+ "R9955"
1341
+ ],
1342
+ "R3964": [
1343
+ "R7202",
1344
+ "R8205"
1345
+ ],
1346
+ "R8205": [
1347
+ "R3964",
1348
+ "R3314"
1349
+ ],
1350
+ "R3314": [
1351
+ "R8205",
1352
+ "R6731"
1353
+ ],
1354
+ "R6731": [
1355
+ "R3314",
1356
+ "R5710"
1357
+ ],
1358
+ "R5710": [
1359
+ "R6731",
1360
+ "R3780"
1361
+ ],
1362
+ "R3780": [
1363
+ "R5710",
1364
+ "R5538"
1365
+ ],
1366
+ "R5538": [
1367
+ "R3780",
1368
+ "R4194"
1369
+ ],
1370
+ "R4194": [
1371
+ "R5538"
1372
+ ],
1373
+ "R4353": [
1374
+ "R2739",
1375
+ "R3469"
1376
+ ],
1377
+ "R2739": [
1378
+ "R4353",
1379
+ "R6217"
1380
+ ],
1381
+ "R6217": [
1382
+ "R7044",
1383
+ "R2739"
1384
+ ],
1385
+ "R7044": [
1386
+ "R6217",
1387
+ "R4258"
1388
+ ],
1389
+ "R4258": [
1390
+ "R7044",
1391
+ "R5224"
1392
+ ],
1393
+ "R5224": [
1394
+ "R4258",
1395
+ "R3874"
1396
+ ],
1397
+ "R3874": [
1398
+ "R5224",
1399
+ "R8656"
1400
+ ],
1401
+ "R8656": [
1402
+ "R3874",
1403
+ "R6904"
1404
+ ],
1405
+ "R6904": [
1406
+ "R8656",
1407
+ "R9936"
1408
+ ],
1409
+ "R9936": [
1410
+ "R6904"
1411
+ ],
1412
+ "R4983": [
1413
+ "R1323",
1414
+ "R3469"
1415
+ ],
1416
+ "R1323": [
1417
+ "R9502",
1418
+ "R4983"
1419
+ ],
1420
+ "R9502": [
1421
+ "R6034",
1422
+ "R1323"
1423
+ ],
1424
+ "R6034": [
1425
+ "R7495",
1426
+ "R9502"
1427
+ ],
1428
+ "R7495": [
1429
+ "R4127",
1430
+ "R6034"
1431
+ ],
1432
+ "R4127": [
1433
+ "R7393",
1434
+ "R7495"
1435
+ ],
1436
+ "R7393": [
1437
+ "R4127",
1438
+ "R5541"
1439
+ ],
1440
+ "R5541": [
1441
+ "R2561",
1442
+ "R7393"
1443
+ ],
1444
+ "R2561": [
1445
+ "R5541",
1446
+ "R7251"
1447
+ ],
1448
+ "R7251": [
1449
+ "R2561"
1450
+ ],
1451
+ "R8264": [
1452
+ "R9763",
1453
+ "R7052"
1454
+ ],
1455
+ "R7052": [
1456
+ "R8264",
1457
+ "R6175"
1458
+ ],
1459
+ "R6175": [
1460
+ "R7052",
1461
+ "R1040"
1462
+ ],
1463
+ "R1040": [
1464
+ "R6175",
1465
+ "R8877"
1466
+ ],
1467
+ "R8877": [
1468
+ "R1040",
1469
+ "R4044"
1470
+ ],
1471
+ "R4044": [
1472
+ "R8877",
1473
+ "R4819"
1474
+ ],
1475
+ "R4819": [
1476
+ "R9500",
1477
+ "R4044"
1478
+ ],
1479
+ "R9500": [
1480
+ "R4819",
1481
+ "R5450"
1482
+ ],
1483
+ "R5450": [
1484
+ "R4783",
1485
+ "R9500"
1486
+ ],
1487
+ "R4783": [
1488
+ "R5450"
1489
+ ],
1490
+ "R3900": [
1491
+ "R8671",
1492
+ "R9763"
1493
+ ],
1494
+ "R8671": [
1495
+ "R8100",
1496
+ "R3900"
1497
+ ],
1498
+ "R8100": [
1499
+ "R8671",
1500
+ "R6314"
1501
+ ],
1502
+ "R6314": [
1503
+ "R4328",
1504
+ "R8100"
1505
+ ],
1506
+ "R4328": [
1507
+ "R7073",
1508
+ "R6314"
1509
+ ],
1510
+ "R7073": [
1511
+ "R3319",
1512
+ "R4328"
1513
+ ],
1514
+ "R3319": [
1515
+ "R7073",
1516
+ "R7141"
1517
+ ],
1518
+ "R7141": [
1519
+ "R3319",
1520
+ "R9462"
1521
+ ],
1522
+ "R9462": [
1523
+ "R2704",
1524
+ "R7141"
1525
+ ],
1526
+ "R2704": [
1527
+ "R9462"
1528
+ ],
1529
+ "R8105": [
1530
+ "R4560",
1531
+ "R9763"
1532
+ ],
1533
+ "R4560": [
1534
+ "R8105",
1535
+ "R8116"
1536
+ ],
1537
+ "R8116": [
1538
+ "R4697",
1539
+ "R4560"
1540
+ ],
1541
+ "R4697": [
1542
+ "R8000",
1543
+ "R8116"
1544
+ ],
1545
+ "R8000": [
1546
+ "R8812",
1547
+ "R4697"
1548
+ ],
1549
+ "R8812": [
1550
+ "R8000",
1551
+ "R5024"
1552
+ ],
1553
+ "R5024": [
1554
+ "R4429",
1555
+ "R8812"
1556
+ ],
1557
+ "R4429": [
1558
+ "R5024",
1559
+ "R7573"
1560
+ ],
1561
+ "R7573": [
1562
+ "R5360",
1563
+ "R4429"
1564
+ ],
1565
+ "R5360": [
1566
+ "R7573"
1567
+ ]
1568
+ }
1569
+ }
tasks/maze-t16/instruction.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Find the exit of the maze
2
+
3
+ You are exploring a maze of rooms connected by doors to find the exit. The maze is a tree: from
4
+ the start room, corridors of rooms lead to junctions where the way divides, and the exit is one
5
+ of the dead ends at the far ends of the corridors. Every agent on your team starts in the same
6
+ room, in its own copy of the same maze: the same rooms, with the same doors listed in the same
7
+ order. Your position is your own: moving never moves a teammate.
8
+
9
+ Explore with the `maze` command in your shell:
10
+
11
+ - `maze look` describes your current room again, without moving;
12
+ - `maze move ROOM` walks through a door of your current room into the named adjacent room.
13
+
14
+ Each prints JSON: the room you are in (`room`), its doors (`doors`), whether it is the exit
15
+ (`exit`), the room you arrived from (`arrived_from`) and how many moves you have left
16
+ (`moves_left`), with a `notice` at a dead end. Only the doors listed for your current room are
17
+ reachable in one move; to go back, move to the room you arrived from. Room names carry no
18
+ information about where the exit is.
19
+
20
+ You can make at most 210 moves. Looking is free, and a refused move (into a room that is not
21
+ one of your doors) costs nothing.
22
+
23
+ Reaching the exit solves the task for the whole team and ends the run. If you have teammates
24
+ (your instructions name them), they are searching the same maze: what one of you learns about it
25
+ holds for everyone. Use the message board to share what you find and to read what they find.
26
+ Once you reach the exit, post that you have, then stop.
tasks/maze-t16/solution/solve.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: walk the shortest path to the exit with `maze move`, from its own copy of the path.
3
+ set -e
4
+ for room in R5707 R6677 R9932 R7204 R9118 R7516 R5812 R8944 R8178 R8983 R6590 R2090 R3645 R4251 R6338 R1874 R4160 R3733 R5861 R3469 R4353 R2739 R6217 R7044 R4258 R5224 R3874 R8656 R6904 R9936; do
5
+ maze move "$room" > /dev/null
6
+ done
7
+ maze look
tasks/maze-t16/task.toml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ # The maze service's own record of the walk, exported by its collect hook below once the agent
4
+ # is done: the grader's only input besides tests/expected.json.
5
+ [[artifacts]]
6
+ source = "/evidence/final.json"
7
+ service = "maze"
8
+
9
+ [[artifacts]]
10
+ source = "/evidence/moves.jsonl"
11
+ service = "maze"
12
+
13
+ [task]
14
+ name = "HuggingFaceSwarms/maze-t16"
15
+ version = "0.1.0"
16
+ description = "s3-maze: agents search their own copies of one maze; the first one out wins."
17
+ keywords = ["multi-agent", "message-board", "s3", "maze", "exploration"]
18
+
19
+ [metadata]
20
+ tree = 16
21
+ seed = 115
22
+ branching = 3
23
+ corridor = 10
24
+ depth = 3
25
+ rooms = 391
26
+ dead_ends = 27
27
+ shortest_path = 30
28
+ full_search = 780
29
+ move_budget = 210
30
+
31
+ [agent]
32
+ timeout_sec = 3600
33
+
34
+ [environment]
35
+ build_timeout_sec = 900
36
+ cpus = 1
37
+ memory_mb = 1024
38
+
39
+ [verifier]
40
+ # The grader runs in its own container (tests/Dockerfile) after the agent's has stopped, on
41
+ # what the maze service exported: nothing the agent's container holds reaches it.
42
+ environment_mode = "separate"
43
+ timeout_sec = 120
44
+
45
+ [[verifier.collect]]
46
+ service = "maze"
47
+ command = "python3 -I -S /app/export.py"
48
+ timeout_sec = 30
tasks/maze-t16/tests/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The verifier's own container (environment_mode = "separate"): the grader and the task's
3
+ # answer, never in the agent's container. Harbor adds /evidence from the maze service.
4
+ COPY test.sh grade.py expected.json /tests/
5
+ RUN chmod 755 /tests/test.sh
tasks/maze-t16/tests/expected.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "start": "R7074",
3
+ "exit": "R9936",
4
+ "budget": 210,
5
+ "tree_sha256": "dabf9f9cd5a30658a79485ee8f749fbef97142c335548e3f4a1311a4f126876a"
6
+ }
tasks/maze-t16/tests/grade.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """s3-maze's grader: reward 1 if the agent's walk reached the exit, from the maze service's own
2
+ record. Run by test.sh as `python3 -I -S grade.py`, in a fresh verifier container (the task's
3
+ `environment_mode = "separate"`), after the agent's container has stopped.
4
+
5
+ It reads only /evidence/final.json and /evidence/moves.jsonl, which the maze service exported
6
+ (export.py, Harbor's collect hook) and Harbor carried over, and expected.json (this folder,
7
+ never in the agent's container). Reward 1 needs all of: the export is the service's
8
+ (`exported_by`), for this task's tree (its sha256), start and move budget; the service says the
9
+ exit was reached and the walk ends there; and the move log's accepted moves are one unbroken
10
+ walk from the start to the exit, within the budget, as many as the service counted. Anything
11
+ else, a missing, unreadable or malformed file included, scores 0.
12
+
13
+ Each file counts only as a regular file of its own at exactly its path: no link anywhere on the
14
+ path is followed, and a FIFO cannot block the read. The reward file is written 0 first and
15
+ never through a link. Copies of both files stay in the verifier's folder, for the metrics.
16
+ EVIDENCE_DIR, EXPECTED and VERIFIER_DIR override the paths (no links in them), to test locally.
17
+ """
18
+
19
+ import json
20
+ import os
21
+ import stat
22
+
23
+ EVIDENCE = os.environ.get("EVIDENCE_DIR", "/evidence")
24
+ EXPECTED = os.environ.get("EXPECTED", "/tests/expected.json")
25
+ VERIFIER = os.environ.get("VERIFIER_DIR", "/logs/verifier")
26
+ LIMIT = 16 << 20 # bytes
27
+
28
+
29
+ def read_own(path: str) -> bytes:
30
+ """The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ without following a link, and so is the file (a FIFO cannot block it); one link only."""
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(name: str, data: bytes) -> None:
53
+ path = os.path.join(VERIFIER, name)
54
+ try:
55
+ os.unlink(path) # never written through a link
56
+ except FileNotFoundError:
57
+ pass
58
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644)
59
+ with os.fdopen(fd, "wb") as stream:
60
+ stream.write(data)
61
+
62
+
63
+ def reject_constant(name):
64
+ raise ValueError(f"{name} is not JSON")
65
+
66
+
67
+ def parse(data: bytes):
68
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
69
+
70
+
71
+ def walk_reaches_exit(final: dict, records: list, expected: dict) -> bool:
72
+ room, moves = expected["start"], 0
73
+ for record in records:
74
+ if not isinstance(record, dict) or record.get("ok") not in (True, False):
75
+ return False
76
+ if record["ok"] is True:
77
+ if record.get("from") != room or not isinstance(record.get("to"), str):
78
+ return False
79
+ room, moves = record["to"], moves + 1
80
+ return (room == expected["exit"] and moves == final.get("moves")
81
+ and 0 < moves <= expected["budget"])
82
+
83
+
84
+ def grade() -> bool:
85
+ expected = parse(read_own(EXPECTED))
86
+ final_data = read_own(os.path.join(EVIDENCE, "final.json"))
87
+ moves_data = read_own(os.path.join(EVIDENCE, "moves.jsonl"))
88
+ write_new("final.json", final_data)
89
+ write_new("moves.jsonl", moves_data)
90
+ final = parse(final_data)
91
+ records = [parse(line) for line in moves_data.splitlines() if line.strip()]
92
+ return (
93
+ isinstance(final, dict)
94
+ and final.get("exported_by") == "maze"
95
+ and final.get("tree_sha256") == expected["tree_sha256"]
96
+ and final.get("start") == expected["start"]
97
+ and final.get("budget") == expected["budget"]
98
+ and final.get("reached") is True
99
+ and final.get("room") == expected["exit"]
100
+ and walk_reaches_exit(final, records, expected)
101
+ )
102
+
103
+
104
+ os.makedirs(VERIFIER, exist_ok=True)
105
+ for name in ("reward.txt", "reward.json"):
106
+ try:
107
+ os.unlink(os.path.join(VERIFIER, name))
108
+ except FileNotFoundError:
109
+ pass
110
+ write_new("reward.txt", b"0")
111
+ try:
112
+ valid = grade()
113
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, a wrong shape
114
+ valid = False
115
+ if valid:
116
+ write_new("reward.txt", b"1")
117
+ print("reward:", 1 if valid else 0)
tasks/maze-t16/tests/test.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # s3-maze's verifier, in a fresh container built from this folder (environment_mode =
3
+ # "separate"): reward 1 if the maze service's own record shows the agent's walk reached the exit
4
+ # (grade.py has the rules). Reward 0 is written before anything is checked, so a crash of the
5
+ # check also scores 0. Python runs isolated (-I -S): no module from the working directory,
6
+ # PYTHON* variables or site hooks can change what it imports. Besides bash, python3 is the only
7
+ # command this script runs.
8
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
9
+ export EXPECTED=${EXPECTED:-$here/expected.json}
10
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
11
+ [ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
12
+ python3 -I -S "$here/grade.py" || true
tasks/maze-t17/environment/agent/Dockerfile ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The agent's container: only the `maze` command, which talks to the maze service. The tree and
3
+ # the exit are never here.
4
+ RUN apt-get update && apt-get install -y --no-install-recommends bash curl ca-certificates \
5
+ && rm -rf /var/lib/apt/lists/*
6
+ COPY maze /usr/local/bin/maze
7
+ RUN chmod 755 /usr/local/bin/maze
8
+ WORKDIR /app
tasks/maze-t17/environment/agent/maze ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """maze look | maze move ROOM: explore the maze through its service (standard library only).
3
+
4
+ Prints the service's JSON for your current room: `room`, its `doors`, whether it is the `exit`,
5
+ the room you `arrived_from` and your `moves_left` (a dead end adds a `notice`). A refused move
6
+ adds an `error` and exits 1; the service unreachable exits 2.
7
+ """
8
+
9
+ import json
10
+ import os
11
+ import sys
12
+ import time
13
+ import urllib.error
14
+ import urllib.request
15
+
16
+ URL = os.environ.get("MAZE_URL", "http://maze:8000").rstrip("/")
17
+ USAGE = "usage: maze look | maze move ROOM"
18
+
19
+
20
+ def call(request: urllib.request.Request) -> tuple[int, dict]:
21
+ deadline = time.monotonic() + 30 # the service may still be starting
22
+ while True:
23
+ try:
24
+ with urllib.request.urlopen(request, timeout=30) as response:
25
+ return response.status, json.load(response)
26
+ except urllib.error.HTTPError as e:
27
+ try:
28
+ return e.code, json.load(e)
29
+ except ValueError:
30
+ return e.code, {"error": f"HTTP {e.code} from the maze service"}
31
+ except (urllib.error.URLError, ConnectionError, TimeoutError) as e:
32
+ if time.monotonic() > deadline:
33
+ return 0, {"error": f"the maze service is unreachable: {e}"}
34
+ time.sleep(1)
35
+
36
+
37
+ def main(argv: list[str]) -> int:
38
+ if argv == ["look"]:
39
+ request = urllib.request.Request(URL + "/look")
40
+ elif len(argv) == 2 and argv[0] == "move":
41
+ request = urllib.request.Request(
42
+ URL + "/move", data=json.dumps({"room": argv[1]}).encode(), method="POST",
43
+ headers={"Content-Type": "application/json"})
44
+ else:
45
+ print(USAGE, file=sys.stderr)
46
+ return 2
47
+ status, body = call(request)
48
+ print(json.dumps(body))
49
+ return 0 if status == 200 else 1 if status in (400, 409) else 2
50
+
51
+
52
+ if __name__ == "__main__":
53
+ sys.exit(main(sys.argv[1:]))
tasks/maze-t17/environment/docker-compose.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # maze-t17: the agent's container (main) and its own maze service. The service holds
2
+ # the tree and answers only `maze look` and `maze move ROOM`, on a network only main reaches.
3
+ services:
4
+ main:
5
+ image: s3-maze-agent:7ecf229faaac
6
+ build:
7
+ context: ./agent
8
+ networks: [default, maze]
9
+ security_opt: [no-new-privileges:true]
10
+ depends_on: [maze]
11
+ maze:
12
+ image: s3-maze-service:maze-t17-d5a0d37a0f6f
13
+ build:
14
+ context: ./maze
15
+ networks: [maze]
16
+ environment:
17
+ MAZE_AGENT: ${COMPOSE_PROJECT_NAME:-} # the Trial, for the move log
18
+ cap_drop: [ALL]
19
+ security_opt: [no-new-privileges:true]
20
+ pids_limit: 64
21
+ mem_limit: 256m
22
+ networks:
23
+ default: {} # main's way out (Flock replaces it with the agent's own network)
24
+ maze:
25
+ internal: true
tasks/maze-t17/environment/maze/Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The maze service: the tree (private, never in the agent's container), the walk's state and
3
+ # move log, the success check and the collect hook. Standard library only.
4
+ COPY engine.py service.py success.py export.py /app/
5
+ COPY tree.json /private/tree.json
6
+ RUN mkdir -p /var/lib/maze /evidence && chmod 0700 /private /var/lib/maze
7
+ ENV MAZE_TREE=/private/tree.json MAZE_STATE_DIR=/var/lib/maze
8
+ WORKDIR /app
9
+ CMD ["python3", "-I", "-S", "-B", "/app/service.py"]
tasks/maze-t17/environment/maze/engine.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The maze: one agent's walk through its own copy of a tree of rooms (s3-maze).
2
+
3
+ The service (service.py) holds one Walk per Trial; budget.py simulates searches on this same
4
+ code. Python 3.10+, standard library only.
5
+
6
+ A tree is `{"start", "exit", "budget", "doors": {room: [neighbour, ...]}}`: each room lists its
7
+ doors in the order fixed when the tree was generated, the same for every agent and every visit.
8
+ """
9
+
10
+ import json
11
+
12
+ DEAD_END = "Dead end: its only door leads back the way you came."
13
+
14
+
15
+ class Maze:
16
+ def __init__(self, tree: dict):
17
+ self.start = tree["start"]
18
+ self.exit = tree["exit"]
19
+ self.budget = int(tree["budget"])
20
+ self.doors = {room: list(doors) for room, doors in tree["doors"].items()}
21
+
22
+ @classmethod
23
+ def load(cls, path: str) -> "Maze":
24
+ with open(path, encoding="utf-8") as f:
25
+ return cls(json.load(f))
26
+
27
+
28
+ class Walk:
29
+ """One agent's position and its accepted moves. Looking is free; a refused move costs
30
+ nothing; at most `budget` moves are accepted, and none once the exit is reached."""
31
+
32
+ def __init__(self, maze: Maze, room: str | None = None, arrived_from: str | None = None,
33
+ moves: int = 0, refused: int = 0):
34
+ self.maze = maze
35
+ self.room = room or maze.start
36
+ self.arrived_from = arrived_from
37
+ self.moves = moves
38
+ self.refused = refused
39
+
40
+ @property
41
+ def reached(self) -> bool:
42
+ return self.room == self.maze.exit
43
+
44
+ def look(self) -> dict:
45
+ """The paper's observation (s3, Appendix H), plus the moves left."""
46
+ doors = self.maze.doors[self.room]
47
+ out = {"room": self.room, "doors": list(doors), "exit": self.reached,
48
+ "arrived_from": self.arrived_from, "moves_left": self.maze.budget - self.moves}
49
+ if len(doors) == 1 and not self.reached:
50
+ out["notice"] = DEAD_END
51
+ return out
52
+
53
+ def refusal(self, room) -> str | None:
54
+ """Why a move into `room` is refused (a short code), or None."""
55
+ if self.reached:
56
+ return "at_exit"
57
+ if self.moves >= self.maze.budget:
58
+ return "no_moves_left"
59
+ if not isinstance(room, str) or room not in self.maze.doors[self.room]:
60
+ return "not_a_door"
61
+ return None
62
+
63
+ def move(self, room) -> tuple[dict, str | None]:
64
+ """(the observation after moving into `room`, None), or (an error and the current
65
+ observation, the refusal's code)."""
66
+ why = self.refusal(room)
67
+ if why is not None:
68
+ self.refused += 1
69
+ return {"error": MESSAGES[why].format(room=_short(room), here=self.room,
70
+ budget=self.maze.budget), **self.look()}, why
71
+ self.arrived_from, self.room = self.room, room
72
+ self.moves += 1
73
+ return self.look(), None
74
+
75
+ def state(self) -> dict:
76
+ return {"room": self.room, "arrived_from": self.arrived_from, "moves": self.moves,
77
+ "refused": self.refused, "reached": self.reached}
78
+
79
+ @classmethod
80
+ def from_state(cls, maze: Maze, state: dict) -> "Walk":
81
+ return cls(maze, state["room"], state["arrived_from"], state["moves"], state["refused"])
82
+
83
+
84
+ MESSAGES = {
85
+ "at_exit": "You are at the exit: the task is solved.",
86
+ "no_moves_left": "No moves left: your budget of {budget} moves is used up.",
87
+ "not_a_door": "{room} is not a door of {here}: move into one of the doors listed for it.",
88
+ }
89
+
90
+
91
+ def _short(value) -> str:
92
+ text = value if isinstance(value, str) else json.dumps(value)
93
+ return text if len(text) <= 40 else text[:40] + "..."
tasks/maze-t17/environment/maze/export.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Harbor's [[verifier.collect]] hook for s3-maze, run in this maze service once the agent is done
2
+ (its container already stopped): `python3 -I -S /app/export.py`.
3
+
4
+ Writes the service's own record of the walk to /evidence, which Harbor collects as artifacts
5
+ and hands to the grader in a fresh container: `final.json` (the state file, marked as exported
6
+ here) and `moves.jsonl` (the move log). Nothing in /evidence comes from the agent's container.
7
+ """
8
+
9
+ import json
10
+ import os
11
+
12
+ STATE_DIR = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze")
13
+ EVIDENCE = os.environ.get("MAZE_EVIDENCE_DIR", "/evidence")
14
+ LIMIT = 16 << 20
15
+
16
+
17
+ def read(name: str) -> bytes:
18
+ fd = os.open(os.path.join(STATE_DIR, name), os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
19
+ with os.fdopen(fd, "rb") as f:
20
+ return f.read(LIMIT)
21
+
22
+
23
+ def write(name: str, data: bytes) -> None:
24
+ path = os.path.join(EVIDENCE, name)
25
+ temp = path + ".tmp"
26
+ fd = os.open(temp, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
27
+ with os.fdopen(fd, "wb") as f:
28
+ f.write(data)
29
+ os.replace(temp, path)
30
+
31
+
32
+ os.makedirs(EVIDENCE, exist_ok=True)
33
+ state = json.loads(read("state.json"))
34
+ try:
35
+ moves = read("moves.jsonl")
36
+ except FileNotFoundError: # no move was ever asked for
37
+ moves = b""
38
+ write("moves.jsonl", moves)
39
+ write("final.json", json.dumps({**state, "exported_by": "maze"}).encode())
40
+ print("exported", state.get("moves"), "moves; exit reached:", state.get("reached"))
tasks/maze-t17/environment/maze/service.py ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The maze service: one agent's own copy of the maze, behind `maze look` and `maze move ROOM`.
2
+
3
+ Two routes answer, `GET /look` and `POST /move` (`{"room": <a door>}`), each with the current
4
+ room's observation (engine.Walk.look); every other request gets a 404 that names nothing. So the
5
+ tree and the exit stay in this container: an agent learns a room's doors only by standing in it,
6
+ and that a room is the exit only by reaching it.
7
+
8
+ Every move, accepted or refused, is appended to the move log (agent, from, to, time) before it is
9
+ answered, and the walk's state file is replaced after it: success.py (flock's success_check)
10
+ and export.py (Harbor's collect hook, for the grader) read those two files. A restarted
11
+ container resumes from them. Python 3.10+, standard library only.
12
+ """
13
+
14
+ import hashlib
15
+ import json
16
+ import os
17
+ import sys
18
+ import threading
19
+ from datetime import datetime, timezone
20
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
21
+
22
+ sys.dont_write_bytecode = True # -I ignores PYTHONDONTWRITEBYTECODE
23
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
24
+ from engine import Maze, Walk # noqa: E402
25
+
26
+ TREE = os.environ.get("MAZE_TREE", "/private/tree.json")
27
+ STATE_DIR = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze")
28
+ PORT = int(os.environ.get("MAZE_PORT", "8000"))
29
+ # The Trial whose maze this is: compose's project name, `<swarm>-<agent>-tN__env`
30
+ AGENT = os.environ.get("MAZE_AGENT", "").removesuffix("__env") or "agent"
31
+ BODY_LIMIT = 4096
32
+
33
+
34
+ def now() -> str:
35
+ return datetime.now(timezone.utc).isoformat(timespec="milliseconds")
36
+
37
+
38
+ class Service:
39
+ def __init__(self, tree_path: str, state_dir: str, agent: str):
40
+ with open(tree_path, "rb") as f:
41
+ raw = f.read()
42
+ self.maze = Maze(json.loads(raw))
43
+ self.tree_sha256 = hashlib.sha256(raw).hexdigest()
44
+ self.agent = agent
45
+ self.state_path = os.path.join(state_dir, "state.json")
46
+ self.log_path = os.path.join(state_dir, "moves.jsonl")
47
+ self.lock = threading.Lock()
48
+ os.makedirs(state_dir, exist_ok=True)
49
+ self.reached_at = None
50
+ if os.path.exists(self.state_path): # a restarted container
51
+ with open(self.state_path, encoding="utf-8") as f:
52
+ saved = json.load(f)
53
+ self.walk = Walk.from_state(self.maze, saved)
54
+ self.reached_at = saved.get("reached_at")
55
+ else:
56
+ self.walk = Walk(self.maze)
57
+ self.save()
58
+
59
+ def save(self) -> None:
60
+ state = {"agent": self.agent, "start": self.maze.start, "budget": self.maze.budget,
61
+ "tree_sha256": self.tree_sha256, **self.walk.state(),
62
+ "reached_at": self.reached_at}
63
+ temp = self.state_path + ".tmp"
64
+ with open(temp, "w", encoding="utf-8") as f:
65
+ json.dump(state, f)
66
+ f.flush()
67
+ os.fsync(f.fileno())
68
+ os.replace(temp, self.state_path)
69
+
70
+ def look(self) -> dict:
71
+ with self.lock:
72
+ return self.walk.look()
73
+
74
+ def move(self, room) -> tuple[dict, str | None]:
75
+ with self.lock:
76
+ here = self.walk.room
77
+ body, why = self.walk.move(room)
78
+ if why is None and self.walk.reached:
79
+ self.reached_at = now()
80
+ self.log(here, _logged(room), why)
81
+ return body, why
82
+
83
+ def bad_request(self) -> None:
84
+ """A move request without a room: refused, and logged like any other."""
85
+ with self.lock:
86
+ self.walk.refused += 1
87
+ self.log(self.walk.room, None, "bad_request")
88
+
89
+ def log(self, here: str, to, why: str | None) -> None:
90
+ record = {"agent": self.agent, "from": here, "to": to, "time": now(), "ok": why is None,
91
+ "moves": self.walk.moves}
92
+ if why is not None:
93
+ record["refused"] = why
94
+ with open(self.log_path, "a", encoding="utf-8") as f:
95
+ f.write(json.dumps(record) + "\n")
96
+ f.flush()
97
+ os.fsync(f.fileno())
98
+ self.save()
99
+
100
+
101
+ def _logged(room):
102
+ """What the agent asked to move into, as the log keeps it (a string, at most 64 chars)."""
103
+ text = room if isinstance(room, str) else json.dumps(room)
104
+ return text[:64]
105
+
106
+
107
+ def handler(service: Service):
108
+ class Handler(BaseHTTPRequestHandler):
109
+ server_version = "maze"
110
+ sys_version = ""
111
+
112
+ def reply(self, code: int, body: dict) -> None:
113
+ data = json.dumps(body).encode()
114
+ self.send_response(code)
115
+ self.send_header("Content-Type", "application/json")
116
+ self.send_header("Content-Length", str(len(data)))
117
+ self.end_headers()
118
+ self.wfile.write(data)
119
+
120
+ def not_found(self) -> None:
121
+ self.reply(404, {"error": "not found: use `maze look` or `maze move ROOM`"})
122
+
123
+ def do_GET(self): # noqa: N802
124
+ if self.path == "/look":
125
+ self.reply(200, service.look())
126
+ else:
127
+ self.not_found()
128
+
129
+ def do_POST(self): # noqa: N802
130
+ if self.path != "/move":
131
+ return self.not_found()
132
+ try:
133
+ length = int(self.headers.get("Content-Length") or 0)
134
+ except ValueError:
135
+ length = -1
136
+ room = None
137
+ if 0 < length <= BODY_LIMIT:
138
+ try:
139
+ room = json.loads(self.rfile.read(length)).get("room")
140
+ except (ValueError, AttributeError):
141
+ pass
142
+ if room is None:
143
+ service.bad_request()
144
+ return self.reply(400, {"error": 'send {"room": "<a door of your room>"}'})
145
+ body, why = service.move(room)
146
+ self.reply(200 if why is None else 409, body)
147
+
148
+ def do_PUT(self): # noqa: N802
149
+ self.not_found()
150
+
151
+ do_DELETE = do_PATCH = do_HEAD = do_OPTIONS = do_PUT # noqa: N815
152
+
153
+ def log_message(self, *args): # the move log is the record
154
+ pass
155
+
156
+ return Handler
157
+
158
+
159
+ def main() -> None:
160
+ service = Service(TREE, STATE_DIR, AGENT)
161
+ server = ThreadingHTTPServer(("0.0.0.0", PORT), handler(service))
162
+ server.daemon_threads = True
163
+ server.serve_forever()
164
+
165
+
166
+ if __name__ == "__main__":
167
+ main()
tasks/maze-t17/environment/maze/success.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """flock's success_check for s3-maze (`stop_on_success`), run in this maze service, never in the
2
+ agent's container: `python3 -I -S /app/success.py`.
3
+
4
+ Read-only: it prints `{"success": <the exit was reached>, "evidence": {...}}` from the walk's
5
+ state file, which only service.py writes. No state yet, or one that can't be read, is not a
6
+ success.
7
+ """
8
+
9
+ import json
10
+ import os
11
+
12
+ STATE = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze") + "/state.json"
13
+
14
+
15
+ def read_state() -> dict | None:
16
+ try:
17
+ fd = os.open(STATE, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
18
+ with os.fdopen(fd, "rb") as f:
19
+ state = json.loads(f.read(1 << 16))
20
+ return state if isinstance(state, dict) else None
21
+ except (OSError, ValueError):
22
+ return None
23
+
24
+
25
+ state = read_state()
26
+ reached = bool(state) and state.get("reached") is True
27
+ evidence = ({"exit_reached": reached, "moves": state.get("moves"),
28
+ "reached_at": state.get("reached_at")} if state else {"state": "unreadable"})
29
+ print(json.dumps({"success": reached, "evidence": evidence}))
tasks/maze-t17/environment/maze/tree.json ADDED
@@ -0,0 +1,1569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "start": "R2552",
3
+ "exit": "R8076",
4
+ "budget": 210,
5
+ "doors": {
6
+ "R2552": [
7
+ "R2915",
8
+ "R3198",
9
+ "R8990"
10
+ ],
11
+ "R2915": [
12
+ "R9768",
13
+ "R2552"
14
+ ],
15
+ "R9768": [
16
+ "R2961",
17
+ "R2915"
18
+ ],
19
+ "R2961": [
20
+ "R9287",
21
+ "R9768"
22
+ ],
23
+ "R9287": [
24
+ "R2802",
25
+ "R2961"
26
+ ],
27
+ "R2802": [
28
+ "R9287",
29
+ "R3067"
30
+ ],
31
+ "R3067": [
32
+ "R2802",
33
+ "R1123"
34
+ ],
35
+ "R1123": [
36
+ "R3067",
37
+ "R4920"
38
+ ],
39
+ "R4920": [
40
+ "R2117",
41
+ "R1123"
42
+ ],
43
+ "R2117": [
44
+ "R8503",
45
+ "R4920"
46
+ ],
47
+ "R8503": [
48
+ "R1090",
49
+ "R2117",
50
+ "R3742",
51
+ "R7072"
52
+ ],
53
+ "R8990": [
54
+ "R1081",
55
+ "R2552"
56
+ ],
57
+ "R1081": [
58
+ "R8990",
59
+ "R1454"
60
+ ],
61
+ "R1454": [
62
+ "R9455",
63
+ "R1081"
64
+ ],
65
+ "R9455": [
66
+ "R1454",
67
+ "R3208"
68
+ ],
69
+ "R3208": [
70
+ "R5572",
71
+ "R9455"
72
+ ],
73
+ "R5572": [
74
+ "R9089",
75
+ "R3208"
76
+ ],
77
+ "R9089": [
78
+ "R5572",
79
+ "R2270"
80
+ ],
81
+ "R2270": [
82
+ "R9089",
83
+ "R6333"
84
+ ],
85
+ "R6333": [
86
+ "R2270",
87
+ "R3868"
88
+ ],
89
+ "R3868": [
90
+ "R6848",
91
+ "R2590",
92
+ "R6333",
93
+ "R7213"
94
+ ],
95
+ "R3198": [
96
+ "R2552",
97
+ "R5745"
98
+ ],
99
+ "R5745": [
100
+ "R3198",
101
+ "R5152"
102
+ ],
103
+ "R5152": [
104
+ "R5745",
105
+ "R8397"
106
+ ],
107
+ "R8397": [
108
+ "R5152",
109
+ "R9233"
110
+ ],
111
+ "R9233": [
112
+ "R4954",
113
+ "R8397"
114
+ ],
115
+ "R4954": [
116
+ "R9233",
117
+ "R3284"
118
+ ],
119
+ "R3284": [
120
+ "R3987",
121
+ "R4954"
122
+ ],
123
+ "R3987": [
124
+ "R3284",
125
+ "R2536"
126
+ ],
127
+ "R2536": [
128
+ "R5966",
129
+ "R3987"
130
+ ],
131
+ "R5966": [
132
+ "R2536",
133
+ "R9938",
134
+ "R7336",
135
+ "R3660"
136
+ ],
137
+ "R7072": [
138
+ "R9435",
139
+ "R8503"
140
+ ],
141
+ "R9435": [
142
+ "R7072",
143
+ "R6247"
144
+ ],
145
+ "R6247": [
146
+ "R9435",
147
+ "R1568"
148
+ ],
149
+ "R1568": [
150
+ "R1497",
151
+ "R6247"
152
+ ],
153
+ "R1497": [
154
+ "R1568",
155
+ "R1387"
156
+ ],
157
+ "R1387": [
158
+ "R1497",
159
+ "R8343"
160
+ ],
161
+ "R8343": [
162
+ "R6159",
163
+ "R1387"
164
+ ],
165
+ "R6159": [
166
+ "R4054",
167
+ "R8343"
168
+ ],
169
+ "R4054": [
170
+ "R1499",
171
+ "R6159"
172
+ ],
173
+ "R1499": [
174
+ "R1383",
175
+ "R4054",
176
+ "R5185",
177
+ "R1295"
178
+ ],
179
+ "R1090": [
180
+ "R2555",
181
+ "R8503"
182
+ ],
183
+ "R2555": [
184
+ "R1090",
185
+ "R5004"
186
+ ],
187
+ "R5004": [
188
+ "R2555",
189
+ "R1468"
190
+ ],
191
+ "R1468": [
192
+ "R5004",
193
+ "R5505"
194
+ ],
195
+ "R5505": [
196
+ "R2017",
197
+ "R1468"
198
+ ],
199
+ "R2017": [
200
+ "R5505",
201
+ "R7632"
202
+ ],
203
+ "R7632": [
204
+ "R2017",
205
+ "R6300"
206
+ ],
207
+ "R6300": [
208
+ "R7632",
209
+ "R8961"
210
+ ],
211
+ "R8961": [
212
+ "R6300",
213
+ "R5483"
214
+ ],
215
+ "R5483": [
216
+ "R9238",
217
+ "R5022",
218
+ "R7007",
219
+ "R8961"
220
+ ],
221
+ "R3742": [
222
+ "R4771",
223
+ "R8503"
224
+ ],
225
+ "R4771": [
226
+ "R3742",
227
+ "R2943"
228
+ ],
229
+ "R2943": [
230
+ "R4771",
231
+ "R9681"
232
+ ],
233
+ "R9681": [
234
+ "R6632",
235
+ "R2943"
236
+ ],
237
+ "R6632": [
238
+ "R6732",
239
+ "R9681"
240
+ ],
241
+ "R6732": [
242
+ "R6632",
243
+ "R3483"
244
+ ],
245
+ "R3483": [
246
+ "R6732",
247
+ "R8478"
248
+ ],
249
+ "R8478": [
250
+ "R5227",
251
+ "R3483"
252
+ ],
253
+ "R5227": [
254
+ "R8478",
255
+ "R5657"
256
+ ],
257
+ "R5657": [
258
+ "R5227",
259
+ "R3920",
260
+ "R6468",
261
+ "R7071"
262
+ ],
263
+ "R2590": [
264
+ "R3713",
265
+ "R3868"
266
+ ],
267
+ "R3713": [
268
+ "R2590",
269
+ "R1954"
270
+ ],
271
+ "R1954": [
272
+ "R5217",
273
+ "R3713"
274
+ ],
275
+ "R5217": [
276
+ "R4143",
277
+ "R1954"
278
+ ],
279
+ "R4143": [
280
+ "R5867",
281
+ "R5217"
282
+ ],
283
+ "R5867": [
284
+ "R6153",
285
+ "R4143"
286
+ ],
287
+ "R6153": [
288
+ "R5867",
289
+ "R1317"
290
+ ],
291
+ "R1317": [
292
+ "R6153",
293
+ "R2610"
294
+ ],
295
+ "R2610": [
296
+ "R5870",
297
+ "R1317"
298
+ ],
299
+ "R5870": [
300
+ "R2610",
301
+ "R9588",
302
+ "R6268",
303
+ "R3554"
304
+ ],
305
+ "R6848": [
306
+ "R1777",
307
+ "R3868"
308
+ ],
309
+ "R1777": [
310
+ "R6848",
311
+ "R8885"
312
+ ],
313
+ "R8885": [
314
+ "R2107",
315
+ "R1777"
316
+ ],
317
+ "R2107": [
318
+ "R8885",
319
+ "R1567"
320
+ ],
321
+ "R1567": [
322
+ "R2107",
323
+ "R7508"
324
+ ],
325
+ "R7508": [
326
+ "R5462",
327
+ "R1567"
328
+ ],
329
+ "R5462": [
330
+ "R7508",
331
+ "R3119"
332
+ ],
333
+ "R3119": [
334
+ "R5462",
335
+ "R9663"
336
+ ],
337
+ "R9663": [
338
+ "R5794",
339
+ "R3119"
340
+ ],
341
+ "R5794": [
342
+ "R5262",
343
+ "R8383",
344
+ "R9663",
345
+ "R6381"
346
+ ],
347
+ "R7213": [
348
+ "R3868",
349
+ "R2756"
350
+ ],
351
+ "R2756": [
352
+ "R3598",
353
+ "R7213"
354
+ ],
355
+ "R3598": [
356
+ "R4357",
357
+ "R2756"
358
+ ],
359
+ "R4357": [
360
+ "R3598",
361
+ "R1884"
362
+ ],
363
+ "R1884": [
364
+ "R6778",
365
+ "R4357"
366
+ ],
367
+ "R6778": [
368
+ "R1884",
369
+ "R6237"
370
+ ],
371
+ "R6237": [
372
+ "R9492",
373
+ "R6778"
374
+ ],
375
+ "R9492": [
376
+ "R4981",
377
+ "R6237"
378
+ ],
379
+ "R4981": [
380
+ "R6192",
381
+ "R9492"
382
+ ],
383
+ "R6192": [
384
+ "R4126",
385
+ "R4981",
386
+ "R9551",
387
+ "R4361"
388
+ ],
389
+ "R3660": [
390
+ "R4007",
391
+ "R5966"
392
+ ],
393
+ "R4007": [
394
+ "R3660",
395
+ "R2603"
396
+ ],
397
+ "R2603": [
398
+ "R4007",
399
+ "R7881"
400
+ ],
401
+ "R7881": [
402
+ "R2603",
403
+ "R7689"
404
+ ],
405
+ "R7689": [
406
+ "R7881",
407
+ "R5561"
408
+ ],
409
+ "R5561": [
410
+ "R7689",
411
+ "R7943"
412
+ ],
413
+ "R7943": [
414
+ "R5561",
415
+ "R5586"
416
+ ],
417
+ "R5586": [
418
+ "R7943",
419
+ "R3513"
420
+ ],
421
+ "R3513": [
422
+ "R5722",
423
+ "R5586"
424
+ ],
425
+ "R5722": [
426
+ "R2451",
427
+ "R9457",
428
+ "R3513",
429
+ "R8684"
430
+ ],
431
+ "R9938": [
432
+ "R8574",
433
+ "R5966"
434
+ ],
435
+ "R8574": [
436
+ "R9938",
437
+ "R2779"
438
+ ],
439
+ "R2779": [
440
+ "R8574",
441
+ "R6169"
442
+ ],
443
+ "R6169": [
444
+ "R2779",
445
+ "R7247"
446
+ ],
447
+ "R7247": [
448
+ "R2473",
449
+ "R6169"
450
+ ],
451
+ "R2473": [
452
+ "R7247",
453
+ "R6331"
454
+ ],
455
+ "R6331": [
456
+ "R1304",
457
+ "R2473"
458
+ ],
459
+ "R1304": [
460
+ "R6331",
461
+ "R6171"
462
+ ],
463
+ "R6171": [
464
+ "R1304",
465
+ "R7757"
466
+ ],
467
+ "R7757": [
468
+ "R6171",
469
+ "R7656",
470
+ "R9879",
471
+ "R4246"
472
+ ],
473
+ "R7336": [
474
+ "R5966",
475
+ "R4737"
476
+ ],
477
+ "R4737": [
478
+ "R1585",
479
+ "R7336"
480
+ ],
481
+ "R1585": [
482
+ "R4737",
483
+ "R6797"
484
+ ],
485
+ "R6797": [
486
+ "R8023",
487
+ "R1585"
488
+ ],
489
+ "R8023": [
490
+ "R6797",
491
+ "R6115"
492
+ ],
493
+ "R6115": [
494
+ "R1739",
495
+ "R8023"
496
+ ],
497
+ "R1739": [
498
+ "R7698",
499
+ "R6115"
500
+ ],
501
+ "R7698": [
502
+ "R1739",
503
+ "R5202"
504
+ ],
505
+ "R5202": [
506
+ "R7698",
507
+ "R9243"
508
+ ],
509
+ "R9243": [
510
+ "R9511",
511
+ "R5202",
512
+ "R3432",
513
+ "R3299"
514
+ ],
515
+ "R1295": [
516
+ "R1499",
517
+ "R9061"
518
+ ],
519
+ "R9061": [
520
+ "R1295",
521
+ "R5488"
522
+ ],
523
+ "R5488": [
524
+ "R9061",
525
+ "R4254"
526
+ ],
527
+ "R4254": [
528
+ "R5488",
529
+ "R1875"
530
+ ],
531
+ "R1875": [
532
+ "R5246",
533
+ "R4254"
534
+ ],
535
+ "R5246": [
536
+ "R5691",
537
+ "R1875"
538
+ ],
539
+ "R5691": [
540
+ "R2051",
541
+ "R5246"
542
+ ],
543
+ "R2051": [
544
+ "R5691",
545
+ "R8236"
546
+ ],
547
+ "R8236": [
548
+ "R4695",
549
+ "R2051"
550
+ ],
551
+ "R4695": [
552
+ "R8236"
553
+ ],
554
+ "R1383": [
555
+ "R1499",
556
+ "R1056"
557
+ ],
558
+ "R1056": [
559
+ "R1383",
560
+ "R5890"
561
+ ],
562
+ "R5890": [
563
+ "R8917",
564
+ "R1056"
565
+ ],
566
+ "R8917": [
567
+ "R2149",
568
+ "R5890"
569
+ ],
570
+ "R2149": [
571
+ "R8917",
572
+ "R8319"
573
+ ],
574
+ "R8319": [
575
+ "R2149",
576
+ "R9908"
577
+ ],
578
+ "R9908": [
579
+ "R8319",
580
+ "R9481"
581
+ ],
582
+ "R9481": [
583
+ "R9908",
584
+ "R4020"
585
+ ],
586
+ "R4020": [
587
+ "R9481",
588
+ "R2234"
589
+ ],
590
+ "R2234": [
591
+ "R4020"
592
+ ],
593
+ "R5185": [
594
+ "R1499",
595
+ "R3092"
596
+ ],
597
+ "R3092": [
598
+ "R1949",
599
+ "R5185"
600
+ ],
601
+ "R1949": [
602
+ "R3092",
603
+ "R1921"
604
+ ],
605
+ "R1921": [
606
+ "R6030",
607
+ "R1949"
608
+ ],
609
+ "R6030": [
610
+ "R2436",
611
+ "R1921"
612
+ ],
613
+ "R2436": [
614
+ "R6030",
615
+ "R2192"
616
+ ],
617
+ "R2192": [
618
+ "R2436",
619
+ "R1755"
620
+ ],
621
+ "R1755": [
622
+ "R2192",
623
+ "R4685"
624
+ ],
625
+ "R4685": [
626
+ "R5580",
627
+ "R1755"
628
+ ],
629
+ "R5580": [
630
+ "R4685"
631
+ ],
632
+ "R7007": [
633
+ "R5483",
634
+ "R9146"
635
+ ],
636
+ "R9146": [
637
+ "R7007",
638
+ "R2936"
639
+ ],
640
+ "R2936": [
641
+ "R8068",
642
+ "R9146"
643
+ ],
644
+ "R8068": [
645
+ "R9196",
646
+ "R2936"
647
+ ],
648
+ "R9196": [
649
+ "R8068",
650
+ "R3406"
651
+ ],
652
+ "R3406": [
653
+ "R9196",
654
+ "R1938"
655
+ ],
656
+ "R1938": [
657
+ "R5644",
658
+ "R3406"
659
+ ],
660
+ "R5644": [
661
+ "R1938",
662
+ "R7515"
663
+ ],
664
+ "R7515": [
665
+ "R7509",
666
+ "R5644"
667
+ ],
668
+ "R7509": [
669
+ "R7515"
670
+ ],
671
+ "R9238": [
672
+ "R5483",
673
+ "R4245"
674
+ ],
675
+ "R4245": [
676
+ "R9238",
677
+ "R3407"
678
+ ],
679
+ "R3407": [
680
+ "R4245",
681
+ "R9484"
682
+ ],
683
+ "R9484": [
684
+ "R3407",
685
+ "R6056"
686
+ ],
687
+ "R6056": [
688
+ "R9484",
689
+ "R1437"
690
+ ],
691
+ "R1437": [
692
+ "R6056",
693
+ "R1323"
694
+ ],
695
+ "R1323": [
696
+ "R1437",
697
+ "R6683"
698
+ ],
699
+ "R6683": [
700
+ "R1323",
701
+ "R8032"
702
+ ],
703
+ "R8032": [
704
+ "R6683",
705
+ "R3090"
706
+ ],
707
+ "R3090": [
708
+ "R8032"
709
+ ],
710
+ "R5022": [
711
+ "R6138",
712
+ "R5483"
713
+ ],
714
+ "R6138": [
715
+ "R9368",
716
+ "R5022"
717
+ ],
718
+ "R9368": [
719
+ "R6361",
720
+ "R6138"
721
+ ],
722
+ "R6361": [
723
+ "R9368",
724
+ "R8273"
725
+ ],
726
+ "R8273": [
727
+ "R4720",
728
+ "R6361"
729
+ ],
730
+ "R4720": [
731
+ "R7324",
732
+ "R8273"
733
+ ],
734
+ "R7324": [
735
+ "R5330",
736
+ "R4720"
737
+ ],
738
+ "R5330": [
739
+ "R7324",
740
+ "R9019"
741
+ ],
742
+ "R9019": [
743
+ "R5330",
744
+ "R4782"
745
+ ],
746
+ "R4782": [
747
+ "R9019"
748
+ ],
749
+ "R7071": [
750
+ "R7320",
751
+ "R5657"
752
+ ],
753
+ "R7320": [
754
+ "R9192",
755
+ "R7071"
756
+ ],
757
+ "R9192": [
758
+ "R7320",
759
+ "R6773"
760
+ ],
761
+ "R6773": [
762
+ "R9192",
763
+ "R5085"
764
+ ],
765
+ "R5085": [
766
+ "R1503",
767
+ "R6773"
768
+ ],
769
+ "R1503": [
770
+ "R9471",
771
+ "R5085"
772
+ ],
773
+ "R9471": [
774
+ "R6070",
775
+ "R1503"
776
+ ],
777
+ "R6070": [
778
+ "R9471",
779
+ "R4852"
780
+ ],
781
+ "R4852": [
782
+ "R8792",
783
+ "R6070"
784
+ ],
785
+ "R8792": [
786
+ "R4852"
787
+ ],
788
+ "R6468": [
789
+ "R5657",
790
+ "R1594"
791
+ ],
792
+ "R1594": [
793
+ "R5237",
794
+ "R6468"
795
+ ],
796
+ "R5237": [
797
+ "R3796",
798
+ "R1594"
799
+ ],
800
+ "R3796": [
801
+ "R4904",
802
+ "R5237"
803
+ ],
804
+ "R4904": [
805
+ "R3796",
806
+ "R8400"
807
+ ],
808
+ "R8400": [
809
+ "R4904",
810
+ "R4902"
811
+ ],
812
+ "R4902": [
813
+ "R2106",
814
+ "R8400"
815
+ ],
816
+ "R2106": [
817
+ "R4902",
818
+ "R6706"
819
+ ],
820
+ "R6706": [
821
+ "R4044",
822
+ "R2106"
823
+ ],
824
+ "R4044": [
825
+ "R6706"
826
+ ],
827
+ "R3920": [
828
+ "R5657",
829
+ "R9739"
830
+ ],
831
+ "R9739": [
832
+ "R4931",
833
+ "R3920"
834
+ ],
835
+ "R4931": [
836
+ "R8560",
837
+ "R9739"
838
+ ],
839
+ "R8560": [
840
+ "R4931",
841
+ "R8498"
842
+ ],
843
+ "R8498": [
844
+ "R8560",
845
+ "R8337"
846
+ ],
847
+ "R8337": [
848
+ "R4178",
849
+ "R8498"
850
+ ],
851
+ "R4178": [
852
+ "R3527",
853
+ "R8337"
854
+ ],
855
+ "R3527": [
856
+ "R8181",
857
+ "R4178"
858
+ ],
859
+ "R8181": [
860
+ "R3527",
861
+ "R7673"
862
+ ],
863
+ "R7673": [
864
+ "R8181"
865
+ ],
866
+ "R3554": [
867
+ "R5870",
868
+ "R8830"
869
+ ],
870
+ "R8830": [
871
+ "R7962",
872
+ "R3554"
873
+ ],
874
+ "R7962": [
875
+ "R8830",
876
+ "R2178"
877
+ ],
878
+ "R2178": [
879
+ "R7962",
880
+ "R6756"
881
+ ],
882
+ "R6756": [
883
+ "R6603",
884
+ "R2178"
885
+ ],
886
+ "R6603": [
887
+ "R8638",
888
+ "R6756"
889
+ ],
890
+ "R8638": [
891
+ "R6603",
892
+ "R4957"
893
+ ],
894
+ "R4957": [
895
+ "R8638",
896
+ "R5230"
897
+ ],
898
+ "R5230": [
899
+ "R4957",
900
+ "R6254"
901
+ ],
902
+ "R6254": [
903
+ "R5230"
904
+ ],
905
+ "R6268": [
906
+ "R2336",
907
+ "R5870"
908
+ ],
909
+ "R2336": [
910
+ "R6268",
911
+ "R1064"
912
+ ],
913
+ "R1064": [
914
+ "R2336",
915
+ "R3615"
916
+ ],
917
+ "R3615": [
918
+ "R4483",
919
+ "R1064"
920
+ ],
921
+ "R4483": [
922
+ "R7380",
923
+ "R3615"
924
+ ],
925
+ "R7380": [
926
+ "R9490",
927
+ "R4483"
928
+ ],
929
+ "R9490": [
930
+ "R2772",
931
+ "R7380"
932
+ ],
933
+ "R2772": [
934
+ "R2173",
935
+ "R9490"
936
+ ],
937
+ "R2173": [
938
+ "R2772",
939
+ "R1293"
940
+ ],
941
+ "R1293": [
942
+ "R2173"
943
+ ],
944
+ "R9588": [
945
+ "R7266",
946
+ "R5870"
947
+ ],
948
+ "R7266": [
949
+ "R9588",
950
+ "R5952"
951
+ ],
952
+ "R5952": [
953
+ "R9116",
954
+ "R7266"
955
+ ],
956
+ "R9116": [
957
+ "R3300",
958
+ "R5952"
959
+ ],
960
+ "R3300": [
961
+ "R1423",
962
+ "R9116"
963
+ ],
964
+ "R1423": [
965
+ "R4887",
966
+ "R3300"
967
+ ],
968
+ "R4887": [
969
+ "R2038",
970
+ "R1423"
971
+ ],
972
+ "R2038": [
973
+ "R2660",
974
+ "R4887"
975
+ ],
976
+ "R2660": [
977
+ "R2926",
978
+ "R2038"
979
+ ],
980
+ "R2926": [
981
+ "R2660"
982
+ ],
983
+ "R5262": [
984
+ "R8922",
985
+ "R5794"
986
+ ],
987
+ "R8922": [
988
+ "R2800",
989
+ "R5262"
990
+ ],
991
+ "R2800": [
992
+ "R8263",
993
+ "R8922"
994
+ ],
995
+ "R8263": [
996
+ "R9679",
997
+ "R2800"
998
+ ],
999
+ "R9679": [
1000
+ "R8263",
1001
+ "R4718"
1002
+ ],
1003
+ "R4718": [
1004
+ "R9679",
1005
+ "R9548"
1006
+ ],
1007
+ "R9548": [
1008
+ "R4718",
1009
+ "R2873"
1010
+ ],
1011
+ "R2873": [
1012
+ "R1660",
1013
+ "R9548"
1014
+ ],
1015
+ "R1660": [
1016
+ "R2873",
1017
+ "R3200"
1018
+ ],
1019
+ "R3200": [
1020
+ "R1660"
1021
+ ],
1022
+ "R8383": [
1023
+ "R5794",
1024
+ "R8073"
1025
+ ],
1026
+ "R8073": [
1027
+ "R8383",
1028
+ "R7115"
1029
+ ],
1030
+ "R7115": [
1031
+ "R5216",
1032
+ "R8073"
1033
+ ],
1034
+ "R5216": [
1035
+ "R7115",
1036
+ "R9299"
1037
+ ],
1038
+ "R9299": [
1039
+ "R5216",
1040
+ "R1041"
1041
+ ],
1042
+ "R1041": [
1043
+ "R9299",
1044
+ "R8092"
1045
+ ],
1046
+ "R8092": [
1047
+ "R1041",
1048
+ "R4960"
1049
+ ],
1050
+ "R4960": [
1051
+ "R7241",
1052
+ "R8092"
1053
+ ],
1054
+ "R7241": [
1055
+ "R4960",
1056
+ "R8732"
1057
+ ],
1058
+ "R8732": [
1059
+ "R7241"
1060
+ ],
1061
+ "R6381": [
1062
+ "R6177",
1063
+ "R5794"
1064
+ ],
1065
+ "R6177": [
1066
+ "R6654",
1067
+ "R6381"
1068
+ ],
1069
+ "R6654": [
1070
+ "R6177",
1071
+ "R4370"
1072
+ ],
1073
+ "R4370": [
1074
+ "R6654",
1075
+ "R2732"
1076
+ ],
1077
+ "R2732": [
1078
+ "R5140",
1079
+ "R4370"
1080
+ ],
1081
+ "R5140": [
1082
+ "R2732",
1083
+ "R8929"
1084
+ ],
1085
+ "R8929": [
1086
+ "R5140",
1087
+ "R7859"
1088
+ ],
1089
+ "R7859": [
1090
+ "R6845",
1091
+ "R8929"
1092
+ ],
1093
+ "R6845": [
1094
+ "R7859",
1095
+ "R2049"
1096
+ ],
1097
+ "R2049": [
1098
+ "R6845"
1099
+ ],
1100
+ "R9551": [
1101
+ "R6192",
1102
+ "R5255"
1103
+ ],
1104
+ "R5255": [
1105
+ "R9551",
1106
+ "R8865"
1107
+ ],
1108
+ "R8865": [
1109
+ "R4941",
1110
+ "R5255"
1111
+ ],
1112
+ "R4941": [
1113
+ "R2097",
1114
+ "R8865"
1115
+ ],
1116
+ "R2097": [
1117
+ "R2074",
1118
+ "R4941"
1119
+ ],
1120
+ "R2074": [
1121
+ "R2097",
1122
+ "R1484"
1123
+ ],
1124
+ "R1484": [
1125
+ "R2074",
1126
+ "R9157"
1127
+ ],
1128
+ "R9157": [
1129
+ "R1484",
1130
+ "R6940"
1131
+ ],
1132
+ "R6940": [
1133
+ "R5732",
1134
+ "R9157"
1135
+ ],
1136
+ "R5732": [
1137
+ "R6940"
1138
+ ],
1139
+ "R4361": [
1140
+ "R6192",
1141
+ "R2372"
1142
+ ],
1143
+ "R2372": [
1144
+ "R4361",
1145
+ "R3396"
1146
+ ],
1147
+ "R3396": [
1148
+ "R2372",
1149
+ "R8002"
1150
+ ],
1151
+ "R8002": [
1152
+ "R3396",
1153
+ "R8980"
1154
+ ],
1155
+ "R8980": [
1156
+ "R8002",
1157
+ "R9830"
1158
+ ],
1159
+ "R9830": [
1160
+ "R8980",
1161
+ "R9569"
1162
+ ],
1163
+ "R9569": [
1164
+ "R9830",
1165
+ "R3453"
1166
+ ],
1167
+ "R3453": [
1168
+ "R9569",
1169
+ "R5699"
1170
+ ],
1171
+ "R5699": [
1172
+ "R3453",
1173
+ "R1838"
1174
+ ],
1175
+ "R1838": [
1176
+ "R5699"
1177
+ ],
1178
+ "R4126": [
1179
+ "R6192",
1180
+ "R5337"
1181
+ ],
1182
+ "R5337": [
1183
+ "R5430",
1184
+ "R4126"
1185
+ ],
1186
+ "R5430": [
1187
+ "R5337",
1188
+ "R1482"
1189
+ ],
1190
+ "R1482": [
1191
+ "R8316",
1192
+ "R5430"
1193
+ ],
1194
+ "R8316": [
1195
+ "R4861",
1196
+ "R1482"
1197
+ ],
1198
+ "R4861": [
1199
+ "R6777",
1200
+ "R8316"
1201
+ ],
1202
+ "R6777": [
1203
+ "R3266",
1204
+ "R4861"
1205
+ ],
1206
+ "R3266": [
1207
+ "R6777",
1208
+ "R6225"
1209
+ ],
1210
+ "R6225": [
1211
+ "R3191",
1212
+ "R3266"
1213
+ ],
1214
+ "R3191": [
1215
+ "R6225"
1216
+ ],
1217
+ "R9457": [
1218
+ "R1635",
1219
+ "R5722"
1220
+ ],
1221
+ "R1635": [
1222
+ "R4916",
1223
+ "R9457"
1224
+ ],
1225
+ "R4916": [
1226
+ "R1635",
1227
+ "R9652"
1228
+ ],
1229
+ "R9652": [
1230
+ "R4916",
1231
+ "R1709"
1232
+ ],
1233
+ "R1709": [
1234
+ "R4873",
1235
+ "R9652"
1236
+ ],
1237
+ "R4873": [
1238
+ "R3484",
1239
+ "R1709"
1240
+ ],
1241
+ "R3484": [
1242
+ "R4873",
1243
+ "R1368"
1244
+ ],
1245
+ "R1368": [
1246
+ "R8711",
1247
+ "R3484"
1248
+ ],
1249
+ "R8711": [
1250
+ "R3282",
1251
+ "R1368"
1252
+ ],
1253
+ "R3282": [
1254
+ "R8711"
1255
+ ],
1256
+ "R2451": [
1257
+ "R5722",
1258
+ "R3791"
1259
+ ],
1260
+ "R3791": [
1261
+ "R2451",
1262
+ "R6262"
1263
+ ],
1264
+ "R6262": [
1265
+ "R3791",
1266
+ "R6792"
1267
+ ],
1268
+ "R6792": [
1269
+ "R6262",
1270
+ "R2589"
1271
+ ],
1272
+ "R2589": [
1273
+ "R8840",
1274
+ "R6792"
1275
+ ],
1276
+ "R8840": [
1277
+ "R1615",
1278
+ "R2589"
1279
+ ],
1280
+ "R1615": [
1281
+ "R9256",
1282
+ "R8840"
1283
+ ],
1284
+ "R9256": [
1285
+ "R4892",
1286
+ "R1615"
1287
+ ],
1288
+ "R4892": [
1289
+ "R7787",
1290
+ "R9256"
1291
+ ],
1292
+ "R7787": [
1293
+ "R4892"
1294
+ ],
1295
+ "R8684": [
1296
+ "R5722",
1297
+ "R8939"
1298
+ ],
1299
+ "R8939": [
1300
+ "R8684",
1301
+ "R2339"
1302
+ ],
1303
+ "R2339": [
1304
+ "R5214",
1305
+ "R8939"
1306
+ ],
1307
+ "R5214": [
1308
+ "R2334",
1309
+ "R2339"
1310
+ ],
1311
+ "R2334": [
1312
+ "R5214",
1313
+ "R3942"
1314
+ ],
1315
+ "R3942": [
1316
+ "R2793",
1317
+ "R2334"
1318
+ ],
1319
+ "R2793": [
1320
+ "R7074",
1321
+ "R3942"
1322
+ ],
1323
+ "R7074": [
1324
+ "R1833",
1325
+ "R2793"
1326
+ ],
1327
+ "R1833": [
1328
+ "R3512",
1329
+ "R7074"
1330
+ ],
1331
+ "R3512": [
1332
+ "R1833"
1333
+ ],
1334
+ "R7656": [
1335
+ "R7757",
1336
+ "R9292"
1337
+ ],
1338
+ "R9292": [
1339
+ "R7656",
1340
+ "R1725"
1341
+ ],
1342
+ "R1725": [
1343
+ "R9292",
1344
+ "R7904"
1345
+ ],
1346
+ "R7904": [
1347
+ "R1725",
1348
+ "R8907"
1349
+ ],
1350
+ "R8907": [
1351
+ "R7904",
1352
+ "R2322"
1353
+ ],
1354
+ "R2322": [
1355
+ "R8907",
1356
+ "R3967"
1357
+ ],
1358
+ "R3967": [
1359
+ "R2322",
1360
+ "R5933"
1361
+ ],
1362
+ "R5933": [
1363
+ "R3967",
1364
+ "R2265"
1365
+ ],
1366
+ "R2265": [
1367
+ "R5933",
1368
+ "R9188"
1369
+ ],
1370
+ "R9188": [
1371
+ "R2265"
1372
+ ],
1373
+ "R4246": [
1374
+ "R8714",
1375
+ "R7757"
1376
+ ],
1377
+ "R8714": [
1378
+ "R5281",
1379
+ "R4246"
1380
+ ],
1381
+ "R5281": [
1382
+ "R8714",
1383
+ "R8253"
1384
+ ],
1385
+ "R8253": [
1386
+ "R4719",
1387
+ "R5281"
1388
+ ],
1389
+ "R4719": [
1390
+ "R8253",
1391
+ "R6332"
1392
+ ],
1393
+ "R6332": [
1394
+ "R4128",
1395
+ "R4719"
1396
+ ],
1397
+ "R4128": [
1398
+ "R9172",
1399
+ "R6332"
1400
+ ],
1401
+ "R9172": [
1402
+ "R6326",
1403
+ "R4128"
1404
+ ],
1405
+ "R6326": [
1406
+ "R9172",
1407
+ "R5868"
1408
+ ],
1409
+ "R5868": [
1410
+ "R6326"
1411
+ ],
1412
+ "R9879": [
1413
+ "R7150",
1414
+ "R7757"
1415
+ ],
1416
+ "R7150": [
1417
+ "R1131",
1418
+ "R9879"
1419
+ ],
1420
+ "R1131": [
1421
+ "R5942",
1422
+ "R7150"
1423
+ ],
1424
+ "R5942": [
1425
+ "R3866",
1426
+ "R1131"
1427
+ ],
1428
+ "R3866": [
1429
+ "R5942",
1430
+ "R6716"
1431
+ ],
1432
+ "R6716": [
1433
+ "R9203",
1434
+ "R3866"
1435
+ ],
1436
+ "R9203": [
1437
+ "R2832",
1438
+ "R6716"
1439
+ ],
1440
+ "R2832": [
1441
+ "R6128",
1442
+ "R9203"
1443
+ ],
1444
+ "R6128": [
1445
+ "R2832",
1446
+ "R6864"
1447
+ ],
1448
+ "R6864": [
1449
+ "R6128"
1450
+ ],
1451
+ "R9511": [
1452
+ "R4224",
1453
+ "R9243"
1454
+ ],
1455
+ "R4224": [
1456
+ "R9511",
1457
+ "R6599"
1458
+ ],
1459
+ "R6599": [
1460
+ "R4059",
1461
+ "R4224"
1462
+ ],
1463
+ "R4059": [
1464
+ "R9312",
1465
+ "R6599"
1466
+ ],
1467
+ "R9312": [
1468
+ "R9235",
1469
+ "R4059"
1470
+ ],
1471
+ "R9235": [
1472
+ "R9666",
1473
+ "R9312"
1474
+ ],
1475
+ "R9666": [
1476
+ "R2846",
1477
+ "R9235"
1478
+ ],
1479
+ "R2846": [
1480
+ "R9666",
1481
+ "R5671"
1482
+ ],
1483
+ "R5671": [
1484
+ "R2846",
1485
+ "R5445"
1486
+ ],
1487
+ "R5445": [
1488
+ "R5671"
1489
+ ],
1490
+ "R3432": [
1491
+ "R9243",
1492
+ "R3612"
1493
+ ],
1494
+ "R3612": [
1495
+ "R9947",
1496
+ "R3432"
1497
+ ],
1498
+ "R9947": [
1499
+ "R4598",
1500
+ "R3612"
1501
+ ],
1502
+ "R4598": [
1503
+ "R6483",
1504
+ "R9947"
1505
+ ],
1506
+ "R6483": [
1507
+ "R4598",
1508
+ "R9815"
1509
+ ],
1510
+ "R9815": [
1511
+ "R6483",
1512
+ "R7269"
1513
+ ],
1514
+ "R7269": [
1515
+ "R9815",
1516
+ "R2951"
1517
+ ],
1518
+ "R2951": [
1519
+ "R1655",
1520
+ "R7269"
1521
+ ],
1522
+ "R1655": [
1523
+ "R3330",
1524
+ "R2951"
1525
+ ],
1526
+ "R3330": [
1527
+ "R1655"
1528
+ ],
1529
+ "R3299": [
1530
+ "R1747",
1531
+ "R9243"
1532
+ ],
1533
+ "R1747": [
1534
+ "R2157",
1535
+ "R3299"
1536
+ ],
1537
+ "R2157": [
1538
+ "R5215",
1539
+ "R1747"
1540
+ ],
1541
+ "R5215": [
1542
+ "R2157",
1543
+ "R1230"
1544
+ ],
1545
+ "R1230": [
1546
+ "R5215",
1547
+ "R2719"
1548
+ ],
1549
+ "R2719": [
1550
+ "R7041",
1551
+ "R1230"
1552
+ ],
1553
+ "R7041": [
1554
+ "R2719",
1555
+ "R7404"
1556
+ ],
1557
+ "R7404": [
1558
+ "R7854",
1559
+ "R7041"
1560
+ ],
1561
+ "R7854": [
1562
+ "R7404",
1563
+ "R8076"
1564
+ ],
1565
+ "R8076": [
1566
+ "R7854"
1567
+ ]
1568
+ }
1569
+ }
tasks/maze-t17/instruction.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Find the exit of the maze
2
+
3
+ You are exploring a maze of rooms connected by doors to find the exit. The maze is a tree: from
4
+ the start room, corridors of rooms lead to junctions where the way divides, and the exit is one
5
+ of the dead ends at the far ends of the corridors. Every agent on your team starts in the same
6
+ room, in its own copy of the same maze: the same rooms, with the same doors listed in the same
7
+ order. Your position is your own: moving never moves a teammate.
8
+
9
+ Explore with the `maze` command in your shell:
10
+
11
+ - `maze look` describes your current room again, without moving;
12
+ - `maze move ROOM` walks through a door of your current room into the named adjacent room.
13
+
14
+ Each prints JSON: the room you are in (`room`), its doors (`doors`), whether it is the exit
15
+ (`exit`), the room you arrived from (`arrived_from`) and how many moves you have left
16
+ (`moves_left`), with a `notice` at a dead end. Only the doors listed for your current room are
17
+ reachable in one move; to go back, move to the room you arrived from. Room names carry no
18
+ information about where the exit is.
19
+
20
+ You can make at most 210 moves. Looking is free, and a refused move (into a room that is not
21
+ one of your doors) costs nothing.
22
+
23
+ Reaching the exit solves the task for the whole team and ends the run. If you have teammates
24
+ (your instructions name them), they are searching the same maze: what one of you learns about it
25
+ holds for everyone. Use the message board to share what you find and to read what they find.
26
+ Once you reach the exit, post that you have, then stop.
tasks/maze-t17/solution/solve.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: walk the shortest path to the exit with `maze move`, from its own copy of the path.
3
+ set -e
4
+ for room in R3198 R5745 R5152 R8397 R9233 R4954 R3284 R3987 R2536 R5966 R7336 R4737 R1585 R6797 R8023 R6115 R1739 R7698 R5202 R9243 R3299 R1747 R2157 R5215 R1230 R2719 R7041 R7404 R7854 R8076; do
5
+ maze move "$room" > /dev/null
6
+ done
7
+ maze look
tasks/maze-t17/task.toml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ # The maze service's own record of the walk, exported by its collect hook below once the agent
4
+ # is done: the grader's only input besides tests/expected.json.
5
+ [[artifacts]]
6
+ source = "/evidence/final.json"
7
+ service = "maze"
8
+
9
+ [[artifacts]]
10
+ source = "/evidence/moves.jsonl"
11
+ service = "maze"
12
+
13
+ [task]
14
+ name = "HuggingFaceSwarms/maze-t17"
15
+ version = "0.1.0"
16
+ description = "s3-maze: agents search their own copies of one maze; the first one out wins."
17
+ keywords = ["multi-agent", "message-board", "s3", "maze", "exploration"]
18
+
19
+ [metadata]
20
+ tree = 17
21
+ seed = 115
22
+ branching = 3
23
+ corridor = 10
24
+ depth = 3
25
+ rooms = 391
26
+ dead_ends = 27
27
+ shortest_path = 30
28
+ full_search = 780
29
+ move_budget = 210
30
+
31
+ [agent]
32
+ timeout_sec = 3600
33
+
34
+ [environment]
35
+ build_timeout_sec = 900
36
+ cpus = 1
37
+ memory_mb = 1024
38
+
39
+ [verifier]
40
+ # The grader runs in its own container (tests/Dockerfile) after the agent's has stopped, on
41
+ # what the maze service exported: nothing the agent's container holds reaches it.
42
+ environment_mode = "separate"
43
+ timeout_sec = 120
44
+
45
+ [[verifier.collect]]
46
+ service = "maze"
47
+ command = "python3 -I -S /app/export.py"
48
+ timeout_sec = 30
tasks/maze-t17/tests/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The verifier's own container (environment_mode = "separate"): the grader and the task's
3
+ # answer, never in the agent's container. Harbor adds /evidence from the maze service.
4
+ COPY test.sh grade.py expected.json /tests/
5
+ RUN chmod 755 /tests/test.sh
tasks/maze-t17/tests/expected.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "start": "R2552",
3
+ "exit": "R8076",
4
+ "budget": 210,
5
+ "tree_sha256": "37cae8d173d6734baf80b9bd1593cd359ee6fa7b8588a8bb3bfb961a489c49bc"
6
+ }
tasks/maze-t17/tests/grade.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """s3-maze's grader: reward 1 if the agent's walk reached the exit, from the maze service's own
2
+ record. Run by test.sh as `python3 -I -S grade.py`, in a fresh verifier container (the task's
3
+ `environment_mode = "separate"`), after the agent's container has stopped.
4
+
5
+ It reads only /evidence/final.json and /evidence/moves.jsonl, which the maze service exported
6
+ (export.py, Harbor's collect hook) and Harbor carried over, and expected.json (this folder,
7
+ never in the agent's container). Reward 1 needs all of: the export is the service's
8
+ (`exported_by`), for this task's tree (its sha256), start and move budget; the service says the
9
+ exit was reached and the walk ends there; and the move log's accepted moves are one unbroken
10
+ walk from the start to the exit, within the budget, as many as the service counted. Anything
11
+ else, a missing, unreadable or malformed file included, scores 0.
12
+
13
+ Each file counts only as a regular file of its own at exactly its path: no link anywhere on the
14
+ path is followed, and a FIFO cannot block the read. The reward file is written 0 first and
15
+ never through a link. Copies of both files stay in the verifier's folder, for the metrics.
16
+ EVIDENCE_DIR, EXPECTED and VERIFIER_DIR override the paths (no links in them), to test locally.
17
+ """
18
+
19
+ import json
20
+ import os
21
+ import stat
22
+
23
+ EVIDENCE = os.environ.get("EVIDENCE_DIR", "/evidence")
24
+ EXPECTED = os.environ.get("EXPECTED", "/tests/expected.json")
25
+ VERIFIER = os.environ.get("VERIFIER_DIR", "/logs/verifier")
26
+ LIMIT = 16 << 20 # bytes
27
+
28
+
29
+ def read_own(path: str) -> bytes:
30
+ """The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ without following a link, and so is the file (a FIFO cannot block it); one link only."""
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(name: str, data: bytes) -> None:
53
+ path = os.path.join(VERIFIER, name)
54
+ try:
55
+ os.unlink(path) # never written through a link
56
+ except FileNotFoundError:
57
+ pass
58
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644)
59
+ with os.fdopen(fd, "wb") as stream:
60
+ stream.write(data)
61
+
62
+
63
+ def reject_constant(name):
64
+ raise ValueError(f"{name} is not JSON")
65
+
66
+
67
+ def parse(data: bytes):
68
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
69
+
70
+
71
+ def walk_reaches_exit(final: dict, records: list, expected: dict) -> bool:
72
+ room, moves = expected["start"], 0
73
+ for record in records:
74
+ if not isinstance(record, dict) or record.get("ok") not in (True, False):
75
+ return False
76
+ if record["ok"] is True:
77
+ if record.get("from") != room or not isinstance(record.get("to"), str):
78
+ return False
79
+ room, moves = record["to"], moves + 1
80
+ return (room == expected["exit"] and moves == final.get("moves")
81
+ and 0 < moves <= expected["budget"])
82
+
83
+
84
+ def grade() -> bool:
85
+ expected = parse(read_own(EXPECTED))
86
+ final_data = read_own(os.path.join(EVIDENCE, "final.json"))
87
+ moves_data = read_own(os.path.join(EVIDENCE, "moves.jsonl"))
88
+ write_new("final.json", final_data)
89
+ write_new("moves.jsonl", moves_data)
90
+ final = parse(final_data)
91
+ records = [parse(line) for line in moves_data.splitlines() if line.strip()]
92
+ return (
93
+ isinstance(final, dict)
94
+ and final.get("exported_by") == "maze"
95
+ and final.get("tree_sha256") == expected["tree_sha256"]
96
+ and final.get("start") == expected["start"]
97
+ and final.get("budget") == expected["budget"]
98
+ and final.get("reached") is True
99
+ and final.get("room") == expected["exit"]
100
+ and walk_reaches_exit(final, records, expected)
101
+ )
102
+
103
+
104
+ os.makedirs(VERIFIER, exist_ok=True)
105
+ for name in ("reward.txt", "reward.json"):
106
+ try:
107
+ os.unlink(os.path.join(VERIFIER, name))
108
+ except FileNotFoundError:
109
+ pass
110
+ write_new("reward.txt", b"0")
111
+ try:
112
+ valid = grade()
113
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, a wrong shape
114
+ valid = False
115
+ if valid:
116
+ write_new("reward.txt", b"1")
117
+ print("reward:", 1 if valid else 0)
tasks/maze-t17/tests/test.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # s3-maze's verifier, in a fresh container built from this folder (environment_mode =
3
+ # "separate"): reward 1 if the maze service's own record shows the agent's walk reached the exit
4
+ # (grade.py has the rules). Reward 0 is written before anything is checked, so a crash of the
5
+ # check also scores 0. Python runs isolated (-I -S): no module from the working directory,
6
+ # PYTHON* variables or site hooks can change what it imports. Besides bash, python3 is the only
7
+ # command this script runs.
8
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
9
+ export EXPECTED=${EXPECTED:-$here/expected.json}
10
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
11
+ [ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
12
+ python3 -I -S "$here/grade.py" || true
tasks/maze-t18/environment/agent/Dockerfile ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The agent's container: only the `maze` command, which talks to the maze service. The tree and
3
+ # the exit are never here.
4
+ RUN apt-get update && apt-get install -y --no-install-recommends bash curl ca-certificates \
5
+ && rm -rf /var/lib/apt/lists/*
6
+ COPY maze /usr/local/bin/maze
7
+ RUN chmod 755 /usr/local/bin/maze
8
+ WORKDIR /app
tasks/maze-t18/environment/agent/maze ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """maze look | maze move ROOM: explore the maze through its service (standard library only).
3
+
4
+ Prints the service's JSON for your current room: `room`, its `doors`, whether it is the `exit`,
5
+ the room you `arrived_from` and your `moves_left` (a dead end adds a `notice`). A refused move
6
+ adds an `error` and exits 1; the service unreachable exits 2.
7
+ """
8
+
9
+ import json
10
+ import os
11
+ import sys
12
+ import time
13
+ import urllib.error
14
+ import urllib.request
15
+
16
+ URL = os.environ.get("MAZE_URL", "http://maze:8000").rstrip("/")
17
+ USAGE = "usage: maze look | maze move ROOM"
18
+
19
+
20
+ def call(request: urllib.request.Request) -> tuple[int, dict]:
21
+ deadline = time.monotonic() + 30 # the service may still be starting
22
+ while True:
23
+ try:
24
+ with urllib.request.urlopen(request, timeout=30) as response:
25
+ return response.status, json.load(response)
26
+ except urllib.error.HTTPError as e:
27
+ try:
28
+ return e.code, json.load(e)
29
+ except ValueError:
30
+ return e.code, {"error": f"HTTP {e.code} from the maze service"}
31
+ except (urllib.error.URLError, ConnectionError, TimeoutError) as e:
32
+ if time.monotonic() > deadline:
33
+ return 0, {"error": f"the maze service is unreachable: {e}"}
34
+ time.sleep(1)
35
+
36
+
37
+ def main(argv: list[str]) -> int:
38
+ if argv == ["look"]:
39
+ request = urllib.request.Request(URL + "/look")
40
+ elif len(argv) == 2 and argv[0] == "move":
41
+ request = urllib.request.Request(
42
+ URL + "/move", data=json.dumps({"room": argv[1]}).encode(), method="POST",
43
+ headers={"Content-Type": "application/json"})
44
+ else:
45
+ print(USAGE, file=sys.stderr)
46
+ return 2
47
+ status, body = call(request)
48
+ print(json.dumps(body))
49
+ return 0 if status == 200 else 1 if status in (400, 409) else 2
50
+
51
+
52
+ if __name__ == "__main__":
53
+ sys.exit(main(sys.argv[1:]))
tasks/maze-t18/environment/docker-compose.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # maze-t18: the agent's container (main) and its own maze service. The service holds
2
+ # the tree and answers only `maze look` and `maze move ROOM`, on a network only main reaches.
3
+ services:
4
+ main:
5
+ image: s3-maze-agent:7ecf229faaac
6
+ build:
7
+ context: ./agent
8
+ networks: [default, maze]
9
+ security_opt: [no-new-privileges:true]
10
+ depends_on: [maze]
11
+ maze:
12
+ image: s3-maze-service:maze-t18-6d66998d34f6
13
+ build:
14
+ context: ./maze
15
+ networks: [maze]
16
+ environment:
17
+ MAZE_AGENT: ${COMPOSE_PROJECT_NAME:-} # the Trial, for the move log
18
+ cap_drop: [ALL]
19
+ security_opt: [no-new-privileges:true]
20
+ pids_limit: 64
21
+ mem_limit: 256m
22
+ networks:
23
+ default: {} # main's way out (Flock replaces it with the agent's own network)
24
+ maze:
25
+ internal: true
tasks/maze-t18/environment/maze/Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The maze service: the tree (private, never in the agent's container), the walk's state and
3
+ # move log, the success check and the collect hook. Standard library only.
4
+ COPY engine.py service.py success.py export.py /app/
5
+ COPY tree.json /private/tree.json
6
+ RUN mkdir -p /var/lib/maze /evidence && chmod 0700 /private /var/lib/maze
7
+ ENV MAZE_TREE=/private/tree.json MAZE_STATE_DIR=/var/lib/maze
8
+ WORKDIR /app
9
+ CMD ["python3", "-I", "-S", "-B", "/app/service.py"]
tasks/maze-t18/environment/maze/engine.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The maze: one agent's walk through its own copy of a tree of rooms (s3-maze).
2
+
3
+ The service (service.py) holds one Walk per Trial; budget.py simulates searches on this same
4
+ code. Python 3.10+, standard library only.
5
+
6
+ A tree is `{"start", "exit", "budget", "doors": {room: [neighbour, ...]}}`: each room lists its
7
+ doors in the order fixed when the tree was generated, the same for every agent and every visit.
8
+ """
9
+
10
+ import json
11
+
12
+ DEAD_END = "Dead end: its only door leads back the way you came."
13
+
14
+
15
+ class Maze:
16
+ def __init__(self, tree: dict):
17
+ self.start = tree["start"]
18
+ self.exit = tree["exit"]
19
+ self.budget = int(tree["budget"])
20
+ self.doors = {room: list(doors) for room, doors in tree["doors"].items()}
21
+
22
+ @classmethod
23
+ def load(cls, path: str) -> "Maze":
24
+ with open(path, encoding="utf-8") as f:
25
+ return cls(json.load(f))
26
+
27
+
28
+ class Walk:
29
+ """One agent's position and its accepted moves. Looking is free; a refused move costs
30
+ nothing; at most `budget` moves are accepted, and none once the exit is reached."""
31
+
32
+ def __init__(self, maze: Maze, room: str | None = None, arrived_from: str | None = None,
33
+ moves: int = 0, refused: int = 0):
34
+ self.maze = maze
35
+ self.room = room or maze.start
36
+ self.arrived_from = arrived_from
37
+ self.moves = moves
38
+ self.refused = refused
39
+
40
+ @property
41
+ def reached(self) -> bool:
42
+ return self.room == self.maze.exit
43
+
44
+ def look(self) -> dict:
45
+ """The paper's observation (s3, Appendix H), plus the moves left."""
46
+ doors = self.maze.doors[self.room]
47
+ out = {"room": self.room, "doors": list(doors), "exit": self.reached,
48
+ "arrived_from": self.arrived_from, "moves_left": self.maze.budget - self.moves}
49
+ if len(doors) == 1 and not self.reached:
50
+ out["notice"] = DEAD_END
51
+ return out
52
+
53
+ def refusal(self, room) -> str | None:
54
+ """Why a move into `room` is refused (a short code), or None."""
55
+ if self.reached:
56
+ return "at_exit"
57
+ if self.moves >= self.maze.budget:
58
+ return "no_moves_left"
59
+ if not isinstance(room, str) or room not in self.maze.doors[self.room]:
60
+ return "not_a_door"
61
+ return None
62
+
63
+ def move(self, room) -> tuple[dict, str | None]:
64
+ """(the observation after moving into `room`, None), or (an error and the current
65
+ observation, the refusal's code)."""
66
+ why = self.refusal(room)
67
+ if why is not None:
68
+ self.refused += 1
69
+ return {"error": MESSAGES[why].format(room=_short(room), here=self.room,
70
+ budget=self.maze.budget), **self.look()}, why
71
+ self.arrived_from, self.room = self.room, room
72
+ self.moves += 1
73
+ return self.look(), None
74
+
75
+ def state(self) -> dict:
76
+ return {"room": self.room, "arrived_from": self.arrived_from, "moves": self.moves,
77
+ "refused": self.refused, "reached": self.reached}
78
+
79
+ @classmethod
80
+ def from_state(cls, maze: Maze, state: dict) -> "Walk":
81
+ return cls(maze, state["room"], state["arrived_from"], state["moves"], state["refused"])
82
+
83
+
84
+ MESSAGES = {
85
+ "at_exit": "You are at the exit: the task is solved.",
86
+ "no_moves_left": "No moves left: your budget of {budget} moves is used up.",
87
+ "not_a_door": "{room} is not a door of {here}: move into one of the doors listed for it.",
88
+ }
89
+
90
+
91
+ def _short(value) -> str:
92
+ text = value if isinstance(value, str) else json.dumps(value)
93
+ return text if len(text) <= 40 else text[:40] + "..."
tasks/maze-t18/environment/maze/export.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Harbor's [[verifier.collect]] hook for s3-maze, run in this maze service once the agent is done
2
+ (its container already stopped): `python3 -I -S /app/export.py`.
3
+
4
+ Writes the service's own record of the walk to /evidence, which Harbor collects as artifacts
5
+ and hands to the grader in a fresh container: `final.json` (the state file, marked as exported
6
+ here) and `moves.jsonl` (the move log). Nothing in /evidence comes from the agent's container.
7
+ """
8
+
9
+ import json
10
+ import os
11
+
12
+ STATE_DIR = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze")
13
+ EVIDENCE = os.environ.get("MAZE_EVIDENCE_DIR", "/evidence")
14
+ LIMIT = 16 << 20
15
+
16
+
17
+ def read(name: str) -> bytes:
18
+ fd = os.open(os.path.join(STATE_DIR, name), os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
19
+ with os.fdopen(fd, "rb") as f:
20
+ return f.read(LIMIT)
21
+
22
+
23
+ def write(name: str, data: bytes) -> None:
24
+ path = os.path.join(EVIDENCE, name)
25
+ temp = path + ".tmp"
26
+ fd = os.open(temp, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
27
+ with os.fdopen(fd, "wb") as f:
28
+ f.write(data)
29
+ os.replace(temp, path)
30
+
31
+
32
+ os.makedirs(EVIDENCE, exist_ok=True)
33
+ state = json.loads(read("state.json"))
34
+ try:
35
+ moves = read("moves.jsonl")
36
+ except FileNotFoundError: # no move was ever asked for
37
+ moves = b""
38
+ write("moves.jsonl", moves)
39
+ write("final.json", json.dumps({**state, "exported_by": "maze"}).encode())
40
+ print("exported", state.get("moves"), "moves; exit reached:", state.get("reached"))
tasks/maze-t18/environment/maze/service.py ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The maze service: one agent's own copy of the maze, behind `maze look` and `maze move ROOM`.
2
+
3
+ Two routes answer, `GET /look` and `POST /move` (`{"room": <a door>}`), each with the current
4
+ room's observation (engine.Walk.look); every other request gets a 404 that names nothing. So the
5
+ tree and the exit stay in this container: an agent learns a room's doors only by standing in it,
6
+ and that a room is the exit only by reaching it.
7
+
8
+ Every move, accepted or refused, is appended to the move log (agent, from, to, time) before it is
9
+ answered, and the walk's state file is replaced after it: success.py (flock's success_check)
10
+ and export.py (Harbor's collect hook, for the grader) read those two files. A restarted
11
+ container resumes from them. Python 3.10+, standard library only.
12
+ """
13
+
14
+ import hashlib
15
+ import json
16
+ import os
17
+ import sys
18
+ import threading
19
+ from datetime import datetime, timezone
20
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
21
+
22
+ sys.dont_write_bytecode = True # -I ignores PYTHONDONTWRITEBYTECODE
23
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
24
+ from engine import Maze, Walk # noqa: E402
25
+
26
+ TREE = os.environ.get("MAZE_TREE", "/private/tree.json")
27
+ STATE_DIR = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze")
28
+ PORT = int(os.environ.get("MAZE_PORT", "8000"))
29
+ # The Trial whose maze this is: compose's project name, `<swarm>-<agent>-tN__env`
30
+ AGENT = os.environ.get("MAZE_AGENT", "").removesuffix("__env") or "agent"
31
+ BODY_LIMIT = 4096
32
+
33
+
34
+ def now() -> str:
35
+ return datetime.now(timezone.utc).isoformat(timespec="milliseconds")
36
+
37
+
38
+ class Service:
39
+ def __init__(self, tree_path: str, state_dir: str, agent: str):
40
+ with open(tree_path, "rb") as f:
41
+ raw = f.read()
42
+ self.maze = Maze(json.loads(raw))
43
+ self.tree_sha256 = hashlib.sha256(raw).hexdigest()
44
+ self.agent = agent
45
+ self.state_path = os.path.join(state_dir, "state.json")
46
+ self.log_path = os.path.join(state_dir, "moves.jsonl")
47
+ self.lock = threading.Lock()
48
+ os.makedirs(state_dir, exist_ok=True)
49
+ self.reached_at = None
50
+ if os.path.exists(self.state_path): # a restarted container
51
+ with open(self.state_path, encoding="utf-8") as f:
52
+ saved = json.load(f)
53
+ self.walk = Walk.from_state(self.maze, saved)
54
+ self.reached_at = saved.get("reached_at")
55
+ else:
56
+ self.walk = Walk(self.maze)
57
+ self.save()
58
+
59
+ def save(self) -> None:
60
+ state = {"agent": self.agent, "start": self.maze.start, "budget": self.maze.budget,
61
+ "tree_sha256": self.tree_sha256, **self.walk.state(),
62
+ "reached_at": self.reached_at}
63
+ temp = self.state_path + ".tmp"
64
+ with open(temp, "w", encoding="utf-8") as f:
65
+ json.dump(state, f)
66
+ f.flush()
67
+ os.fsync(f.fileno())
68
+ os.replace(temp, self.state_path)
69
+
70
+ def look(self) -> dict:
71
+ with self.lock:
72
+ return self.walk.look()
73
+
74
+ def move(self, room) -> tuple[dict, str | None]:
75
+ with self.lock:
76
+ here = self.walk.room
77
+ body, why = self.walk.move(room)
78
+ if why is None and self.walk.reached:
79
+ self.reached_at = now()
80
+ self.log(here, _logged(room), why)
81
+ return body, why
82
+
83
+ def bad_request(self) -> None:
84
+ """A move request without a room: refused, and logged like any other."""
85
+ with self.lock:
86
+ self.walk.refused += 1
87
+ self.log(self.walk.room, None, "bad_request")
88
+
89
+ def log(self, here: str, to, why: str | None) -> None:
90
+ record = {"agent": self.agent, "from": here, "to": to, "time": now(), "ok": why is None,
91
+ "moves": self.walk.moves}
92
+ if why is not None:
93
+ record["refused"] = why
94
+ with open(self.log_path, "a", encoding="utf-8") as f:
95
+ f.write(json.dumps(record) + "\n")
96
+ f.flush()
97
+ os.fsync(f.fileno())
98
+ self.save()
99
+
100
+
101
+ def _logged(room):
102
+ """What the agent asked to move into, as the log keeps it (a string, at most 64 chars)."""
103
+ text = room if isinstance(room, str) else json.dumps(room)
104
+ return text[:64]
105
+
106
+
107
+ def handler(service: Service):
108
+ class Handler(BaseHTTPRequestHandler):
109
+ server_version = "maze"
110
+ sys_version = ""
111
+
112
+ def reply(self, code: int, body: dict) -> None:
113
+ data = json.dumps(body).encode()
114
+ self.send_response(code)
115
+ self.send_header("Content-Type", "application/json")
116
+ self.send_header("Content-Length", str(len(data)))
117
+ self.end_headers()
118
+ self.wfile.write(data)
119
+
120
+ def not_found(self) -> None:
121
+ self.reply(404, {"error": "not found: use `maze look` or `maze move ROOM`"})
122
+
123
+ def do_GET(self): # noqa: N802
124
+ if self.path == "/look":
125
+ self.reply(200, service.look())
126
+ else:
127
+ self.not_found()
128
+
129
+ def do_POST(self): # noqa: N802
130
+ if self.path != "/move":
131
+ return self.not_found()
132
+ try:
133
+ length = int(self.headers.get("Content-Length") or 0)
134
+ except ValueError:
135
+ length = -1
136
+ room = None
137
+ if 0 < length <= BODY_LIMIT:
138
+ try:
139
+ room = json.loads(self.rfile.read(length)).get("room")
140
+ except (ValueError, AttributeError):
141
+ pass
142
+ if room is None:
143
+ service.bad_request()
144
+ return self.reply(400, {"error": 'send {"room": "<a door of your room>"}'})
145
+ body, why = service.move(room)
146
+ self.reply(200 if why is None else 409, body)
147
+
148
+ def do_PUT(self): # noqa: N802
149
+ self.not_found()
150
+
151
+ do_DELETE = do_PATCH = do_HEAD = do_OPTIONS = do_PUT # noqa: N815
152
+
153
+ def log_message(self, *args): # the move log is the record
154
+ pass
155
+
156
+ return Handler
157
+
158
+
159
+ def main() -> None:
160
+ service = Service(TREE, STATE_DIR, AGENT)
161
+ server = ThreadingHTTPServer(("0.0.0.0", PORT), handler(service))
162
+ server.daemon_threads = True
163
+ server.serve_forever()
164
+
165
+
166
+ if __name__ == "__main__":
167
+ main()
tasks/maze-t18/environment/maze/success.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """flock's success_check for s3-maze (`stop_on_success`), run in this maze service, never in the
2
+ agent's container: `python3 -I -S /app/success.py`.
3
+
4
+ Read-only: it prints `{"success": <the exit was reached>, "evidence": {...}}` from the walk's
5
+ state file, which only service.py writes. No state yet, or one that can't be read, is not a
6
+ success.
7
+ """
8
+
9
+ import json
10
+ import os
11
+
12
+ STATE = os.environ.get("MAZE_STATE_DIR", "/var/lib/maze") + "/state.json"
13
+
14
+
15
+ def read_state() -> dict | None:
16
+ try:
17
+ fd = os.open(STATE, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
18
+ with os.fdopen(fd, "rb") as f:
19
+ state = json.loads(f.read(1 << 16))
20
+ return state if isinstance(state, dict) else None
21
+ except (OSError, ValueError):
22
+ return None
23
+
24
+
25
+ state = read_state()
26
+ reached = bool(state) and state.get("reached") is True
27
+ evidence = ({"exit_reached": reached, "moves": state.get("moves"),
28
+ "reached_at": state.get("reached_at")} if state else {"state": "unreadable"})
29
+ print(json.dumps({"success": reached, "evidence": evidence}))
tasks/maze-t18/environment/maze/tree.json ADDED
@@ -0,0 +1,1569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "start": "R3454",
3
+ "exit": "R4907",
4
+ "budget": 210,
5
+ "doors": {
6
+ "R3454": [
7
+ "R2409",
8
+ "R2521",
9
+ "R7621"
10
+ ],
11
+ "R7621": [
12
+ "R9833",
13
+ "R3454"
14
+ ],
15
+ "R9833": [
16
+ "R4560",
17
+ "R7621"
18
+ ],
19
+ "R4560": [
20
+ "R9833",
21
+ "R6886"
22
+ ],
23
+ "R6886": [
24
+ "R4560",
25
+ "R8842"
26
+ ],
27
+ "R8842": [
28
+ "R7057",
29
+ "R6886"
30
+ ],
31
+ "R7057": [
32
+ "R2831",
33
+ "R8842"
34
+ ],
35
+ "R2831": [
36
+ "R7057",
37
+ "R1198"
38
+ ],
39
+ "R1198": [
40
+ "R2484",
41
+ "R2831"
42
+ ],
43
+ "R2484": [
44
+ "R1198",
45
+ "R4066"
46
+ ],
47
+ "R4066": [
48
+ "R9072",
49
+ "R8334",
50
+ "R3208",
51
+ "R2484"
52
+ ],
53
+ "R2409": [
54
+ "R4267",
55
+ "R3454"
56
+ ],
57
+ "R4267": [
58
+ "R5236",
59
+ "R2409"
60
+ ],
61
+ "R5236": [
62
+ "R3332",
63
+ "R4267"
64
+ ],
65
+ "R3332": [
66
+ "R4464",
67
+ "R5236"
68
+ ],
69
+ "R4464": [
70
+ "R1461",
71
+ "R3332"
72
+ ],
73
+ "R1461": [
74
+ "R9881",
75
+ "R4464"
76
+ ],
77
+ "R9881": [
78
+ "R1461",
79
+ "R4510"
80
+ ],
81
+ "R4510": [
82
+ "R9881",
83
+ "R9652"
84
+ ],
85
+ "R9652": [
86
+ "R9338",
87
+ "R4510"
88
+ ],
89
+ "R9338": [
90
+ "R9652",
91
+ "R8183",
92
+ "R4693",
93
+ "R6707"
94
+ ],
95
+ "R2521": [
96
+ "R3454",
97
+ "R5453"
98
+ ],
99
+ "R5453": [
100
+ "R2521",
101
+ "R5551"
102
+ ],
103
+ "R5551": [
104
+ "R5453",
105
+ "R6663"
106
+ ],
107
+ "R6663": [
108
+ "R3702",
109
+ "R5551"
110
+ ],
111
+ "R3702": [
112
+ "R4860",
113
+ "R6663"
114
+ ],
115
+ "R4860": [
116
+ "R3702",
117
+ "R6169"
118
+ ],
119
+ "R6169": [
120
+ "R3407",
121
+ "R4860"
122
+ ],
123
+ "R3407": [
124
+ "R6485",
125
+ "R6169"
126
+ ],
127
+ "R6485": [
128
+ "R3407",
129
+ "R9854"
130
+ ],
131
+ "R9854": [
132
+ "R6582",
133
+ "R8968",
134
+ "R6122",
135
+ "R6485"
136
+ ],
137
+ "R3208": [
138
+ "R4066",
139
+ "R1972"
140
+ ],
141
+ "R1972": [
142
+ "R3208",
143
+ "R5091"
144
+ ],
145
+ "R5091": [
146
+ "R5083",
147
+ "R1972"
148
+ ],
149
+ "R5083": [
150
+ "R3779",
151
+ "R5091"
152
+ ],
153
+ "R3779": [
154
+ "R7184",
155
+ "R5083"
156
+ ],
157
+ "R7184": [
158
+ "R1095",
159
+ "R3779"
160
+ ],
161
+ "R1095": [
162
+ "R7210",
163
+ "R7184"
164
+ ],
165
+ "R7210": [
166
+ "R7624",
167
+ "R1095"
168
+ ],
169
+ "R7624": [
170
+ "R3090",
171
+ "R7210"
172
+ ],
173
+ "R3090": [
174
+ "R6182",
175
+ "R6761",
176
+ "R7624",
177
+ "R8755"
178
+ ],
179
+ "R8334": [
180
+ "R4066",
181
+ "R7303"
182
+ ],
183
+ "R7303": [
184
+ "R7197",
185
+ "R8334"
186
+ ],
187
+ "R7197": [
188
+ "R1808",
189
+ "R7303"
190
+ ],
191
+ "R1808": [
192
+ "R7197",
193
+ "R2329"
194
+ ],
195
+ "R2329": [
196
+ "R1808",
197
+ "R7208"
198
+ ],
199
+ "R7208": [
200
+ "R2325",
201
+ "R2329"
202
+ ],
203
+ "R2325": [
204
+ "R4149",
205
+ "R7208"
206
+ ],
207
+ "R4149": [
208
+ "R2325",
209
+ "R8598"
210
+ ],
211
+ "R8598": [
212
+ "R2174",
213
+ "R4149"
214
+ ],
215
+ "R2174": [
216
+ "R8598",
217
+ "R5732",
218
+ "R5560",
219
+ "R9357"
220
+ ],
221
+ "R9072": [
222
+ "R2784",
223
+ "R4066"
224
+ ],
225
+ "R2784": [
226
+ "R6219",
227
+ "R9072"
228
+ ],
229
+ "R6219": [
230
+ "R2784",
231
+ "R9188"
232
+ ],
233
+ "R9188": [
234
+ "R6219",
235
+ "R9900"
236
+ ],
237
+ "R9900": [
238
+ "R3817",
239
+ "R9188"
240
+ ],
241
+ "R3817": [
242
+ "R9900",
243
+ "R8587"
244
+ ],
245
+ "R8587": [
246
+ "R2447",
247
+ "R3817"
248
+ ],
249
+ "R2447": [
250
+ "R5549",
251
+ "R8587"
252
+ ],
253
+ "R5549": [
254
+ "R1619",
255
+ "R2447"
256
+ ],
257
+ "R1619": [
258
+ "R1438",
259
+ "R4909",
260
+ "R5549",
261
+ "R4011"
262
+ ],
263
+ "R6707": [
264
+ "R9004",
265
+ "R9338"
266
+ ],
267
+ "R9004": [
268
+ "R9166",
269
+ "R6707"
270
+ ],
271
+ "R9166": [
272
+ "R9004",
273
+ "R5958"
274
+ ],
275
+ "R5958": [
276
+ "R9166",
277
+ "R8423"
278
+ ],
279
+ "R8423": [
280
+ "R6095",
281
+ "R5958"
282
+ ],
283
+ "R6095": [
284
+ "R4025",
285
+ "R8423"
286
+ ],
287
+ "R4025": [
288
+ "R6095",
289
+ "R1818"
290
+ ],
291
+ "R1818": [
292
+ "R5283",
293
+ "R4025"
294
+ ],
295
+ "R5283": [
296
+ "R4225",
297
+ "R1818"
298
+ ],
299
+ "R4225": [
300
+ "R1532",
301
+ "R8305",
302
+ "R7333",
303
+ "R5283"
304
+ ],
305
+ "R8183": [
306
+ "R9338",
307
+ "R8414"
308
+ ],
309
+ "R8414": [
310
+ "R8183",
311
+ "R8060"
312
+ ],
313
+ "R8060": [
314
+ "R8414",
315
+ "R8402"
316
+ ],
317
+ "R8402": [
318
+ "R8060",
319
+ "R5547"
320
+ ],
321
+ "R5547": [
322
+ "R6331",
323
+ "R8402"
324
+ ],
325
+ "R6331": [
326
+ "R4293",
327
+ "R5547"
328
+ ],
329
+ "R4293": [
330
+ "R7047",
331
+ "R6331"
332
+ ],
333
+ "R7047": [
334
+ "R8340",
335
+ "R4293"
336
+ ],
337
+ "R8340": [
338
+ "R6914",
339
+ "R7047"
340
+ ],
341
+ "R6914": [
342
+ "R8340",
343
+ "R1116",
344
+ "R7777",
345
+ "R5638"
346
+ ],
347
+ "R4693": [
348
+ "R9338",
349
+ "R4902"
350
+ ],
351
+ "R4902": [
352
+ "R4693",
353
+ "R1399"
354
+ ],
355
+ "R1399": [
356
+ "R6567",
357
+ "R4902"
358
+ ],
359
+ "R6567": [
360
+ "R3695",
361
+ "R1399"
362
+ ],
363
+ "R3695": [
364
+ "R9168",
365
+ "R6567"
366
+ ],
367
+ "R9168": [
368
+ "R6316",
369
+ "R3695"
370
+ ],
371
+ "R6316": [
372
+ "R9168",
373
+ "R4079"
374
+ ],
375
+ "R4079": [
376
+ "R8366",
377
+ "R6316"
378
+ ],
379
+ "R8366": [
380
+ "R8028",
381
+ "R4079"
382
+ ],
383
+ "R8028": [
384
+ "R3340",
385
+ "R7414",
386
+ "R8366",
387
+ "R7026"
388
+ ],
389
+ "R6582": [
390
+ "R2533",
391
+ "R9854"
392
+ ],
393
+ "R2533": [
394
+ "R6582",
395
+ "R5232"
396
+ ],
397
+ "R5232": [
398
+ "R6906",
399
+ "R2533"
400
+ ],
401
+ "R6906": [
402
+ "R5232",
403
+ "R9398"
404
+ ],
405
+ "R9398": [
406
+ "R6424",
407
+ "R6906"
408
+ ],
409
+ "R6424": [
410
+ "R4775",
411
+ "R9398"
412
+ ],
413
+ "R4775": [
414
+ "R3370",
415
+ "R6424"
416
+ ],
417
+ "R3370": [
418
+ "R4775",
419
+ "R5508"
420
+ ],
421
+ "R5508": [
422
+ "R9386",
423
+ "R3370"
424
+ ],
425
+ "R9386": [
426
+ "R3895",
427
+ "R5508",
428
+ "R1610",
429
+ "R5460"
430
+ ],
431
+ "R8968": [
432
+ "R9854",
433
+ "R8774"
434
+ ],
435
+ "R8774": [
436
+ "R9314",
437
+ "R8968"
438
+ ],
439
+ "R9314": [
440
+ "R9784",
441
+ "R8774"
442
+ ],
443
+ "R9784": [
444
+ "R6007",
445
+ "R9314"
446
+ ],
447
+ "R6007": [
448
+ "R4357",
449
+ "R9784"
450
+ ],
451
+ "R4357": [
452
+ "R1832",
453
+ "R6007"
454
+ ],
455
+ "R1832": [
456
+ "R7903",
457
+ "R4357"
458
+ ],
459
+ "R7903": [
460
+ "R7152",
461
+ "R1832"
462
+ ],
463
+ "R7152": [
464
+ "R7903",
465
+ "R2208"
466
+ ],
467
+ "R2208": [
468
+ "R1058",
469
+ "R1052",
470
+ "R7152",
471
+ "R7649"
472
+ ],
473
+ "R6122": [
474
+ "R9854",
475
+ "R7315"
476
+ ],
477
+ "R7315": [
478
+ "R4498",
479
+ "R6122"
480
+ ],
481
+ "R4498": [
482
+ "R7315",
483
+ "R3299"
484
+ ],
485
+ "R3299": [
486
+ "R4498",
487
+ "R2011"
488
+ ],
489
+ "R2011": [
490
+ "R3299",
491
+ "R9321"
492
+ ],
493
+ "R9321": [
494
+ "R2011",
495
+ "R6677"
496
+ ],
497
+ "R6677": [
498
+ "R9321",
499
+ "R9406"
500
+ ],
501
+ "R9406": [
502
+ "R6677",
503
+ "R5309"
504
+ ],
505
+ "R5309": [
506
+ "R9406",
507
+ "R3824"
508
+ ],
509
+ "R3824": [
510
+ "R4053",
511
+ "R7376",
512
+ "R5309",
513
+ "R5478"
514
+ ],
515
+ "R6761": [
516
+ "R6641",
517
+ "R3090"
518
+ ],
519
+ "R6641": [
520
+ "R6761",
521
+ "R3117"
522
+ ],
523
+ "R3117": [
524
+ "R6641",
525
+ "R3365"
526
+ ],
527
+ "R3365": [
528
+ "R3117",
529
+ "R1130"
530
+ ],
531
+ "R1130": [
532
+ "R3365",
533
+ "R6706"
534
+ ],
535
+ "R6706": [
536
+ "R1130",
537
+ "R6814"
538
+ ],
539
+ "R6814": [
540
+ "R5238",
541
+ "R6706"
542
+ ],
543
+ "R5238": [
544
+ "R6814",
545
+ "R1546"
546
+ ],
547
+ "R1546": [
548
+ "R4522",
549
+ "R5238"
550
+ ],
551
+ "R4522": [
552
+ "R1546"
553
+ ],
554
+ "R6182": [
555
+ "R6640",
556
+ "R3090"
557
+ ],
558
+ "R6640": [
559
+ "R6182",
560
+ "R8296"
561
+ ],
562
+ "R8296": [
563
+ "R6221",
564
+ "R6640"
565
+ ],
566
+ "R6221": [
567
+ "R8296",
568
+ "R9272"
569
+ ],
570
+ "R9272": [
571
+ "R6221",
572
+ "R9164"
573
+ ],
574
+ "R9164": [
575
+ "R9272",
576
+ "R4195"
577
+ ],
578
+ "R4195": [
579
+ "R9164",
580
+ "R1074"
581
+ ],
582
+ "R1074": [
583
+ "R4195",
584
+ "R9732"
585
+ ],
586
+ "R9732": [
587
+ "R1074",
588
+ "R9684"
589
+ ],
590
+ "R9684": [
591
+ "R9732"
592
+ ],
593
+ "R8755": [
594
+ "R3090",
595
+ "R4876"
596
+ ],
597
+ "R4876": [
598
+ "R4468",
599
+ "R8755"
600
+ ],
601
+ "R4468": [
602
+ "R4876",
603
+ "R7665"
604
+ ],
605
+ "R7665": [
606
+ "R4217",
607
+ "R4468"
608
+ ],
609
+ "R4217": [
610
+ "R7665",
611
+ "R3760"
612
+ ],
613
+ "R3760": [
614
+ "R4217",
615
+ "R6846"
616
+ ],
617
+ "R6846": [
618
+ "R2693",
619
+ "R3760"
620
+ ],
621
+ "R2693": [
622
+ "R6846",
623
+ "R5683"
624
+ ],
625
+ "R5683": [
626
+ "R2693",
627
+ "R3756"
628
+ ],
629
+ "R3756": [
630
+ "R5683"
631
+ ],
632
+ "R5732": [
633
+ "R5490",
634
+ "R2174"
635
+ ],
636
+ "R5490": [
637
+ "R5732",
638
+ "R6750"
639
+ ],
640
+ "R6750": [
641
+ "R8322",
642
+ "R5490"
643
+ ],
644
+ "R8322": [
645
+ "R3413",
646
+ "R6750"
647
+ ],
648
+ "R3413": [
649
+ "R7679",
650
+ "R8322"
651
+ ],
652
+ "R7679": [
653
+ "R6107",
654
+ "R3413"
655
+ ],
656
+ "R6107": [
657
+ "R7679",
658
+ "R3800"
659
+ ],
660
+ "R3800": [
661
+ "R6652",
662
+ "R6107"
663
+ ],
664
+ "R6652": [
665
+ "R8623",
666
+ "R3800"
667
+ ],
668
+ "R8623": [
669
+ "R6652"
670
+ ],
671
+ "R9357": [
672
+ "R2174",
673
+ "R6854"
674
+ ],
675
+ "R6854": [
676
+ "R7517",
677
+ "R9357"
678
+ ],
679
+ "R7517": [
680
+ "R5604",
681
+ "R6854"
682
+ ],
683
+ "R5604": [
684
+ "R7567",
685
+ "R7517"
686
+ ],
687
+ "R7567": [
688
+ "R8498",
689
+ "R5604"
690
+ ],
691
+ "R8498": [
692
+ "R7567",
693
+ "R9739"
694
+ ],
695
+ "R9739": [
696
+ "R8498",
697
+ "R3428"
698
+ ],
699
+ "R3428": [
700
+ "R9739",
701
+ "R2382"
702
+ ],
703
+ "R2382": [
704
+ "R6502",
705
+ "R3428"
706
+ ],
707
+ "R6502": [
708
+ "R2382"
709
+ ],
710
+ "R5560": [
711
+ "R4552",
712
+ "R2174"
713
+ ],
714
+ "R4552": [
715
+ "R5560",
716
+ "R2558"
717
+ ],
718
+ "R2558": [
719
+ "R9442",
720
+ "R4552"
721
+ ],
722
+ "R9442": [
723
+ "R1265",
724
+ "R2558"
725
+ ],
726
+ "R1265": [
727
+ "R9442",
728
+ "R6381"
729
+ ],
730
+ "R6381": [
731
+ "R3288",
732
+ "R1265"
733
+ ],
734
+ "R3288": [
735
+ "R6381",
736
+ "R2629"
737
+ ],
738
+ "R2629": [
739
+ "R3288",
740
+ "R8900"
741
+ ],
742
+ "R8900": [
743
+ "R2629",
744
+ "R4706"
745
+ ],
746
+ "R4706": [
747
+ "R8900"
748
+ ],
749
+ "R1438": [
750
+ "R2913",
751
+ "R1619"
752
+ ],
753
+ "R2913": [
754
+ "R3385",
755
+ "R1438"
756
+ ],
757
+ "R3385": [
758
+ "R2913",
759
+ "R9111"
760
+ ],
761
+ "R9111": [
762
+ "R6179",
763
+ "R3385"
764
+ ],
765
+ "R6179": [
766
+ "R5427",
767
+ "R9111"
768
+ ],
769
+ "R5427": [
770
+ "R8457",
771
+ "R6179"
772
+ ],
773
+ "R8457": [
774
+ "R5427",
775
+ "R6141"
776
+ ],
777
+ "R6141": [
778
+ "R8457",
779
+ "R6057"
780
+ ],
781
+ "R6057": [
782
+ "R6141",
783
+ "R9696"
784
+ ],
785
+ "R9696": [
786
+ "R6057"
787
+ ],
788
+ "R4011": [
789
+ "R4093",
790
+ "R1619"
791
+ ],
792
+ "R4093": [
793
+ "R3831",
794
+ "R4011"
795
+ ],
796
+ "R3831": [
797
+ "R5627",
798
+ "R4093"
799
+ ],
800
+ "R5627": [
801
+ "R3831",
802
+ "R3042"
803
+ ],
804
+ "R3042": [
805
+ "R2541",
806
+ "R5627"
807
+ ],
808
+ "R2541": [
809
+ "R3042",
810
+ "R1946"
811
+ ],
812
+ "R1946": [
813
+ "R5269",
814
+ "R2541"
815
+ ],
816
+ "R5269": [
817
+ "R1946",
818
+ "R9578"
819
+ ],
820
+ "R9578": [
821
+ "R8333",
822
+ "R5269"
823
+ ],
824
+ "R8333": [
825
+ "R9578"
826
+ ],
827
+ "R4909": [
828
+ "R9770",
829
+ "R1619"
830
+ ],
831
+ "R9770": [
832
+ "R4909",
833
+ "R5584"
834
+ ],
835
+ "R5584": [
836
+ "R9770",
837
+ "R5066"
838
+ ],
839
+ "R5066": [
840
+ "R5584",
841
+ "R9399"
842
+ ],
843
+ "R9399": [
844
+ "R2936",
845
+ "R5066"
846
+ ],
847
+ "R2936": [
848
+ "R9284",
849
+ "R9399"
850
+ ],
851
+ "R9284": [
852
+ "R2936",
853
+ "R8097"
854
+ ],
855
+ "R8097": [
856
+ "R9284",
857
+ "R5110"
858
+ ],
859
+ "R5110": [
860
+ "R1722",
861
+ "R8097"
862
+ ],
863
+ "R1722": [
864
+ "R5110"
865
+ ],
866
+ "R7333": [
867
+ "R4277",
868
+ "R4225"
869
+ ],
870
+ "R4277": [
871
+ "R1323",
872
+ "R7333"
873
+ ],
874
+ "R1323": [
875
+ "R4277",
876
+ "R6174"
877
+ ],
878
+ "R6174": [
879
+ "R1323",
880
+ "R9407"
881
+ ],
882
+ "R9407": [
883
+ "R9812",
884
+ "R6174"
885
+ ],
886
+ "R9812": [
887
+ "R9407",
888
+ "R2450"
889
+ ],
890
+ "R2450": [
891
+ "R9700",
892
+ "R9812"
893
+ ],
894
+ "R9700": [
895
+ "R4013",
896
+ "R2450"
897
+ ],
898
+ "R4013": [
899
+ "R9700",
900
+ "R7141"
901
+ ],
902
+ "R7141": [
903
+ "R4013"
904
+ ],
905
+ "R8305": [
906
+ "R6975",
907
+ "R4225"
908
+ ],
909
+ "R6975": [
910
+ "R8305",
911
+ "R5392"
912
+ ],
913
+ "R5392": [
914
+ "R6975",
915
+ "R4597"
916
+ ],
917
+ "R4597": [
918
+ "R9328",
919
+ "R5392"
920
+ ],
921
+ "R9328": [
922
+ "R9455",
923
+ "R4597"
924
+ ],
925
+ "R9455": [
926
+ "R9328",
927
+ "R1635"
928
+ ],
929
+ "R1635": [
930
+ "R9455",
931
+ "R7032"
932
+ ],
933
+ "R7032": [
934
+ "R1635",
935
+ "R8216"
936
+ ],
937
+ "R8216": [
938
+ "R7032",
939
+ "R5692"
940
+ ],
941
+ "R5692": [
942
+ "R8216"
943
+ ],
944
+ "R1532": [
945
+ "R1923",
946
+ "R4225"
947
+ ],
948
+ "R1923": [
949
+ "R7213",
950
+ "R1532"
951
+ ],
952
+ "R7213": [
953
+ "R1923",
954
+ "R7849"
955
+ ],
956
+ "R7849": [
957
+ "R2351",
958
+ "R7213"
959
+ ],
960
+ "R2351": [
961
+ "R3075",
962
+ "R7849"
963
+ ],
964
+ "R3075": [
965
+ "R5050",
966
+ "R2351"
967
+ ],
968
+ "R5050": [
969
+ "R3075",
970
+ "R5447"
971
+ ],
972
+ "R5447": [
973
+ "R3461",
974
+ "R5050"
975
+ ],
976
+ "R3461": [
977
+ "R1189",
978
+ "R5447"
979
+ ],
980
+ "R1189": [
981
+ "R3461"
982
+ ],
983
+ "R5638": [
984
+ "R6914",
985
+ "R4187"
986
+ ],
987
+ "R4187": [
988
+ "R5706",
989
+ "R5638"
990
+ ],
991
+ "R5706": [
992
+ "R6028",
993
+ "R4187"
994
+ ],
995
+ "R6028": [
996
+ "R5706",
997
+ "R9423"
998
+ ],
999
+ "R9423": [
1000
+ "R6028",
1001
+ "R2427"
1002
+ ],
1003
+ "R2427": [
1004
+ "R9423",
1005
+ "R5791"
1006
+ ],
1007
+ "R5791": [
1008
+ "R4805",
1009
+ "R2427"
1010
+ ],
1011
+ "R4805": [
1012
+ "R5791",
1013
+ "R3491"
1014
+ ],
1015
+ "R3491": [
1016
+ "R6226",
1017
+ "R4805"
1018
+ ],
1019
+ "R6226": [
1020
+ "R3491"
1021
+ ],
1022
+ "R7777": [
1023
+ "R6423",
1024
+ "R6914"
1025
+ ],
1026
+ "R6423": [
1027
+ "R7777",
1028
+ "R2816"
1029
+ ],
1030
+ "R2816": [
1031
+ "R8493",
1032
+ "R6423"
1033
+ ],
1034
+ "R8493": [
1035
+ "R3362",
1036
+ "R2816"
1037
+ ],
1038
+ "R3362": [
1039
+ "R8493",
1040
+ "R8955"
1041
+ ],
1042
+ "R8955": [
1043
+ "R3362",
1044
+ "R8961"
1045
+ ],
1046
+ "R8961": [
1047
+ "R1920",
1048
+ "R8955"
1049
+ ],
1050
+ "R1920": [
1051
+ "R3619",
1052
+ "R8961"
1053
+ ],
1054
+ "R3619": [
1055
+ "R3146",
1056
+ "R1920"
1057
+ ],
1058
+ "R3146": [
1059
+ "R3619"
1060
+ ],
1061
+ "R1116": [
1062
+ "R6914",
1063
+ "R3163"
1064
+ ],
1065
+ "R3163": [
1066
+ "R1116",
1067
+ "R9462"
1068
+ ],
1069
+ "R9462": [
1070
+ "R3163",
1071
+ "R5147"
1072
+ ],
1073
+ "R5147": [
1074
+ "R9462",
1075
+ "R4355"
1076
+ ],
1077
+ "R4355": [
1078
+ "R6183",
1079
+ "R5147"
1080
+ ],
1081
+ "R6183": [
1082
+ "R4129",
1083
+ "R4355"
1084
+ ],
1085
+ "R4129": [
1086
+ "R6183",
1087
+ "R6803"
1088
+ ],
1089
+ "R6803": [
1090
+ "R5421",
1091
+ "R4129"
1092
+ ],
1093
+ "R5421": [
1094
+ "R8638",
1095
+ "R6803"
1096
+ ],
1097
+ "R8638": [
1098
+ "R5421"
1099
+ ],
1100
+ "R3340": [
1101
+ "R1785",
1102
+ "R8028"
1103
+ ],
1104
+ "R1785": [
1105
+ "R4180",
1106
+ "R3340"
1107
+ ],
1108
+ "R4180": [
1109
+ "R8745",
1110
+ "R1785"
1111
+ ],
1112
+ "R8745": [
1113
+ "R4180",
1114
+ "R1717"
1115
+ ],
1116
+ "R1717": [
1117
+ "R8745",
1118
+ "R5916"
1119
+ ],
1120
+ "R5916": [
1121
+ "R6460",
1122
+ "R1717"
1123
+ ],
1124
+ "R6460": [
1125
+ "R5916",
1126
+ "R2892"
1127
+ ],
1128
+ "R2892": [
1129
+ "R6460",
1130
+ "R2305"
1131
+ ],
1132
+ "R2305": [
1133
+ "R2892",
1134
+ "R9915"
1135
+ ],
1136
+ "R9915": [
1137
+ "R2305"
1138
+ ],
1139
+ "R7414": [
1140
+ "R2556",
1141
+ "R8028"
1142
+ ],
1143
+ "R2556": [
1144
+ "R7414",
1145
+ "R5061"
1146
+ ],
1147
+ "R5061": [
1148
+ "R6318",
1149
+ "R2556"
1150
+ ],
1151
+ "R6318": [
1152
+ "R3150",
1153
+ "R5061"
1154
+ ],
1155
+ "R3150": [
1156
+ "R3026",
1157
+ "R6318"
1158
+ ],
1159
+ "R3026": [
1160
+ "R3167",
1161
+ "R3150"
1162
+ ],
1163
+ "R3167": [
1164
+ "R1481",
1165
+ "R3026"
1166
+ ],
1167
+ "R1481": [
1168
+ "R6762",
1169
+ "R3167"
1170
+ ],
1171
+ "R6762": [
1172
+ "R5059",
1173
+ "R1481"
1174
+ ],
1175
+ "R5059": [
1176
+ "R6762"
1177
+ ],
1178
+ "R7026": [
1179
+ "R8028",
1180
+ "R9051"
1181
+ ],
1182
+ "R9051": [
1183
+ "R7026",
1184
+ "R7533"
1185
+ ],
1186
+ "R7533": [
1187
+ "R7909",
1188
+ "R9051"
1189
+ ],
1190
+ "R7909": [
1191
+ "R7533",
1192
+ "R3048"
1193
+ ],
1194
+ "R3048": [
1195
+ "R5464",
1196
+ "R7909"
1197
+ ],
1198
+ "R5464": [
1199
+ "R6164",
1200
+ "R3048"
1201
+ ],
1202
+ "R6164": [
1203
+ "R3987",
1204
+ "R5464"
1205
+ ],
1206
+ "R3987": [
1207
+ "R6097",
1208
+ "R6164"
1209
+ ],
1210
+ "R6097": [
1211
+ "R3458",
1212
+ "R3987"
1213
+ ],
1214
+ "R3458": [
1215
+ "R6097"
1216
+ ],
1217
+ "R5460": [
1218
+ "R7784",
1219
+ "R9386"
1220
+ ],
1221
+ "R7784": [
1222
+ "R5460",
1223
+ "R8895"
1224
+ ],
1225
+ "R8895": [
1226
+ "R7784",
1227
+ "R9468"
1228
+ ],
1229
+ "R9468": [
1230
+ "R4536",
1231
+ "R8895"
1232
+ ],
1233
+ "R4536": [
1234
+ "R9468",
1235
+ "R3517"
1236
+ ],
1237
+ "R3517": [
1238
+ "R8004",
1239
+ "R4536"
1240
+ ],
1241
+ "R8004": [
1242
+ "R8459",
1243
+ "R3517"
1244
+ ],
1245
+ "R8459": [
1246
+ "R5725",
1247
+ "R8004"
1248
+ ],
1249
+ "R5725": [
1250
+ "R8459",
1251
+ "R5892"
1252
+ ],
1253
+ "R5892": [
1254
+ "R5725"
1255
+ ],
1256
+ "R1610": [
1257
+ "R9386",
1258
+ "R7495"
1259
+ ],
1260
+ "R7495": [
1261
+ "R1610",
1262
+ "R5107"
1263
+ ],
1264
+ "R5107": [
1265
+ "R7671",
1266
+ "R7495"
1267
+ ],
1268
+ "R7671": [
1269
+ "R6808",
1270
+ "R5107"
1271
+ ],
1272
+ "R6808": [
1273
+ "R7671",
1274
+ "R5700"
1275
+ ],
1276
+ "R5700": [
1277
+ "R4734",
1278
+ "R6808"
1279
+ ],
1280
+ "R4734": [
1281
+ "R5700",
1282
+ "R5191"
1283
+ ],
1284
+ "R5191": [
1285
+ "R4734",
1286
+ "R2531"
1287
+ ],
1288
+ "R2531": [
1289
+ "R7237",
1290
+ "R5191"
1291
+ ],
1292
+ "R7237": [
1293
+ "R2531"
1294
+ ],
1295
+ "R3895": [
1296
+ "R9386",
1297
+ "R7264"
1298
+ ],
1299
+ "R7264": [
1300
+ "R6434",
1301
+ "R3895"
1302
+ ],
1303
+ "R6434": [
1304
+ "R2998",
1305
+ "R7264"
1306
+ ],
1307
+ "R2998": [
1308
+ "R6434",
1309
+ "R8085"
1310
+ ],
1311
+ "R8085": [
1312
+ "R2998",
1313
+ "R9334"
1314
+ ],
1315
+ "R9334": [
1316
+ "R4657",
1317
+ "R8085"
1318
+ ],
1319
+ "R4657": [
1320
+ "R1467",
1321
+ "R9334"
1322
+ ],
1323
+ "R1467": [
1324
+ "R4657",
1325
+ "R4173"
1326
+ ],
1327
+ "R4173": [
1328
+ "R3737",
1329
+ "R1467"
1330
+ ],
1331
+ "R3737": [
1332
+ "R4173"
1333
+ ],
1334
+ "R7649": [
1335
+ "R2208",
1336
+ "R8507"
1337
+ ],
1338
+ "R8507": [
1339
+ "R7191",
1340
+ "R7649"
1341
+ ],
1342
+ "R7191": [
1343
+ "R8507",
1344
+ "R3889"
1345
+ ],
1346
+ "R3889": [
1347
+ "R6045",
1348
+ "R7191"
1349
+ ],
1350
+ "R6045": [
1351
+ "R3889",
1352
+ "R1895"
1353
+ ],
1354
+ "R1895": [
1355
+ "R6045",
1356
+ "R6590"
1357
+ ],
1358
+ "R6590": [
1359
+ "R1411",
1360
+ "R1895"
1361
+ ],
1362
+ "R1411": [
1363
+ "R9623",
1364
+ "R6590"
1365
+ ],
1366
+ "R9623": [
1367
+ "R1411",
1368
+ "R4870"
1369
+ ],
1370
+ "R4870": [
1371
+ "R9623"
1372
+ ],
1373
+ "R1058": [
1374
+ "R2208",
1375
+ "R3386"
1376
+ ],
1377
+ "R3386": [
1378
+ "R3803",
1379
+ "R1058"
1380
+ ],
1381
+ "R3803": [
1382
+ "R3386",
1383
+ "R1390"
1384
+ ],
1385
+ "R1390": [
1386
+ "R7437",
1387
+ "R3803"
1388
+ ],
1389
+ "R7437": [
1390
+ "R1390",
1391
+ "R2635"
1392
+ ],
1393
+ "R2635": [
1394
+ "R7070",
1395
+ "R7437"
1396
+ ],
1397
+ "R7070": [
1398
+ "R9744",
1399
+ "R2635"
1400
+ ],
1401
+ "R9744": [
1402
+ "R7070",
1403
+ "R8234"
1404
+ ],
1405
+ "R8234": [
1406
+ "R9744",
1407
+ "R9966"
1408
+ ],
1409
+ "R9966": [
1410
+ "R8234"
1411
+ ],
1412
+ "R1052": [
1413
+ "R2208",
1414
+ "R8465"
1415
+ ],
1416
+ "R8465": [
1417
+ "R1052",
1418
+ "R9205"
1419
+ ],
1420
+ "R9205": [
1421
+ "R3816",
1422
+ "R8465"
1423
+ ],
1424
+ "R3816": [
1425
+ "R1159",
1426
+ "R9205"
1427
+ ],
1428
+ "R1159": [
1429
+ "R6522",
1430
+ "R3816"
1431
+ ],
1432
+ "R6522": [
1433
+ "R1159",
1434
+ "R5539"
1435
+ ],
1436
+ "R5539": [
1437
+ "R7890",
1438
+ "R6522"
1439
+ ],
1440
+ "R7890": [
1441
+ "R1333",
1442
+ "R5539"
1443
+ ],
1444
+ "R1333": [
1445
+ "R7890",
1446
+ "R4907"
1447
+ ],
1448
+ "R4907": [
1449
+ "R1333"
1450
+ ],
1451
+ "R7376": [
1452
+ "R3824",
1453
+ "R8500"
1454
+ ],
1455
+ "R8500": [
1456
+ "R7376",
1457
+ "R1422"
1458
+ ],
1459
+ "R1422": [
1460
+ "R3833",
1461
+ "R8500"
1462
+ ],
1463
+ "R3833": [
1464
+ "R4739",
1465
+ "R1422"
1466
+ ],
1467
+ "R4739": [
1468
+ "R3833",
1469
+ "R2848"
1470
+ ],
1471
+ "R2848": [
1472
+ "R4739",
1473
+ "R1437"
1474
+ ],
1475
+ "R1437": [
1476
+ "R8844",
1477
+ "R2848"
1478
+ ],
1479
+ "R8844": [
1480
+ "R1437",
1481
+ "R8977"
1482
+ ],
1483
+ "R8977": [
1484
+ "R8844",
1485
+ "R2842"
1486
+ ],
1487
+ "R2842": [
1488
+ "R8977"
1489
+ ],
1490
+ "R5478": [
1491
+ "R5930",
1492
+ "R3824"
1493
+ ],
1494
+ "R5930": [
1495
+ "R5478",
1496
+ "R5571"
1497
+ ],
1498
+ "R5571": [
1499
+ "R5930",
1500
+ "R7325"
1501
+ ],
1502
+ "R7325": [
1503
+ "R7733",
1504
+ "R5571"
1505
+ ],
1506
+ "R7733": [
1507
+ "R8385",
1508
+ "R7325"
1509
+ ],
1510
+ "R8385": [
1511
+ "R7733",
1512
+ "R8869"
1513
+ ],
1514
+ "R8869": [
1515
+ "R8631",
1516
+ "R8385"
1517
+ ],
1518
+ "R8631": [
1519
+ "R9803",
1520
+ "R8869"
1521
+ ],
1522
+ "R9803": [
1523
+ "R1303",
1524
+ "R8631"
1525
+ ],
1526
+ "R1303": [
1527
+ "R9803"
1528
+ ],
1529
+ "R4053": [
1530
+ "R3824",
1531
+ "R6010"
1532
+ ],
1533
+ "R6010": [
1534
+ "R7680",
1535
+ "R4053"
1536
+ ],
1537
+ "R7680": [
1538
+ "R6010",
1539
+ "R8603"
1540
+ ],
1541
+ "R8603": [
1542
+ "R7680",
1543
+ "R3516"
1544
+ ],
1545
+ "R3516": [
1546
+ "R9291",
1547
+ "R8603"
1548
+ ],
1549
+ "R9291": [
1550
+ "R3516",
1551
+ "R5779"
1552
+ ],
1553
+ "R5779": [
1554
+ "R6491",
1555
+ "R9291"
1556
+ ],
1557
+ "R6491": [
1558
+ "R5779",
1559
+ "R9410"
1560
+ ],
1561
+ "R9410": [
1562
+ "R5260",
1563
+ "R6491"
1564
+ ],
1565
+ "R5260": [
1566
+ "R9410"
1567
+ ]
1568
+ }
1569
+ }
tasks/maze-t18/instruction.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Find the exit of the maze
2
+
3
+ You are exploring a maze of rooms connected by doors to find the exit. The maze is a tree: from
4
+ the start room, corridors of rooms lead to junctions where the way divides, and the exit is one
5
+ of the dead ends at the far ends of the corridors. Every agent on your team starts in the same
6
+ room, in its own copy of the same maze: the same rooms, with the same doors listed in the same
7
+ order. Your position is your own: moving never moves a teammate.
8
+
9
+ Explore with the `maze` command in your shell:
10
+
11
+ - `maze look` describes your current room again, without moving;
12
+ - `maze move ROOM` walks through a door of your current room into the named adjacent room.
13
+
14
+ Each prints JSON: the room you are in (`room`), its doors (`doors`), whether it is the exit
15
+ (`exit`), the room you arrived from (`arrived_from`) and how many moves you have left
16
+ (`moves_left`), with a `notice` at a dead end. Only the doors listed for your current room are
17
+ reachable in one move; to go back, move to the room you arrived from. Room names carry no
18
+ information about where the exit is.
19
+
20
+ You can make at most 210 moves. Looking is free, and a refused move (into a room that is not
21
+ one of your doors) costs nothing.
22
+
23
+ Reaching the exit solves the task for the whole team and ends the run. If you have teammates
24
+ (your instructions name them), they are searching the same maze: what one of you learns about it
25
+ holds for everyone. Use the message board to share what you find and to read what they find.
26
+ Once you reach the exit, post that you have, then stop.
tasks/maze-t18/solution/solve.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: walk the shortest path to the exit with `maze move`, from its own copy of the path.
3
+ set -e
4
+ for room in R2521 R5453 R5551 R6663 R3702 R4860 R6169 R3407 R6485 R9854 R8968 R8774 R9314 R9784 R6007 R4357 R1832 R7903 R7152 R2208 R1052 R8465 R9205 R3816 R1159 R6522 R5539 R7890 R1333 R4907; do
5
+ maze move "$room" > /dev/null
6
+ done
7
+ maze look
tasks/maze-t18/task.toml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ # The maze service's own record of the walk, exported by its collect hook below once the agent
4
+ # is done: the grader's only input besides tests/expected.json.
5
+ [[artifacts]]
6
+ source = "/evidence/final.json"
7
+ service = "maze"
8
+
9
+ [[artifacts]]
10
+ source = "/evidence/moves.jsonl"
11
+ service = "maze"
12
+
13
+ [task]
14
+ name = "HuggingFaceSwarms/maze-t18"
15
+ version = "0.1.0"
16
+ description = "s3-maze: agents search their own copies of one maze; the first one out wins."
17
+ keywords = ["multi-agent", "message-board", "s3", "maze", "exploration"]
18
+
19
+ [metadata]
20
+ tree = 18
21
+ seed = 115
22
+ branching = 3
23
+ corridor = 10
24
+ depth = 3
25
+ rooms = 391
26
+ dead_ends = 27
27
+ shortest_path = 30
28
+ full_search = 780
29
+ move_budget = 210
30
+
31
+ [agent]
32
+ timeout_sec = 3600
33
+
34
+ [environment]
35
+ build_timeout_sec = 900
36
+ cpus = 1
37
+ memory_mb = 1024
38
+
39
+ [verifier]
40
+ # The grader runs in its own container (tests/Dockerfile) after the agent's has stopped, on
41
+ # what the maze service exported: nothing the agent's container holds reaches it.
42
+ environment_mode = "separate"
43
+ timeout_sec = 120
44
+
45
+ [[verifier.collect]]
46
+ service = "maze"
47
+ command = "python3 -I -S /app/export.py"
48
+ timeout_sec = 30
tasks/maze-t18/tests/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The verifier's own container (environment_mode = "separate"): the grader and the task's
3
+ # answer, never in the agent's container. Harbor adds /evidence from the maze service.
4
+ COPY test.sh grade.py expected.json /tests/
5
+ RUN chmod 755 /tests/test.sh
tasks/maze-t18/tests/expected.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "start": "R3454",
3
+ "exit": "R4907",
4
+ "budget": 210,
5
+ "tree_sha256": "2bef5124d3511f568e562ef506846f61a3bafa4cf06af64cefc585d85fe540ea"
6
+ }
tasks/maze-t18/tests/grade.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """s3-maze's grader: reward 1 if the agent's walk reached the exit, from the maze service's own
2
+ record. Run by test.sh as `python3 -I -S grade.py`, in a fresh verifier container (the task's
3
+ `environment_mode = "separate"`), after the agent's container has stopped.
4
+
5
+ It reads only /evidence/final.json and /evidence/moves.jsonl, which the maze service exported
6
+ (export.py, Harbor's collect hook) and Harbor carried over, and expected.json (this folder,
7
+ never in the agent's container). Reward 1 needs all of: the export is the service's
8
+ (`exported_by`), for this task's tree (its sha256), start and move budget; the service says the
9
+ exit was reached and the walk ends there; and the move log's accepted moves are one unbroken
10
+ walk from the start to the exit, within the budget, as many as the service counted. Anything
11
+ else, a missing, unreadable or malformed file included, scores 0.
12
+
13
+ Each file counts only as a regular file of its own at exactly its path: no link anywhere on the
14
+ path is followed, and a FIFO cannot block the read. The reward file is written 0 first and
15
+ never through a link. Copies of both files stay in the verifier's folder, for the metrics.
16
+ EVIDENCE_DIR, EXPECTED and VERIFIER_DIR override the paths (no links in them), to test locally.
17
+ """
18
+
19
+ import json
20
+ import os
21
+ import stat
22
+
23
+ EVIDENCE = os.environ.get("EVIDENCE_DIR", "/evidence")
24
+ EXPECTED = os.environ.get("EXPECTED", "/tests/expected.json")
25
+ VERIFIER = os.environ.get("VERIFIER_DIR", "/logs/verifier")
26
+ LIMIT = 16 << 20 # bytes
27
+
28
+
29
+ def read_own(path: str) -> bytes:
30
+ """The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ without following a link, and so is the file (a FIFO cannot block it); one link only."""
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(name: str, data: bytes) -> None:
53
+ path = os.path.join(VERIFIER, name)
54
+ try:
55
+ os.unlink(path) # never written through a link
56
+ except FileNotFoundError:
57
+ pass
58
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644)
59
+ with os.fdopen(fd, "wb") as stream:
60
+ stream.write(data)
61
+
62
+
63
+ def reject_constant(name):
64
+ raise ValueError(f"{name} is not JSON")
65
+
66
+
67
+ def parse(data: bytes):
68
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
69
+
70
+
71
+ def walk_reaches_exit(final: dict, records: list, expected: dict) -> bool:
72
+ room, moves = expected["start"], 0
73
+ for record in records:
74
+ if not isinstance(record, dict) or record.get("ok") not in (True, False):
75
+ return False
76
+ if record["ok"] is True:
77
+ if record.get("from") != room or not isinstance(record.get("to"), str):
78
+ return False
79
+ room, moves = record["to"], moves + 1
80
+ return (room == expected["exit"] and moves == final.get("moves")
81
+ and 0 < moves <= expected["budget"])
82
+
83
+
84
+ def grade() -> bool:
85
+ expected = parse(read_own(EXPECTED))
86
+ final_data = read_own(os.path.join(EVIDENCE, "final.json"))
87
+ moves_data = read_own(os.path.join(EVIDENCE, "moves.jsonl"))
88
+ write_new("final.json", final_data)
89
+ write_new("moves.jsonl", moves_data)
90
+ final = parse(final_data)
91
+ records = [parse(line) for line in moves_data.splitlines() if line.strip()]
92
+ return (
93
+ isinstance(final, dict)
94
+ and final.get("exported_by") == "maze"
95
+ and final.get("tree_sha256") == expected["tree_sha256"]
96
+ and final.get("start") == expected["start"]
97
+ and final.get("budget") == expected["budget"]
98
+ and final.get("reached") is True
99
+ and final.get("room") == expected["exit"]
100
+ and walk_reaches_exit(final, records, expected)
101
+ )
102
+
103
+
104
+ os.makedirs(VERIFIER, exist_ok=True)
105
+ for name in ("reward.txt", "reward.json"):
106
+ try:
107
+ os.unlink(os.path.join(VERIFIER, name))
108
+ except FileNotFoundError:
109
+ pass
110
+ write_new("reward.txt", b"0")
111
+ try:
112
+ valid = grade()
113
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, a wrong shape
114
+ valid = False
115
+ if valid:
116
+ write_new("reward.txt", b"1")
117
+ print("reward:", 1 if valid else 0)
tasks/maze-t18/tests/test.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # s3-maze's verifier, in a fresh container built from this folder (environment_mode =
3
+ # "separate"): reward 1 if the maze service's own record shows the agent's walk reached the exit
4
+ # (grade.py has the rules). Reward 0 is written before anything is checked, so a crash of the
5
+ # check also scores 0. Python runs isolated (-I -S): no module from the working directory,
6
+ # PYTHON* variables or site hooks can change what it imports. Besides bash, python3 is the only
7
+ # command this script runs.
8
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
9
+ export EXPECTED=${EXPECTED:-$here/expected.json}
10
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
11
+ [ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
12
+ python3 -I -S "$here/grade.py" || true
tasks/maze-t19/environment/agent/Dockerfile ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The agent's container: only the `maze` command, which talks to the maze service. The tree and
3
+ # the exit are never here.
4
+ RUN apt-get update && apt-get install -y --no-install-recommends bash curl ca-certificates \
5
+ && rm -rf /var/lib/apt/lists/*
6
+ COPY maze /usr/local/bin/maze
7
+ RUN chmod 755 /usr/local/bin/maze
8
+ WORKDIR /app
tasks/maze-t19/environment/agent/maze ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """maze look | maze move ROOM: explore the maze through its service (standard library only).
3
+
4
+ Prints the service's JSON for your current room: `room`, its `doors`, whether it is the `exit`,
5
+ the room you `arrived_from` and your `moves_left` (a dead end adds a `notice`). A refused move
6
+ adds an `error` and exits 1; the service unreachable exits 2.
7
+ """
8
+
9
+ import json
10
+ import os
11
+ import sys
12
+ import time
13
+ import urllib.error
14
+ import urllib.request
15
+
16
+ URL = os.environ.get("MAZE_URL", "http://maze:8000").rstrip("/")
17
+ USAGE = "usage: maze look | maze move ROOM"
18
+
19
+
20
+ def call(request: urllib.request.Request) -> tuple[int, dict]:
21
+ deadline = time.monotonic() + 30 # the service may still be starting
22
+ while True:
23
+ try:
24
+ with urllib.request.urlopen(request, timeout=30) as response:
25
+ return response.status, json.load(response)
26
+ except urllib.error.HTTPError as e:
27
+ try:
28
+ return e.code, json.load(e)
29
+ except ValueError:
30
+ return e.code, {"error": f"HTTP {e.code} from the maze service"}
31
+ except (urllib.error.URLError, ConnectionError, TimeoutError) as e:
32
+ if time.monotonic() > deadline:
33
+ return 0, {"error": f"the maze service is unreachable: {e}"}
34
+ time.sleep(1)
35
+
36
+
37
+ def main(argv: list[str]) -> int:
38
+ if argv == ["look"]:
39
+ request = urllib.request.Request(URL + "/look")
40
+ elif len(argv) == 2 and argv[0] == "move":
41
+ request = urllib.request.Request(
42
+ URL + "/move", data=json.dumps({"room": argv[1]}).encode(), method="POST",
43
+ headers={"Content-Type": "application/json"})
44
+ else:
45
+ print(USAGE, file=sys.stderr)
46
+ return 2
47
+ status, body = call(request)
48
+ print(json.dumps(body))
49
+ return 0 if status == 200 else 1 if status in (400, 409) else 2
50
+
51
+
52
+ if __name__ == "__main__":
53
+ sys.exit(main(sys.argv[1:]))
tasks/maze-t19/environment/docker-compose.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # maze-t19: the agent's container (main) and its own maze service. The service holds
2
+ # the tree and answers only `maze look` and `maze move ROOM`, on a network only main reaches.
3
+ services:
4
+ main:
5
+ image: s3-maze-agent:7ecf229faaac
6
+ build:
7
+ context: ./agent
8
+ networks: [default, maze]
9
+ security_opt: [no-new-privileges:true]
10
+ depends_on: [maze]
11
+ maze:
12
+ image: s3-maze-service:maze-t19-57fafc0621f6
13
+ build:
14
+ context: ./maze
15
+ networks: [maze]
16
+ environment:
17
+ MAZE_AGENT: ${COMPOSE_PROJECT_NAME:-} # the Trial, for the move log
18
+ cap_drop: [ALL]
19
+ security_opt: [no-new-privileges:true]
20
+ pids_limit: 64
21
+ mem_limit: 256m
22
+ networks:
23
+ default: {} # main's way out (Flock replaces it with the agent's own network)
24
+ maze:
25
+ internal: true
tasks/maze-t19/environment/maze/Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f
2
+ # The maze service: the tree (private, never in the agent's container), the walk's state and
3
+ # move log, the success check and the collect hook. Standard library only.
4
+ COPY engine.py service.py success.py export.py /app/
5
+ COPY tree.json /private/tree.json
6
+ RUN mkdir -p /var/lib/maze /evidence && chmod 0700 /private /var/lib/maze
7
+ ENV MAZE_TREE=/private/tree.json MAZE_STATE_DIR=/var/lib/maze
8
+ WORKDIR /app
9
+ CMD ["python3", "-I", "-S", "-B", "/app/service.py"]