n cells with replacement, p ∝ 1/sqrt(seen+1); DONE excluded. Returns (key, CAPTURE) pairs that freeze the cell's snapshot/score/ trajectory AT SAMPLING TIME. The trajectory walk must use the capture, never the live cell: an earlier result in the same batch may replace
(self, n, rng)
| 215 | return max(c.score for k, c in self.cells.items() if k != DONE_KEY) |
| 216 | |
| 217 | def sample(self, n, rng): |
| 218 | """n cells with replacement, p ∝ 1/sqrt(seen+1); DONE excluded. |
| 219 | |
| 220 | Returns (key, CAPTURE) pairs that freeze the cell's snapshot/score/ |
| 221 | trajectory AT SAMPLING TIME. The trajectory walk must use the capture, |
| 222 | never the live cell: an earlier result in the same batch may replace |
| 223 | the cell, and stitching actions executed from the OLD state onto the |
| 224 | NEW prefix fabricates scores no single playthrough achieved |
| 225 | (2026-06-08 incident — caught by publish-time replay verification; |
| 226 | the official code ships these values inside the task for this reason).""" |
| 227 | keys = [k for k in self.cells if k != DONE_KEY] |
| 228 | w = np.array([1.0 / np.sqrt(self.cells[k].seen + 1.0) for k in keys]) |
| 229 | csum = np.cumsum(w) |
| 230 | picks = [] |
| 231 | for u in rng.random(n) * csum[-1]: |
| 232 | k = keys[min(int(np.searchsorted(csum, u)), len(keys) - 1)] |
| 233 | c = self.cells[k] |
| 234 | c.chosen += 1 |
| 235 | c.chosen_since_new += 1 |
| 236 | picks.append((k, {"snapshot": c.snapshot, "lives": c.lives, "score": c.score, |
| 237 | "traj_len": c.traj_len, "traj_last": c.traj_last})) |
| 238 | return picks |
| 239 | |
| 240 | def update_from_trajectory(self, chosen_key, capture, res, explog): |
| 241 | """Walk one exploration episode (master-side, serial): append to the |
no test coverage detected