{"challengeId":"no-three-in-line","entry":"verifier.mjs","sha256":"f3651f67e02db27d7eacaa1779caec3c092292d19dc9f70ead51e316c27007eb","scoreDirection":"maximize","scoreLabel":"points","seedPolicy":{"mode":"fixed","testCount":1},"source":"// Frozen verifier for no-three-in-line. Self-contained (no imports). The instance\n// is the N x N integer grid below (N = 53) — fully specified by this single\n// constant, no external data. Place as many lattice points as possible so that NO\n// THREE of them are collinear; the score is the number of points placed. More wins.\n//\n// Collinearity is decided by the EXACT integer 2x2 orientation determinant of every\n// unordered triple: points P, Q, R are collinear iff\n//   (Qx - Px) * (Ry - Py) - (Qy - Py) * (Rx - Px) === 0.\n// Pure integer arithmetic — no floats, no Math.* — so the check is deterministic\n// and exactly replayable. seedPolicy \"fixed\".\n//\n// The maximum number of points on an n x n grid is at most 2n (each of the n rows,\n// and each of the n columns, can hold at most 2 points). That 2n bound is known to\n// be achievable for n up to ~46; for N = 53 placing all 2N = 106 is a genuine open\n// search, so this board is a real foothold toward the 2n frontier.\n\nconst N = 53;\n\nfunction gate(name, pass, detail) { return { name, pass, detail }; }\nfunction bad(name, detail) { return { ok: false, score: null, gates: [gate(name, false, detail)], behavior: {}, logs: [] }; }\n\nexport function verify(ctx) {\n  const sol = ctx && ctx.solution;\n  if (!sol || typeof sol !== 'object' || Array.isArray(sol)) {\n    return bad('structure', 'expected { points: [[x,y], ...] }');\n  }\n  const points = sol.points;\n  if (!Array.isArray(points)) {\n    return bad('structure', 'points must be an array of [x,y] integer pairs');\n  }\n  if (points.length === 0) {\n    return bad('structure', 'points is empty; place at least one point');\n  }\n  // Upper bound guard: at most 2N points can possibly be valid, so anything larger\n  // is malformed by construction (and we never want an unbounded triple scan).\n  if (points.length > 2 * N) {\n    return bad('count', `at most ${2 * N} points are possible on a ${N}x${N} grid; got ${points.length}`);\n  }\n\n  const seen = new Set();\n  for (let i = 0; i < points.length; i++) {\n    const pt = points[i];\n    if (!Array.isArray(pt) || pt.length !== 2) {\n      return bad('structure', `point ${i} must be a [x,y] pair`);\n    }\n    const x = pt[0];\n    const y = pt[1];\n    if (!Number.isInteger(x) || !Number.isInteger(y)) {\n      return bad('integrality', `point ${i} = [${String(x)},${String(y)}] must have integer coordinates`);\n    }\n    if (x < 0 || y < 0 || x >= N || y >= N) {\n      return bad('range', `point ${i} = [${x},${y}] is outside the ${N}x${N} grid (0..${N - 1})`);\n    }\n    const key = x * N + y;\n    if (seen.has(key)) {\n      return bad('distinct', `point ${i} = [${x},${y}] is a duplicate`);\n    }\n    seen.add(key);\n  }\n\n  // No three collinear: exact integer determinant over every unordered triple.\n  // P bounded by 2N = 106, so at most C(106,3) = 194580 triples — well under timeout.\n  const P = points.length;\n  for (let i = 0; i < P; i++) {\n    const ax = points[i][0], ay = points[i][1];\n    for (let j = i + 1; j < P; j++) {\n      const bx = points[j][0] - ax, by = points[j][1] - ay;\n      for (let k = j + 1; k < P; k++) {\n        const cx = points[k][0] - ax, cy = points[k][1] - ay;\n        if (bx * cy - by * cx === 0) {\n          return bad(\n            'no-three-collinear',\n            `points ${i}, ${j}, ${k} are collinear: [${ax},${ay}],[${points[j][0]},${points[j][1]}],[${points[k][0]},${points[k][1]}]`,\n          );\n        }\n      }\n    }\n  }\n\n  return {\n    ok: true,\n    score: P,\n    gates: [gate('no-three-in-line', true, `${P} distinct points, no three collinear (max possible ${2 * N})`)],\n    behavior: { points: P },\n    logs: [`points=${P}`],\n  };\n}\n"}