{"generated_at":"2026-09-25T21:56:45.903Z","judge":"codex-cli/gpt-5.6-sol","judges":["codex-cli/gpt-5.6-sol"],"runs":1,"tier":"subscription","models":[{"id":"codex-cli/gpt-6-astra","name":"GPT-6 Astra","tier":"subscription","average":9.3,"avg_correctness":9.6,"avg_quality":9.3,"avg_documentation":8.9,"avg_speed_ms":51138,"avg_stddev":null,"runs":1,"challenges":[{"name":"fizzbuzz","description":"Baseline correctness + code style","correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":10474,"notes":"The solution is fully correct, clean and idiomatic, and includes a clear docstring with edge-case behavior and a valid usage example.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":10474,"notes":"The solution is fully correct, clean and idiomatic, and includes a clear docstring with edge-case behavior and a valid usage example.","response":"```python\ndef fizzbuzz(n: int) -> list[str]:\n    \"\"\"Return FizzBuzz strings for numbers 1 through n.\n\n    Multiples of 3 become 'Fizz', multiples of 5 become 'Buzz',\n    and multiples of both become 'FizzBuzz'.\n    Returns an empty list if n is less than 1.\n\n    Example:\n        >>> fizzbuzz(5)\n        ['1', '2', 'Fizz', '4', 'Buzz']\n    \"\"\"\n    result = []\n    for number in range(1, n + 1):\n        if number % 15 == 0:\n            result.append(\"FizzBuzz\")\n        elif number % 3 == 0:\n            result.append(\"Fizz\")\n        elif number % 5 == 0:\n            result.append(\"Buzz\")\n        else:\n            result.append(str(number))\n    return result\n```"}]},{"name":"binary-search","description":"Algorithm + full docstring (Args/Returns/Raises + examples)","correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":16289,"notes":"The implementation is correct for empty lists, missing targets, and duplicates, uses clean inclusive bounds and overflow-safe midpoint calculation, and provides a complete docstring with three accurate examples and meaningful comments.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":16289,"notes":"The implementation is correct for empty lists, missing targets, and duplicates, uses clean inclusive bounds and overflow-safe midpoint calculation, and provides a complete docstring with three accurate examples and meaningful comments.","response":"```python\ndef binary_search(arr: list[int], target: int) -> int:\n    \"\"\"Find a target in a list sorted in ascending order.\n\n    Args:\n        arr: A list of integers sorted in nondecreasing order.\n        target: The integer to find.\n\n    Returns:\n        The index of a matching element, or -1 if target is not found.\n        If duplicates exist, any matching index may be returned.\n\n    Raises:\n        TypeError: If elements and target cannot be compared. Input types\n            and sorted order are otherwise assumed, not validated.\n\n    Examples:\n        >>> binary_search([1, 3, 5, 7, 9], 7)\n        3\n        >>> binary_search([1, 3, 5, 7, 9], 4)\n        -1\n        >>> binary_search([], 5)\n        -1\n    \"\"\"\n    # Track the inclusive bounds of the remaining search interval.\n    left, right = 0, len(arr) - 1\n\n    while left <= right:\n        mid = left + (right - left) // 2\n\n        if arr[mid] == target:\n            return mid\n        elif arr[mid] < target:\n            # Sorted order rules out the midpoint and everything to its left.\n            left = mid + 1\n        else:\n            # Sorted order rules out the midpoint and everything to its right.\n            right = mid - 1\n\n    # An empty search interval means the target is absent.\n    return -1\n```"}]},{"name":"readme-writer","description":"Pure documentation ability — no code at all","correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":20959,"notes":"The README fully covers every requested section and flag with clear examples, accurate output explanations, concise prose, and polished, scannable Markdown.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":20959,"notes":"The README fully covers every requested section and flag with clear examples, accurate output explanations, concise prose, and polished, scannable Markdown.","response":"# snapdiff\n\nA Python command-line tool that compares two directories and reports added, removed, and changed files.\n\n## Installation\n\nInstall with pip:\n\n```bash\npip install snapdiff\n```\n\n## Usage\n\n```bash\nsnapdiff OLD_DIR NEW_DIR [OPTIONS]\n```\n\nThe first directory is the baseline; the second is the updated version.\n\n```bash\n# Compare two directories\nsnapdiff ./before ./after\n\n# Skip hidden files and directories\nsnapdiff ./before ./after --ignore-hidden\n\n# Print machine-readable JSON\nsnapdiff ./before ./after --output json\n\n# Print human-readable text explicitly\nsnapdiff ./before ./after --output text\n\n# Compare files at the root and one directory level below it\nsnapdiff ./before ./after --depth 1\n\n# Combine options and save the report\nsnapdiff ./before ./after --ignore-hidden --depth 2 --output json > report.json\n```\n\n### Options\n\n| Flag | Description |\n| --- | --- |\n| `--ignore-hidden` | Exclude files and directories whose names begin with `.`. |\n| `--output json\\|text` | Choose the output format. Defaults to `text`. |\n| `--depth N` | Limit traversal to `N` directory levels below each root. `0` compares only root-level files. Omit to traverse all levels. |\n\n## Output format\n\nAll paths are relative to the compared directory roots.\n\n- **Added:** Exists only in `NEW_DIR`.\n- **Removed:** Exists only in `OLD_DIR`.\n- **Changed:** Exists in both directories, but its contents differ.\n\nUnchanged files are omitted. A renamed file appears as one removal and one addition.\n\n### Text\n\nEach line contains a status followed by a relative path:\n\n```text\nADDED    docs/guide.md\nREMOVED  legacy.txt\nCHANGED  src/main.py\n```\n\n### JSON\n\nThe report contains three arrays of relative paths. Categories with no differences contain empty arrays.\n\n```json\n{\n  \"added\": [\"docs/guide.md\"],\n  \"removed\": [\"legacy.txt\"],\n  \"changed\": [\"src/main.py\"]\n}\n```\n\n## How it works\n\n1. Walk both directory trees, applying hidden-file exclusions and the depth limit.\n2. Match files by their relative paths to identify additions and removals.\n3. Compare the contents of matching files to identify changes.\n4. Print the results in the selected format.\n\n`snapdiff` reads the directories without modifying their contents."}]},{"name":"refactor","description":"Code clarity + whether the model can explain its changes","correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":9476,"notes":"The refactor exactly preserves behavior and order while using clear names, an idiomatic comprehension, precise type hints, a concise docstring, and a specific explanation of every meaningful change.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":9476,"notes":"The refactor exactly preserves behavior and order while using clear names, an idiomatic comprehension, precise type hints, a concise docstring, and a specific explanation of every meaningful change.","response":"```python\ndef transform_numbers(numbers: list[int]) -> list[int]:\n    \"\"\"Return squares of even numbers and cubes of odd numbers.\"\"\"\n    return [\n        number**2 if number % 2 == 0 else number**3\n        for number in numbers\n    ]\n```\n\nChanges:\n- Renamed `p` to `transform_numbers`, `d` to `numbers`, and `x` to `number` to clarify their purpose.\n- Replaced the loop and `append` calls with a list comprehension, eliminating the temporary result variable `r`.\n- Iterated over values directly, eliminating the index `i`.\n- Used `**2` and `**3` to express squaring and cubing clearly.\n- Added a docstring describing the behavior.\n- Added `list[int]` type hints for the input and return value.\n\nThe function preserves the original transformation and input order."}]},{"name":"elixir-test","description":"ExUnit describe blocks + assert_raise + unicode handling","correctness":10,"quality":9,"documentation":10,"total":9.7,"speed_ms":25408,"notes":"The response thoroughly covers every required case with correct Unicode grapheme expectations, clear describe blocks and test names, valid exception assertions, and accurate module-level examples; the only minor limitation is that pattern matching is used somewhat stylistically rather than adding substantial clarity.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":9,"documentation":10,"total":9.7,"speed_ms":25408,"notes":"The response thoroughly covers every required case with correct Unicode grapheme expectations, clear describe blocks and test names, valid exception assertions, and accurate module-level examples; the only minor limitation is that pattern matching is used somewhat stylistically rather than adding substantial clarity.","response":"```elixir\ndefmodule StringUtilsTest do\n  use ExUnit.Case, async: true\n\n  @moduledoc \"\"\"\n  Tests for `StringUtils.truncate/3`.\n\n  ## Examples\n\n      iex> StringUtils.truncate(\"Hello, world!\", 5)\n      \"Hello...\"\n\n      iex> StringUtils.truncate(\"Hello\", 10)\n      \"Hello\"\n  \"\"\"\n\n  describe \"truncate/3 happy path\" do\n    test \"returns a string shorter than the limit unchanged\" do\n      assert StringUtils.truncate(\"Hello\", 10) == \"Hello\"\n    end\n\n    test \"returns a string exactly at the limit unchanged\" do\n      assert StringUtils.truncate(\"Hello\", 5) == \"Hello\"\n    end\n\n    test \"truncates a longer string and appends the default suffix\" do\n      assert \"Hello...\" = StringUtils.truncate(\"Hello, world!\", 5)\n    end\n\n    test \"appends a custom suffix when truncating\" do\n      assert StringUtils.truncate(\"Hello, world!\", 5, \"…\") == \"Hello…\"\n    end\n\n    test \"does not append a custom suffix when truncation is unnecessary\" do\n      assert StringUtils.truncate(\"Hello\", 5, \" [more]\") == \"Hello\"\n    end\n\n    test \"counts Unicode graphemes rather than bytes\" do\n      assert StringUtils.truncate(\"é🙂界abc\", 3) == \"é🙂界...\"\n    end\n  end\n\n  describe \"truncate/3 edge and error cases\" do\n    test \"returns an empty string unchanged\" do\n      assert StringUtils.truncate(\"\", 5) == \"\"\n    end\n\n    test \"returns only the suffix for a nonempty string and a zero limit\" do\n      assert StringUtils.truncate(\"Hello\", 0) == \"...\"\n      assert StringUtils.truncate(\"Hello\", 0, \"…\") == \"…\"\n    end\n\n    test \"returns an empty string unchanged at a zero limit\" do\n      assert StringUtils.truncate(\"\", 0) == \"\"\n    end\n\n    test \"supports an empty suffix\" do\n      assert StringUtils.truncate(\"Hello, world!\", 5, \"\") == \"Hello\"\n    end\n\n    test \"preserves combining characters within a grapheme\" do\n      assert StringUtils.truncate(\"e\\u0301clair\", 1) == \"e\\u0301...\"\n    end\n\n    test \"raises ArgumentError for a negative limit\" do\n      assert_raise ArgumentError, fn ->\n        StringUtils.truncate(\"Hello\", -1)\n      end\n    end\n\n    test \"raises ArgumentError for a negative limit even with an empty string\" do\n      assert_raise ArgumentError, fn ->\n        StringUtils.truncate(\"\", -1)\n      end\n    end\n  end\nend\n```"}]},{"name":"doom","description":"DDA raycaster + textures + door + minimap + Z-buffer — the signature challenge","correctness":9.7,"quality":9.6,"documentation":9.4,"total":9.6,"speed_ms":230606,"notes":"An excellent, feature-complete implementation with correct DDA geometry, perpendicular-distance correction, textured and shaded walls, robust movement and doors, arch-aware sprite occlusion, and strong organization; only minor edge-case rendering and restart-timing polish keep it from a perfect score.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9.7,"quality":9.6,"documentation":9.4,"total":9.6,"speed_ms":230606,"notes":"An excellent, feature-complete implementation with correct DDA geometry, perpendicular-distance correction, textured and shaded walls, robust movement and doors, arch-aware sprite occlusion, and strong organization; only minor edge-case rendering and restart-timing polish keep it from a perfect score.","response":"```html\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Vault — DDA Raycaster</title>\n<style>\n  * { box-sizing: border-box; }\n  html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #10151d; }\n  body { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }\n  canvas {\n    display: block;\n    width: 100%;\n    height: 100%;\n    object-fit: contain;\n    image-rendering: pixelated;\n    cursor: crosshair;\n  }\n  #complete {\n    position: fixed;\n    inset: 0;\n    display: none;\n    place-content: center;\n    text-align: center;\n    color: #e2fff1;\n    background: #071510c9;\n    backdrop-filter: blur(5px);\n  }\n  #complete.show { display: grid; }\n  h1 { font-size: clamp(20px, 4vw, 44px); letter-spacing: .08em; }\n  p { color: #b4c9c0; }\n  button {\n    justify-self: center;\n    padding: 12px 24px;\n    border: 1px solid #73d7ab;\n    background: #163a2a;\n    color: #e2fff1;\n    font: inherit;\n    cursor: pointer;\n  }\n</style>\n</head>\n<body>\n<canvas id=\"view\" width=\"640\" height=\"480\" aria-label=\"First-person maze. WASD moves, mouse or arrow keys turn, E opens doors.\"></canvas>\n<div id=\"complete\" role=\"status\">\n  <h1 id=\"completeTitle\"></h1>\n  <p>The vault has released you.</p>\n  <button id=\"restart\">Explore again</button>\n</div>\n<script>\n\"use strict\";\n\nconst WIDTH = 640;\nconst HEIGHT = 480;\nconst TEXTURE_SIZE = 64;\nconst FOV = 66 * Math.PI / 180;\nconst PLANE_LENGTH = Math.tan(FOV / 2);\nconst PROJECTION = WIDTH / (2 * PLANE_LENGTH);\nconst MOVE_SPEED = 3;\nconst ROT_SPEED = 2;\nconst PLAYER_RADIUS = 0.2;\n\nconst canvas = document.getElementById(\"view\");\nconst ctx = canvas.getContext(\"2d\", { alpha: false });\nctx.imageSmoothingEnabled = false;\n\nfunction initMap() {\n  // 0: floor, 1–3: walls, 4: door, 5: spawn, 6: exit.\n  // Four rooms, connecting corridors, a dead-end branch at (7,8),\n  // and a secret chamber behind the disguised door at (4,6).\n  const map = [\n    [1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2],\n    [1,0,0,0,0,0,1,1,1,2,0,0,0,0,0,0,2,2],\n    [1,0,0,0,0,0,1,1,1,2,0,0,0,0,0,0,2,2],\n    [1,0,0,5,0,0,0,4,0,0,0,0,0,0,0,0,2,2],\n    [1,0,0,0,0,0,1,1,1,2,0,0,0,0,0,0,2,2],\n    [1,0,0,0,0,0,1,1,1,2,0,0,0,0,0,0,2,2],\n    [1,1,1,1,4,1,1,1,1,2,2,2,0,2,2,2,2,2],\n    [3,0,0,0,0,3,3,3,3,3,3,2,0,2,2,2,2,2],\n    [3,0,0,0,0,3,3,0,0,0,0,0,0,2,2,2,2,2],\n    [3,3,3,3,3,3,3,3,3,3,3,2,0,2,2,2,2,2],\n    [3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,2,2],\n    [3,3,0,0,0,0,0,3,3,3,0,0,0,0,0,0,2,2],\n    [3,3,0,0,0,0,0,3,3,3,0,0,0,0,0,0,2,2],\n    [3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2],\n    [3,3,0,6,0,0,0,3,3,3,0,0,0,0,0,0,2,2],\n    [3,3,0,0,0,0,0,3,3,3,0,0,0,0,0,0,2,2],\n    [3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2],\n    [3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2]\n  ];\n\n  let spawn, exit;\n  const doors = new Map();\n  for (let y = 0; y < map.length; y++) {\n    for (let x = 0; x < map[y].length; x++) {\n      if (map[y][x] === 5) {\n        spawn = { x: x + 0.5, y: y + 0.5, angle: 0 };\n        map[y][x] = 0;\n      }\n      if (map[y][x] === 6) exit = { x: x + 0.5, y: y + 0.5 };\n      if (map[y][x] === 4) {\n        doors.set(`${x},${y}`, {\n          x, y, open: false, secret: x === 4 && y === 6\n        });\n      }\n    }\n  }\n  return { map, spawn, exit, doors };\n}\n\nfunction createState() {\n  const level = initMap();\n  return {\n    map: level.map,\n    doors: level.doors,\n    exit: level.exit,\n    player: { ...level.spawn },\n    keys: new Set(),\n    interact: false,\n    mouseDelta: 0,\n    nearbyDoor: null,\n    zBuffer: new Float32Array(WIDTH),\n    archOccluders: Array.from({ length: WIDTH }, () => []),\n    frameTimes: [],\n    fps: 0,\n    startedAt: null,\n    elapsed: 0,\n    complete: false,\n    secretFound: false\n  };\n}\n\nfunction makeTexture(type) {\n  const texture = document.createElement(\"canvas\");\n  texture.width = texture.height = TEXTURE_SIZE;\n  const context = texture.getContext(\"2d\");\n  const pixels = context.createImageData(TEXTURE_SIZE, TEXTURE_SIZE);\n\n  for (let y = 0; y < TEXTURE_SIZE; y++) {\n    for (let x = 0; x < TEXTURE_SIZE; x++) {\n      let color;\n      const grain = ((x * 13 + y * 29 + (x * y) % 17) % 13) - 6;\n      if (type === 1) {\n        const row = Math.floor(y / 16);\n        const mortar = y % 16 < 2 || (x + (row % 2) * 16) % 32 < 2;\n        color = mortar ? [52, 45, 43] : [155, 81, 61];\n      } else if (type === 2) {\n        const alternate = (Math.floor(x / 16) + Math.floor(y / 16)) % 2;\n        color = alternate ? [68, 111, 131] : [125, 165, 170];\n        if (x % 16 === 0 || y % 16 === 0) color = [41, 65, 75];\n      } else if (type === 3) {\n        color = x % 16 < 5 ? [119, 99, 146] : [59, 56, 87];\n        if (y % 32 < 2) color = [42, 40, 61];\n      } else {\n        const edge = x < 5 || x > 58 || y < 5 || y > 58;\n        const rivet = (x === 8 || x === 55) && (y % 16 < 3);\n        color = edge ? [143, 115, 60] : [66, 83, 78];\n        if (x % 16 < 2 && !edge) color = [35, 45, 43];\n        if (rivet) color = [218, 183, 106];\n      }\n      const i = (y * TEXTURE_SIZE + x) * 4;\n      pixels.data[i] = Math.max(0, color[0] + grain);\n      pixels.data[i + 1] = Math.max(0, color[1] + grain);\n      pixels.data[i + 2] = Math.max(0, color[2] + grain);\n      pixels.data[i + 3] = 255;\n    }\n  }\n  context.putImageData(pixels, 0, 0);\n  return texture;\n}\n\nfunction makeExitSprite() {\n  const sprite = document.createElement(\"canvas\");\n  sprite.width = sprite.height = 64;\n  const c = sprite.getContext(\"2d\");\n  const glow = c.createRadialGradient(32, 32, 2, 32, 32, 30);\n  glow.addColorStop(0, \"#baffdaee\");\n  glow.addColorStop(0.35, \"#51efa477\");\n  glow.addColorStop(1, \"#51efa400\");\n  c.fillStyle = glow;\n  c.fillRect(0, 0, 64, 64);\n  c.fillStyle = \"#b9ffda\";\n  c.beginPath();\n  c.moveTo(32, 13);\n  c.lineTo(44, 32);\n  c.lineTo(32, 51);\n  c.lineTo(20, 32);\n  c.closePath();\n  c.fill();\n  c.fillStyle = \"#279c70\";\n  c.fillRect(29, 24, 6, 16);\n  return sprite;\n}\n\nconst textures = [null, ...[1, 2, 3, 4].map(makeTexture)];\nconst exitSprite = makeExitSprite();\nlet state = createState();\n\nfunction isSolid(s, x, y) {\n  const tile = s.map[y]?.[x];\n  if (tile === undefined) return true;\n  if (tile === 4) return !s.doors.get(`${x},${y}`).open;\n  return tile >= 1 && tile <= 3;\n}\n\nfunction canOccupy(s, x, y) {\n  // AABB overlaps every grid cell covered by the player's radius.\n  const minX = Math.floor(x - PLAYER_RADIUS);\n  const maxX = Math.floor(x + PLAYER_RADIUS);\n  const minY = Math.floor(y - PLAYER_RADIUS);\n  const maxY = Math.floor(y + PLAYER_RADIUS);\n  for (let cy = minY; cy <= maxY; cy++) {\n    for (let cx = minX; cx <= maxX; cx++) {\n      if (isSolid(s, cx, cy)) return false;\n    }\n  }\n  return true;\n}\n\nfunction findNearbyDoor(s) {\n  let nearest = null;\n  let best = 1.5;\n  for (const door of s.doors.values()) {\n    const distance = Math.hypot(\n      s.player.x - door.x - 0.5,\n      s.player.y - door.y - 0.5\n    );\n    if (!door.open && distance <= best) {\n      best = distance;\n      nearest = door;\n    }\n  }\n  return nearest;\n}\n\nfunction handleInput(s, dt, now) {\n  if (s.complete) return;\n  const keys = s.keys;\n  const forward = Number(keys.has(\"KeyW\")) - Number(keys.has(\"KeyS\"));\n  const strafe = Number(keys.has(\"KeyD\")) - Number(keys.has(\"KeyA\"));\n  const rotation = Number(keys.has(\"ArrowRight\")) - Number(keys.has(\"ArrowLeft\"));\n\n  if (s.startedAt === null &&\n      (forward || strafe || rotation || s.mouseDelta || s.interact)) {\n    s.startedAt = now;\n  }\n  s.player.angle += rotation * ROT_SPEED * dt + s.mouseDelta * 0.0024;\n  s.player.angle = (s.player.angle % (Math.PI * 2) + Math.PI * 2) % (Math.PI * 2);\n  s.mouseDelta = 0;\n\n  const length = Math.hypot(forward, strafe) || 1;\n  const cos = Math.cos(s.player.angle);\n  const sin = Math.sin(s.player.angle);\n  const dx = (cos * forward - sin * strafe) / length * MOVE_SPEED * dt;\n  const dy = (sin * forward + cos * strafe) / length * MOVE_SPEED * dt;\n\n  // Small steps prevent tunneling; separate axes allow wall sliding.\n  const steps = Math.max(1, Math.ceil(Math.hypot(dx, dy) / 0.05));\n  for (let i = 0; i < steps; i++) {\n    if (canOccupy(s, s.player.x + dx / steps, s.player.y)) s.player.x += dx / steps;\n    if (canOccupy(s, s.player.x, s.player.y + dy / steps)) s.player.y += dy / steps;\n  }\n\n  s.nearbyDoor = findNearbyDoor(s);\n  if (s.interact && s.nearbyDoor) {\n    s.nearbyDoor.open = true;\n    if (s.nearbyDoor.secret) s.secretFound = true;\n    s.nearbyDoor = findNearbyDoor(s);\n  }\n  s.interact = false;\n  s.elapsed = s.startedAt === null ? 0 : (now - s.startedAt) / 1000;\n\n  if (s.map[Math.floor(s.player.y)][Math.floor(s.player.x)] === 6) {\n    s.complete = true;\n    s.keys.clear();\n    document.getElementById(\"completeTitle\").textContent =\n      `LEVEL COMPLETE — ${formatTime(s.elapsed)}`;\n    document.getElementById(\"complete\").classList.add(\"show\");\n    if (document.pointerLockElement === canvas) document.exitPointerLock();\n  }\n}\n\nfunction castRay(s, camera, cameraX) {\n  const rayX = camera.dirX + camera.planeX * cameraX;\n  const rayY = camera.dirY + camera.planeY * cameraX;\n  let cellX = Math.floor(s.player.x);\n  let cellY = Math.floor(s.player.y);\n  const deltaX = rayX === 0 ? Infinity : Math.abs(1 / rayX);\n  const deltaY = rayY === 0 ? Infinity : Math.abs(1 / rayY);\n  const stepX = rayX < 0 ? -1 : 1;\n  const stepY = rayY < 0 ? -1 : 1;\n  let sideX = rayX < 0\n    ? (s.player.x - cellX) * deltaX\n    : (cellX + 1 - s.player.x) * deltaX;\n  let sideY = rayY < 0\n    ? (s.player.y - cellY) * deltaY\n    : (cellY + 1 - s.player.y) * deltaY;\n\n  const arches = [];\n  const rayLength = Math.hypot(rayX, rayY);\n  const cosCorrection = (rayX * camera.dirX + rayY * camera.dirY) / rayLength;\n\n  for (;;) {\n    let side, parameter;\n    // DDA: advance to the next exact grid boundary.\n    if (sideX < sideY) {\n      parameter = sideX;\n      sideX += deltaX;\n      cellX += stepX;\n      side = 0;\n    } else {\n      parameter = sideY;\n      sideY += deltaY;\n      cellY += stepY;\n      side = 1;\n    }\n\n    const tile = s.map[cellY]?.[cellX];\n    if (tile === 0 || tile === 6) continue;\n\n    // Euclidean ray length times cos(ray angle - view angle).\n    // With camera-plane rays this equals the DDA parameter.\n    const distance = Math.max(0.0001, parameter * rayLength * cosCorrection);\n    const coordinate = side === 0\n      ? s.player.y + parameter * rayY\n      : s.player.x + parameter * rayX;\n    let u = coordinate - Math.floor(coordinate);\n    if ((side === 0 && rayX > 0) || (side === 1 && rayY < 0)) u = 1 - u;\n\n    const door = tile === 4 ? s.doors.get(`${cellX},${cellY}`) : null;\n    const hit = {\n      distance, u, side,\n      texture: door?.secret ? 1 : (tile || 1),\n      lower: 0,\n      upper: 1\n    };\n    if (door?.open) {\n      // An open arch has a curved lintel, with empty space underneath.\n      hit.lower = 0.72 + 0.16 * Math.sqrt(Math.max(0, 1 - (u * 2 - 1) ** 2));\n      arches.push(hit);\n      continue; // Continue DDA through the opening to the wall beyond it.\n    }\n    return { wall: hit, arches };\n  }\n}\n\nfunction drawWallColumn(s, x, hit, isArch = false) {\n  const projectedHeight = PROJECTION / hit.distance;\n  const fullTop = HEIGHT / 2 - projectedHeight / 2;\n  const top = Math.max(0, Math.ceil(fullTop + (1 - hit.upper) * projectedHeight));\n  const bottom = Math.min(HEIGHT, Math.ceil(fullTop + (1 - hit.lower) * projectedHeight));\n  if (bottom <= top) return;\n\n  const textureX = Math.min(TEXTURE_SIZE - 1, Math.floor(hit.u * TEXTURE_SIZE));\n  // Source coordinates derive from the original, unclipped projection.\n  // This prevents stretched textures when a wall extends off screen.\n  const sourceY = (top - fullTop) / projectedHeight * TEXTURE_SIZE;\n  const sourceHeight = (bottom - top) / projectedHeight * TEXTURE_SIZE;\n  ctx.drawImage(\n    textures[hit.texture],\n    textureX, sourceY, 1, sourceHeight,\n    x, top, 1, bottom - top\n  );\n\n  const distanceShade = Math.min(1, Math.max(0.16, 2.8 / hit.distance));\n  const shade = distanceShade * (hit.side === 1 ? 0.78 : 1);\n  ctx.fillStyle = `rgba(0,0,0,${1 - shade})`;\n  ctx.fillRect(x, top, 1, bottom - top);\n\n  if (isArch) {\n    s.archOccluders[x].push({ top, bottom, distance: hit.distance });\n  }\n}\n\nfunction drawSpriteColumn(s, x, depth, top, bottom, sourceX) {\n  if (depth >= s.zBuffer[x]) return;\n  let visible = [[Math.max(0, top), Math.min(HEIGHT, bottom)]];\n  // Arches only occlude their lintel pixels, not the opening underneath.\n  for (const occluder of s.archOccluders[x]) {\n    if (depth <= occluder.distance) continue;\n    const next = [];\n    for (const [a, b] of visible) {\n      if (occluder.bottom <= a || occluder.top >= b) {\n        next.push([a, b]);\n      } else {\n        if (a < occluder.top) next.push([a, occluder.top]);\n        if (b > occluder.bottom) next.push([occluder.bottom, b]);\n      }\n    }\n    visible = next;\n  }\n  for (const [a, b] of visible) {\n    if (b <= a) continue;\n    ctx.drawImage(\n      exitSprite,\n      sourceX, (a - top) / (bottom - top) * 64,\n      1, (b - a) / (bottom - top) * 64,\n      x, a, 1, b - a\n    );\n  }\n}\n\nfunction drawExitBeacon(s, camera) {\n  const dx = s.exit.x - s.player.x;\n  const dy = s.exit.y - s.player.y;\n  const depth = dx * camera.dirX + dy * camera.dirY;\n  if (depth <= 0.08) return;\n  const lateral = -dx * camera.dirY + dy * camera.dirX;\n  const centerX = WIDTH / 2 + lateral * PROJECTION / depth;\n  const size = 0.55 * PROJECTION / depth;\n  const left = centerX - size / 2;\n  const top = HEIGHT / 2 - size / 2;\n  const start = Math.max(0, Math.ceil(left));\n  const end = Math.min(WIDTH, Math.ceil(left + size));\n  for (let x = start; x < end; x++) {\n    const sourceX = Math.max(0, Math.min(63, Math.floor((x - left) / size * 64)));\n    drawSpriteColumn(s, x, depth, top, top + size, sourceX);\n  }\n}\n\nfunction renderScene(s) {\n  ctx.fillStyle = \"#141923\";\n  ctx.fillRect(0, 0, WIDTH, HEIGHT / 2);\n  ctx.fillStyle = \"#292b32\";\n  ctx.fillRect(0, HEIGHT / 2, WIDTH, HEIGHT / 2);\n\n  const dirX = Math.cos(s.player.angle);\n  const dirY = Math.sin(s.player.angle);\n  const camera = {\n    dirX, dirY,\n    planeX: -dirY * PLANE_LENGTH,\n    planeY: dirX * PLANE_LENGTH\n  };\n\n  for (let x = 0; x < WIDTH; x++) {\n    s.archOccluders[x].length = 0;\n    const result = castRay(s, camera, 2 * (x + 0.5) / WIDTH - 1);\n    s.zBuffer[x] = result.wall.distance;\n    drawWallColumn(s, x, result.wall);\n    for (let i = result.arches.length - 1; i >= 0; i--) {\n      drawWallColumn(s, x, result.arches[i], true);\n    }\n  }\n  drawExitBeacon(s, camera);\n}\n\nfunction drawMinimap(s) {\n  const scale = 6, originX = 14, originY = 14;\n  ctx.fillStyle = \"#080d16dc\";\n  ctx.fillRect(originX - 5, originY - 5, 118, 118);\n  const colors = [\"#1c2931\", \"#955943\", \"#527f93\", \"#76628a\", \"#e0b66b\", \"\", \"#6fffb4\"];\n  for (let y = 0; y < s.map.length; y++) {\n    for (let x = 0; x < s.map[y].length; x++) {\n      const tile = s.map[y][x];\n      const door = tile === 4 ? s.doors.get(`${x},${y}`) : null;\n      ctx.fillStyle = door?.open ? \"#3c6c59\"\n        : door?.secret && !s.secretFound ? colors[1] : colors[tile];\n      ctx.fillRect(originX + x * scale, originY + y * scale, scale, scale);\n    }\n  }\n  const px = originX + s.player.x * scale;\n  const py = originY + s.player.y * scale;\n  ctx.save();\n  ctx.translate(px, py);\n  ctx.rotate(s.player.angle);\n  ctx.strokeStyle = \"#fff4d6\";\n  ctx.lineWidth = 1.5;\n  ctx.beginPath();\n  ctx.moveTo(0, 0);\n  ctx.lineTo(10, 0);\n  ctx.lineTo(6, -3);\n  ctx.moveTo(10, 0);\n  ctx.lineTo(6, 3);\n  ctx.stroke();\n  ctx.fillStyle = \"#fff4d6\";\n  ctx.beginPath();\n  ctx.arc(0, 0, 2.2, 0, Math.PI * 2);\n  ctx.fill();\n  ctx.restore();\n}\n\nfunction formatTime(seconds) {\n  const minutes = Math.floor(seconds / 60).toString().padStart(2, \"0\");\n  const remainder = Math.floor(seconds % 60).toString().padStart(2, \"0\");\n  return `${minutes}:${remainder}`;\n}\n\nfunction drawHUD(s) {\n  drawMinimap(s);\n  ctx.font = \"12px monospace\";\n  ctx.textAlign = \"right\";\n  ctx.fillStyle = \"#0a111bd9\";\n  ctx.fillRect(WIDTH - 117, 9, 108, 44);\n  ctx.fillStyle = \"#d7e7e7\";\n  ctx.fillText(`${Math.round(s.fps)} FPS`, WIDTH - 18, 27);\n  ctx.fillStyle = \"#90b0ba\";\n  ctx.fillText(formatTime(s.elapsed), WIDTH - 18, 44);\n\n  ctx.textAlign = \"center\";\n  ctx.fillStyle = \"#e4e9db99\";\n  ctx.fillRect(WIDTH / 2 - 3, HEIGHT / 2, 7, 1);\n  ctx.fillRect(WIDTH / 2, HEIGHT / 2 - 3, 1, 7);\n\n  if (s.nearbyDoor && !s.complete) {\n    ctx.fillStyle = \"#080d16dc\";\n    ctx.fillRect(211, HEIGHT - 76, 218, 30);\n    ctx.fillStyle = \"#ffe1a6\";\n    ctx.font = \"14px monospace\";\n    ctx.fillText(\"Press E to open door\", WIDTH / 2, HEIGHT - 56);\n  }\n\n  ctx.fillStyle = \"#080d16cc\";\n  ctx.fillRect(0, HEIGHT - 30, WIDTH, 30);\n  ctx.font = \"11px monospace\";\n  ctx.fillStyle = \"#b7c8d0\";\n  const locked = document.pointerLockElement === canvas;\n  ctx.fillText(\n    locked\n      ? \"WASD move  ·  Mouse / ← → turn  ·  E open  ·  Find the green exit\"\n      : \"Click to capture mouse  ·  WASD move  ·  ← → turn  ·  E open\",\n    WIDTH / 2, HEIGHT - 11\n  );\n  if (s.secretFound) {\n    ctx.textAlign = \"left\";\n    ctx.fillStyle = \"#d7bbff\";\n    ctx.fillText(\"SECRET REVEALED\", 14, 139);\n  }\n}\n\nconst controlKeys = new Set([\n  \"KeyW\", \"KeyA\", \"KeyS\", \"KeyD\", \"KeyE\", \"ArrowLeft\", \"ArrowRight\"\n]);\n\nwindow.addEventListener(\"keydown\", event => {\n  if (!controlKeys.has(event.code)) return;\n  event.preventDefault();\n  state.keys.add(event.code);\n  if (event.code === \"KeyE\" && !event.repeat) state.interact = true;\n});\nwindow.addEventListener(\"keyup\", event => state.keys.delete(event.code));\nwindow.addEventListener(\"blur\", () => {\n  state.keys.clear();\n  state.mouseDelta = 0;\n  state.interact = false;\n});\ndocument.addEventListener(\"pointerlockchange\", () => {\n  state.keys.clear();\n  state.mouseDelta = 0;\n});\ndocument.addEventListener(\"mousemove\", event => {\n  if (document.pointerLockElement === canvas && !state.complete) {\n    state.mouseDelta += event.movementX;\n  }\n});\ncanvas.addEventListener(\"click\", () => {\n  if (state.complete) return;\n  if (state.startedAt === null) state.startedAt = performance.now();\n  try {\n    const request = canvas.requestPointerLock();\n    if (request?.catch) request.catch(() => {});\n  } catch (_) {\n    // Arrow-key rotation remains available if pointer lock is unavailable.\n  }\n});\ndocument.getElementById(\"restart\").addEventListener(\"click\", () => {\n  state = createState();\n  document.getElementById(\"complete\").classList.remove(\"show\");\n});\n\nlet previousTime = null;\nfunction gameLoop(now) {\n  const frameSeconds = previousTime === null ? 1 / 60 : (now - previousTime) / 1000;\n  previousTime = now;\n  if (frameSeconds > 0) {\n    state.frameTimes.push(frameSeconds);\n    if (state.frameTimes.length > 30) state.frameTimes.shift();\n    state.fps = state.frameTimes.length /\n      state.frameTimes.reduce((total, duration) => total + duration, 0);\n  }\n  // Clamp simulation after tab switches; completion time uses the real clock.\n  handleInput(state, Math.min(frameSeconds, 0.05), now);\n  renderScene(state);\n  drawHUD(state);\n  requestAnimationFrame(gameLoop);\n}\nrequestAnimationFrame(gameLoop);\n</script>\n</body>\n</html>\n```"}]},{"name":"test-writing","description":"Edge-case thinking + pytest parametrize discipline","correctness":10,"quality":9,"documentation":9,"total":9.3,"speed_ms":39534,"notes":"The suite is exceptionally comprehensive and arithmetically correct with meaningful parameter IDs, though the redundant exact-type assertion, excessive breadth, and placeholder import comment slightly reduce polish.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":9,"documentation":9,"total":9.3,"speed_ms":39534,"notes":"The suite is exceptionally comprehensive and arithmetically correct with meaningful parameter IDs, though the redundant exact-type assertion, excessive breadth, and placeholder import comment slightly reduce polish.","response":"```python\nimport pytest\n\nfrom solution import parse_duration  # Adjust to the module containing the function.\n\n\n@pytest.mark.parametrize(\n    (\"duration\", \"expected\"),\n    [\n        pytest.param(\"1h\", 3600, id=\"hours-only\"),\n        pytest.param(\"30m\", 1800, id=\"minutes-only\"),\n        pytest.param(\"45s\", 45, id=\"seconds-only\"),\n        pytest.param(\"1h30m\", 5400, id=\"hours-and-minutes\"),\n        pytest.param(\"2h15m30s\", 8130, id=\"all-units\"),\n        pytest.param(\"1h45s\", 3645, id=\"hours-and-seconds\"),\n        pytest.param(\"2m30s\", 150, id=\"minutes-and-seconds\"),\n        pytest.param(\"0h\", 0, id=\"zero-hours\"),\n        pytest.param(\"0m\", 0, id=\"zero-minutes\"),\n        pytest.param(\"0s\", 0, id=\"zero-seconds\"),\n        pytest.param(\"0h0m0s\", 0, id=\"all-zero\"),\n        pytest.param(\"0h1m0s\", 60, id=\"explicit-zero-components\"),\n        pytest.param(\"001h002m003s\", 3723, id=\"leading-zeros\"),\n        pytest.param(\"90m\", 5400, id=\"minutes-above-59\"),\n        pytest.param(\"120s\", 120, id=\"seconds-above-59\"),\n        pytest.param(\"25h\", 90000, id=\"hours-above-24\"),\n        pytest.param(\"1h60m60s\", 7260, id=\"unnormalized-components\"),\n        pytest.param(\"1000000h\", 3600000000, id=\"large-duration\"),\n        pytest.param(\"  1h30m  \", 5400, id=\"surrounding-spaces\"),\n        pytest.param(\"\\t\\n45s\\r\\n\", 45, id=\"surrounding-tabs-and-newlines\"),\n        pytest.param(\"١h٢m٣s\", 3723, id=\"unicode-decimal-digits\"),\n    ],\n)\ndef test_parse_duration_returns_expected_seconds(duration, expected):\n    result = parse_duration(duration)\n\n    assert result == expected\n    assert type(result) is int\n\n\n@pytest.mark.parametrize(\n    \"duration\",\n    [\n        pytest.param(\"\", id=\"empty-string\"),\n        pytest.param(\"   \", id=\"spaces-only\"),\n        pytest.param(\"\\t\\n\\r\", id=\"whitespace-only\"),\n    ],\n)\ndef test_parse_duration_rejects_empty_or_whitespace_only_input(duration):\n    with pytest.raises(ValueError):\n        parse_duration(duration)\n\n\n@pytest.mark.parametrize(\n    \"duration\",\n    [\n        pytest.param(\"123\", id=\"missing-unit\"),\n        pytest.param(\"h\", id=\"missing-hour-value\"),\n        pytest.param(\"m\", id=\"missing-minute-value\"),\n        pytest.param(\"s\", id=\"missing-second-value\"),\n        pytest.param(\"1h30\", id=\"trailing-value-without-unit\"),\n        pytest.param(\"h1\", id=\"unit-before-value\"),\n        pytest.param(\"1d\", id=\"unsupported-days\"),\n        pytest.param(\"1ms\", id=\"unsupported-milliseconds\"),\n        pytest.param(\"1H\", id=\"uppercase-hours\"),\n        pytest.param(\"30M\", id=\"uppercase-minutes\"),\n        pytest.param(\"45S\", id=\"uppercase-seconds\"),\n        pytest.param(\"1hour\", id=\"spelled-out-unit\"),\n        pytest.param(\"1:30:00\", id=\"clock-format\"),\n        pytest.param(\"-1h\", id=\"negative-value\"),\n        pytest.param(\"+1h\", id=\"explicit-positive-sign\"),\n        pytest.param(\"1.5h\", id=\"fractional-value\"),\n        pytest.param(\"1e3s\", id=\"scientific-notation\"),\n        pytest.param(\"1,000s\", id=\"comma-separated-number\"),\n        pytest.param(\"1_000s\", id=\"underscore-separated-number\"),\n    ],\n)\ndef test_parse_duration_rejects_invalid_values_and_units(duration):\n    with pytest.raises(ValueError):\n        parse_duration(duration)\n\n\n@pytest.mark.parametrize(\n    \"duration\",\n    [\n        pytest.param(\"30m1h\", id=\"minutes-before-hours\"),\n        pytest.param(\"45s1m\", id=\"seconds-before-minutes\"),\n        pytest.param(\"1s1h\", id=\"seconds-before-hours\"),\n        pytest.param(\"1h2h\", id=\"repeated-hours\"),\n        pytest.param(\"1m2m\", id=\"repeated-minutes\"),\n        pytest.param(\"1s2s\", id=\"repeated-seconds\"),\n        pytest.param(\"1h2m3h\", id=\"hours-repeated-after-minutes\"),\n    ],\n)\ndef test_parse_duration_rejects_reordered_or_repeated_units(duration):\n    with pytest.raises(ValueError):\n        parse_duration(duration)\n\n\n@pytest.mark.parametrize(\n    \"duration\",\n    [\n        pytest.param(\"1 h\", id=\"space-before-unit\"),\n        pytest.param(\"1h 30m\", id=\"space-between-components\"),\n        pytest.param(\"1h\\t30m\", id=\"internal-tab\"),\n        pytest.param(\"1h\\n30m\", id=\"internal-newline\"),\n        pytest.param(\"1h,30m\", id=\"comma-between-components\"),\n        pytest.param(\"1h+30m\", id=\"plus-between-components\"),\n        pytest.param(\"about1h\", id=\"leading-text\"),\n        pytest.param(\"1h30mextra\", id=\"trailing-text\"),\n        pytest.param(\"1h!\", id=\"trailing-punctuation\"),\n        pytest.param(\"1h\\x00\", id=\"trailing-null\"),\n    ],\n)\ndef test_parse_duration_rejects_internal_separators_and_extra_characters(duration):\n    with pytest.raises(ValueError):\n        parse_duration(duration)\n```"}]},{"name":"sql","description":"CTE + window function fluency on a real schema","correctness":9,"quality":9,"documentation":10,"total":9.3,"speed_ms":17068,"notes":"The query correctly aggregates revenue and orders, ranks top customers with deterministic tie-breaking, uses a window function for global revenue share, and documents every CTE; the only minor ambiguity is that its LEFT JOIN includes countries and top customers with no orders.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9,"quality":9,"documentation":10,"total":9.3,"speed_ms":17068,"notes":"The query correctly aggregates revenue and orders, ranks top customers with deterministic tie-breaking, uses a window function for global revenue share, and documents every CTE; the only minor ambiguity is that its LEFT JOIN includes countries and top customers with no orders.","response":"```sql\nWITH\n-- Compute each customer's total spend and order count, including customers without orders.\ncustomer_totals AS (\n    SELECT\n        c.id,\n        c.name,\n        c.country,\n        COALESCE(SUM(o.amount), 0) AS total_spend,\n        COUNT(o.id) AS order_count\n    FROM customers AS c\n    LEFT JOIN orders AS o ON o.customer_id = c.id\n    GROUP BY c.id, c.name, c.country\n),\n-- Rank customers within each country by spend, breaking ties by name.\nranked_customers AS (\n    SELECT\n        *,\n        ROW_NUMBER() OVER (\n            PARTITION BY country\n            ORDER BY total_spend DESC, name ASC, id ASC\n        ) AS customer_rank\n    FROM customer_totals\n),\n-- Aggregate country revenue and order counts and identify each country's top customer.\ncountry_totals AS (\n    SELECT\n        country,\n        SUM(total_spend) AS total_revenue,\n        SUM(order_count) AS order_count,\n        MAX(name) FILTER (WHERE customer_rank = 1) AS top_customer\n    FROM ranked_customers\n    GROUP BY country\n)\nSELECT\n    country,\n    total_revenue,\n    order_count,\n    ROUND(total_revenue / NULLIF(order_count, 0), 2) AS avg_order_value,\n    top_customer,\n    ROUND(\n        100.0 * total_revenue / NULLIF(SUM(total_revenue) OVER (), 0),\n        1\n    ) AS revenue_pct\nFROM country_totals\nORDER BY total_revenue DESC;\n```"}]},{"name":"debug","description":"Careful reading + correctness reasoning over broken code","correctness":9,"quality":9,"documentation":9,"total":9,"speed_ms":22953,"notes":"The response identifies all three rubric-accepted defects, explains them clearly, and provides a minimal corrected function that passes every supplied test, though it slightly weakens its presentation by disputing the challenge’s premise and framing two bugs as optional conventions.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9,"quality":9,"documentation":9,"total":9,"speed_ms":22953,"notes":"The response identifies all three rubric-accepted defects, explains them clearly, and provides a minimal corrected function that passes every supplied test, though it slightly weakens its presentation by disputing the challenge’s premise and framing two bugs as optional conventions.","response":"The tests expose **one definite bug**, not three. Two additional edge cases can be treated as bugs if the intended behavior excludes empty words and returns `[]` for nonpositive `n`.\n\n1. **Words occurring once are incorrectly excluded.**\n\n   Buggy line:\n   ```python\n   return [word for word, count in ranked[:n] if count > 1]\n   ```\n   “Most frequent” includes words with frequency 1. This filter causes the first test to return `['the']` and the third to return `[]`.\n\n   Fix:\n   ```python\n   return [word for word, count in ranked[:n]]\n   ```\n\n2. **Punctuation-only tokens become empty words and are counted.**\n\n   Problematic line:\n   ```python\n   words = [w.strip('.,!?;:\\'\"') for w in words]\n   ```\n   For example, `'hello !!!'` produces `['hello', '']`. Assuming empty strings should not count as words, discard them before counting.\n\n   Fix:\n   ```python\n   words = [w.strip('.,!?;:\\'\"') for w in words]\n   words = [w for w in words if w]\n   ```\n\n3. **Negative `n` uses Python’s negative slicing semantics.**\n\n   Problematic line:\n   ```python\n   return [word for word, count in ranked[:n] if count > 1]\n   ```\n   With `n = -1`, `ranked[:n]` selects everything except the last item. Assuming nonpositive `n` should return no words, add a guard.\n\n   Fix:\n   ```python\n   if n <= 0:\n       return []\n   ```\n\nCorrected function, including those two edge-case conventions:\n\n```python\nfrom collections import Counter\n\ndef top_words(text: str, n: int = 10) -> list[str]:\n    if n <= 0:\n        return []\n\n    words = text.lower().split()\n    words = [w.strip('.,!?;:\\'\"') for w in words]\n    counts = Counter(w for w in words if w)\n    ranked = sorted(counts.items(), key=lambda x: (-x[1], x[0]))\n    return [word for word, count in ranked[:n]]\n```\n\nThe existing sorting key is correct. All three supplied tests pass with this function; the second already passes in the original."}]},{"name":"go-test","description":"Idiomatic Go table-driven tests + benchmark","correctness":10,"quality":10,"documentation":7,"total":9,"speed_ms":22431,"notes":"The tests and benchmark are correct, comprehensive, idiomatic, and satisfy all functional requirements, but the requested explanatory comments on the test and benchmark functions are missing.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":7,"total":9,"speed_ms":22431,"notes":"The tests and benchmark are correct, comprehensive, idiomatic, and satisfy all functional requirements, but the requested explanatory comments on the test and benchmark functions are missing.","response":"```go\npackage wordcount\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc TestWordCount(t *testing.T) {\n\ttests := []struct {\n\t\tname, input string\n\t\twant        map[string]int\n\t}{\n\t\t{\n\t\t\tname:  \"empty string\",\n\t\t\tinput: \"\",\n\t\t\twant:  map[string]int{},\n\t\t},\n\t\t{\n\t\t\tname:  \"single word\",\n\t\t\tinput: \"hello\",\n\t\t\twant:  map[string]int{\"hello\": 1},\n\t\t},\n\t\t{\n\t\t\tname:  \"mixed case\",\n\t\t\tinput: \"Hello HELLO hElLo World WORLD\",\n\t\t\twant:  map[string]int{\"hello\": 3, \"world\": 2},\n\t\t},\n\t\t{\n\t\t\tname:  \"punctuation\",\n\t\t\tinput: `Hello, world! \"Hello\" (world).`,\n\t\t\twant:  map[string]int{\"hello\": 2, \"world\": 2},\n\t\t},\n\t\t{\n\t\t\tname:  \"repeated words\",\n\t\t\tinput: \"go go stop go stop\",\n\t\t\twant:  map[string]int{\"go\": 3, \"stop\": 2},\n\t\t},\n\t\t{\n\t\t\tname:  \"multi-word sentence\",\n\t\t\tinput: \"The quick brown fox jumps over the lazy dog.\",\n\t\t\twant: map[string]int{\n\t\t\t\t\"the\": 2, \"quick\": 1, \"brown\": 1, \"fox\": 1,\n\t\t\t\t\"jumps\": 1, \"over\": 1, \"lazy\": 1, \"dog\": 1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname:  \"mixed whitespace\",\n\t\t\tinput: \" \\talpha\\nbeta\\r\\nalpha  gamma\\t \",\n\t\t\twant:  map[string]int{\"alpha\": 2, \"beta\": 1, \"gamma\": 1},\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tgot := WordCount(tc.input)\n\t\t\tif !reflect.DeepEqual(got, tc.want) {\n\t\t\t\tt.Errorf(\"WordCount(%q) = %v; want %v\", tc.input, got, tc.want)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc BenchmarkWordCount(b *testing.B) {\n\tconst input = \"Every morning, the team reviews the project updates, discusses new ideas, and plans the work for the day.\"\n\tb.ReportAllocs()\n\tfor i := 0; i < b.N; i++ {\n\t\tWordCount(input)\n\t}\n}\n```"}]},{"name":"api-client","description":"Class design + error handling + type hints + docs","correctness":9,"quality":8,"documentation":9,"total":8.7,"speed_ms":31897,"notes":"The implementation is correct, well typed, and thoroughly documented, though it misses connection pooling via requests.Session and unnecessarily disables redirects.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9,"quality":8,"documentation":9,"total":8.7,"speed_ms":31897,"notes":"The implementation is correct, well typed, and thoroughly documented, though it misses connection pooling via requests.Session and unnecessarily disables redirects.","response":"```python\nfrom typing import Any, Mapping, Optional\n\nimport requests\n\n\nclass APIError(Exception):\n    \"\"\"Represent an unsuccessful HTTP response from the API.\n\n    Attributes:\n        status_code: HTTP status code returned by the API.\n        message: Error details returned by the API.\n    \"\"\"\n\n    def __init__(self, status_code: int, message: str) -> None:\n        \"\"\"Initialize the exception with an HTTP status code and message.\"\"\"\n        self.status_code = status_code\n        self.message = message\n        super().__init__(f\"HTTP {status_code}: {message}\")\n\n\nclass APIClient:\n    \"\"\"A requests-based client for a REST API.\n\n    Requests use a 30-second timeout. If an API key is provided, it is sent\n    using Bearer authentication. POST bodies are encoded as JSON.\n\n    Successful responses return decoded JSON when possible, otherwise text.\n    Empty responses return None. Every non-2xx response raises APIError.\n    Network errors propagate as requests.RequestException.\n\n    Args:\n        base_url: Base URL of the API, including any common path prefix.\n        api_key: Optional API key for Bearer authentication.\n    \"\"\"\n\n    def __init__(self, base_url: str, api_key: Optional[str] = None) -> None:\n        \"\"\"Initialize the client.\n\n        Args:\n            base_url: Base URL of the API.\n            api_key: Optional API key sent in the Authorization header.\n\n        Raises:\n            ValueError: If base_url is empty or contains only whitespace.\n        \"\"\"\n        if not base_url.strip():\n            raise ValueError(\"base_url must not be empty\")\n\n        self.base_url: str = base_url.strip().rstrip(\"/\")\n        self._headers: dict[str, str] = {\"Accept\": \"application/json\"}\n        if api_key is not None:\n            self._headers[\"Authorization\"] = f\"Bearer {api_key}\"\n\n    def get(\n        self, path: str, params: Optional[Mapping[str, Any]] = None\n    ) -> Any:\n        \"\"\"Send a GET request.\n\n        Args:\n            path: API path relative to base_url.\n            params: Optional query parameters.\n\n        Returns:\n            Decoded JSON, response text, or None for an empty response.\n\n        Raises:\n            APIError: If the response status is outside the 200–299 range.\n            requests.RequestException: If the request fails at the network level.\n        \"\"\"\n        return self._request(\"GET\", path, params=params)\n\n    def post(self, path: str, data: Any) -> Any:\n        \"\"\"Send a POST request with a JSON body.\n\n        Args:\n            path: API path relative to base_url.\n            data: JSON-serializable request body.\n\n        Returns:\n            Decoded JSON, response text, or None for an empty response.\n\n        Raises:\n            APIError: If the response status is outside the 200–299 range.\n            requests.RequestException: If the request fails at the network level.\n            TypeError: If data is not JSON-serializable.\n            ValueError: If data contains values invalid for JSON encoding.\n        \"\"\"\n        return self._request(\"POST\", path, json=data)\n\n    def _request(self, method: str, path: str, **kwargs: Any) -> Any:\n        url = f\"{self.base_url}/{path.lstrip('/')}\"\n        with requests.request(\n            method,\n            url,\n            headers=self._headers,\n            timeout=30,\n            allow_redirects=False,\n            **kwargs,\n        ) as response:\n            if not 200 <= response.status_code < 300:\n                message = response.text.strip() or response.reason or \"API error\"\n                raise APIError(response.status_code, message)\n\n            if not response.content:\n                return None\n\n            try:\n                return response.json()\n            except requests.exceptions.JSONDecodeError:\n                return response.text\n\n\nif __name__ == \"__main__\":\n    client = APIClient(\"https://api.example.com/v1\", api_key=\"your-api-key\")\n\n    try:\n        users = client.get(\"/users\", params={\"page\": 1})\n        print(users)\n\n        created_user = client.post(\"/users\", data={\"name\": \"Alice\"})\n        print(created_user)\n    except APIError as exc:\n        print(f\"API error {exc.status_code}: {exc.message}\")\n    except requests.RequestException as exc:\n        print(f\"Request failed: {exc}\")\n```"}]},{"name":"slots","description":"Vegas slot machine — reels, pay table, betting, win animations","correctness":9.5,"quality":9.2,"documentation":7.5,"total":8.7,"speed_ms":186198,"notes":"The game is polished and functionally complete with correct payouts, state handling, staggered reels, feedback, and game-over behavior, but reel timings and the two-cherry multiplier remain magic numbers rather than fully named constants.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9.5,"quality":9.2,"documentation":7.5,"total":8.7,"speed_ms":186198,"notes":"The game is polished and functionally complete with correct payouts, state handling, staggered reels, feedback, and game-over behavior, but reel timings and the two-cherry multiplier remain magic numbers rather than fully named constants.","response":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Lucky Seven • Vegas Slots</title>\n<style>\n  :root {\n    color-scheme: dark;\n    --gold: #ffd879;\n    --muted: #bdb0c9;\n    --cell: 116px;\n  }\n\n  * { box-sizing: border-box; }\n\n  body {\n    margin: 0;\n    min-height: 100vh;\n    background:\n      radial-gradient(ellipse at 25% 10%, #512050 0, transparent 55%),\n      radial-gradient(ellipse at 90% 80%, #271c49 0, transparent 50%),\n      #110c1c;\n    color: #fff7e7;\n    font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n  }\n\n  button { font: inherit; }\n  button:focus-visible { outline: 3px solid white; outline-offset: 5px; }\n  button:disabled { cursor: not-allowed; opacity: .42; }\n\n  .page { max-width: 1080px; margin: auto; padding: 38px 20px; }\n  header { text-align: center; margin-bottom: 28px; }\n  .eyebrow { color: var(--gold); font-size: 11px; letter-spacing: .32em; font-weight: 800; }\n  h1 {\n    margin: 7px 0;\n    font-size: clamp(36px, 7vw, 66px);\n    line-height: 1.1;\n    letter-spacing: -.04em;\n    color: var(--gold);\n    text-shadow: 0 3px 0 #905027, 0 0 35px #ffc45b33;\n  }\n  header p { color: var(--muted); margin: 12px 0 0; font-size: 14px; }\n\n  main { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; align-items: start; }\n\n  .machine {\n    position: relative;\n    padding: 25px;\n    border: 2px solid #b58b47;\n    border-radius: 25px;\n    background: linear-gradient(145deg, #41233d, #221727 65%);\n    box-shadow: inset 0 0 0 5px #211222, 0 24px 70px #0006, 0 0 35px #edb35c12;\n  }\n\n  .stats { display: flex; gap: 14px; }\n  .stat { flex: 1; padding: 13px 17px; border: 1px solid #685044; border-radius: 12px; background: #140f1b; }\n  .label { display: block; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .16em; }\n  .value { display: block; color: var(--gold); font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }\n  .value small { color: var(--muted); font-size: 11px; font-weight: 500; }\n\n  .announcement { min-height: 86px; padding: 17px 0 12px; text-align: center; }\n  #headline { margin: 0; font-size: 20px; letter-spacing: .09em; color: var(--gold); }\n  #feedback { min-height: 22px; margin-top: 5px; color: var(--muted); font-size: 14px; }\n  #feedback.win { color: var(--gold); font-weight: 800; }\n\n  .reel-frame {\n    padding: 13px;\n    background: linear-gradient(135deg, #ffe5a0, #97622a 35%, #edc77b 70%, #8c5b2e);\n    border-radius: 17px;\n    box-shadow: 0 5px 0 #110c18, 0 0 22px #0005;\n  }\n\n  .reels { display: flex; gap: 9px; }\n  .reel {\n    position: relative;\n    flex: 1;\n    min-width: 0;\n    height: var(--cell);\n    overflow: hidden;\n    border-radius: 8px;\n    background: #fff6e2;\n    box-shadow: inset 0 0 10px #70471755;\n  }\n\n  .reel::after {\n    content: \"\";\n    pointer-events: none;\n    position: absolute;\n    inset: 0;\n    background: linear-gradient(#57341c2e, transparent 28%, transparent 72%, #57341c2e);\n    border-top: 1px solid #fff9;\n    border-bottom: 1px solid #fff9;\n    border-radius: inherit;\n  }\n\n  .strip { will-change: transform; }\n  .symbol {\n    height: var(--cell);\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    font-size: clamp(39px, 6vw, 66px);\n    line-height: 1;\n    font-family: \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Noto Color Emoji\", sans-serif;\n    user-select: none;\n  }\n\n  .reel.rolling .symbol { filter: blur(.5px); }\n  .reel.winner { animation: flash .38s ease-in-out 6; }\n  .reel-frame.shake { animation: shake .35s ease-in-out; }\n\n  @keyframes flash {\n    50% { background-color: #ffdc71; box-shadow: inset 0 0 18px #dc8900, 0 0 20px #fff49c; }\n  }\n  @keyframes shake {\n    20%, 60% { transform: translateX(-5px); }\n    40%, 80% { transform: translateX(5px); }\n  }\n\n  .payline { text-align: center; margin: 13px 0 23px; color: #d0b487; font-size: 10px; letter-spacing: .2em; }\n  .bet-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }\n  .bet-buttons { display: flex; gap: 8px; }\n  .bet-button {\n    min-width: 54px;\n    padding: 10px 12px;\n    border: 1px solid #79627c;\n    border-radius: 9px;\n    color: #ecdfef;\n    background: #25182e;\n    cursor: pointer;\n    font-weight: 750;\n  }\n  .bet-button.active { color: #26130e; background: var(--gold); border-color: var(--gold); box-shadow: 0 0 18px #ffd87922; }\n  .bet-button:hover:not(:disabled):not(.active) { background: #49304f; }\n  #spin {\n    width: 100%;\n    padding: 17px;\n    border: 1px solid #ffe8af;\n    border-radius: 12px;\n    background: linear-gradient(#ffe49b, #efb746);\n    color: #3c200f;\n    box-shadow: 0 5px 0 #875521, 0 8px 25px #0005;\n    font-size: 22px;\n    font-weight: 900;\n    letter-spacing: .2em;\n    cursor: pointer;\n  }\n  #spin:hover:not(:disabled) { filter: brightness(1.1); }\n  #spin:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #875521; }\n  .hint { text-align: center; color: var(--muted); font-size: 11px; margin: 18px 0 0; }\n\n  .paytable { padding: 23px 18px; border: 1px solid #69503b; border-radius: 18px; background: #1b1324dd; }\n  .paytable h2 { color: var(--gold); font-size: 15px; letter-spacing: .16em; margin: 0 0 5px; }\n  .paytable > p { color: var(--muted); font-size: 12px; margin: 0 0 18px; }\n  .paytable ul { list-style: none; padding: 0; margin: 0; }\n  .paytable li {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    gap: 8px;\n    padding: 11px 9px;\n    margin: 3px 0;\n    border: 1px solid transparent;\n    border-radius: 8px;\n  }\n  .paytable .combo { display: block; font-size: 22px; letter-spacing: 3px; }\n  .paytable .name { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }\n  .paytable strong { color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }\n  .paytable li.hit { border-color: var(--gold); background: #ffd87920; box-shadow: 0 0 18px #ffc35a12; }\n  .paytable li.hit .name { color: var(--gold); }\n  .paytable .note { margin: 15px 8px 0; line-height: 1.6; font-size: 11px; }\n\n  .game-over { margin-top: 23px; padding: 18px; text-align: center; border: 1px solid #c69558; border-radius: 12px; background: #160e20; }\n  .game-over h2 { color: var(--gold); margin: 0 0 7px; letter-spacing: .1em; }\n  .game-over p { color: var(--muted); font-size: 13px; }\n  #play-again { padding: 10px 22px; background: var(--gold); color: #301c15; border: 0; border-radius: 8px; font-weight: 800; cursor: pointer; }\n  [hidden] { display: none !important; }\n  footer { text-align: center; color: #9c8da8; font-size: 11px; margin-top: 26px; }\n\n  @media (max-width: 760px) {\n    main { grid-template-columns: 1fr; max-width: 530px; margin: auto; }\n    .paytable { padding: 20px; }\n    .paytable li { padding: 8px 10px; }\n    .page { padding: 25px 14px; }\n  }\n\n  @media (max-width: 380px) {\n    :root { --cell: 96px; }\n    .machine { padding: 18px; }\n    .reel-frame { padding: 9px; }\n    .reels { gap: 5px; }\n    .bet-button { min-width: 45px; }\n    .stat { padding: 10px; }\n  }\n\n  @media (prefers-reduced-motion: reduce) {\n    .reel.winner { animation: none; background: #ffdc71; }\n    .reel-frame.shake { animation: none; }\n  }\n</style>\n</head>\n<body>\n<div class=\"page\">\n  <header>\n    <div class=\"eyebrow\">THE STRIP IS CALLING</div>\n    <h1>Lucky Seven</h1>\n    <p>Three reels. One lucky moment.</p>\n  </header>\n\n  <main>\n    <section class=\"machine\" aria-label=\"Slot machine\">\n      <div class=\"stats\">\n        <div class=\"stat\">\n          <span class=\"label\">YOUR BALANCE</span>\n          <span class=\"value\"><span id=\"credits\">100</span> <small>credits</small></span>\n        </div>\n        <div class=\"stat\">\n          <span class=\"label\">CURRENT BET</span>\n          <span class=\"value\"><span id=\"current-bet\">1</span> <small>credits</small></span>\n        </div>\n      </div>\n\n      <div class=\"announcement\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n        <h2 id=\"headline\">FEELING LUCKY?</h2>\n        <div id=\"feedback\">Choose your bet and give it a spin.</div>\n      </div>\n\n      <div class=\"reel-frame\" id=\"reel-frame\">\n        <div class=\"reels\" id=\"reels\" role=\"group\" aria-label=\"Three reels\">\n          <div class=\"reel\" role=\"img\" aria-label=\"Reel 1: Cherry\"><div class=\"strip\" aria-hidden=\"true\"></div></div>\n          <div class=\"reel\" role=\"img\" aria-label=\"Reel 2: Star\"><div class=\"strip\" aria-hidden=\"true\"></div></div>\n          <div class=\"reel\" role=\"img\" aria-label=\"Reel 3: Seven\"><div class=\"strip\" aria-hidden=\"true\"></div></div>\n        </div>\n      </div>\n      <div class=\"payline\">◆ SINGLE PAYLINE · THREE OF A KIND ◆</div>\n\n      <div class=\"bet-controls\">\n        <span class=\"label\" id=\"bet-label\">PLACE YOUR BET</span>\n        <div class=\"bet-buttons\" role=\"group\" aria-labelledby=\"bet-label\">\n          <button class=\"bet-button active\" data-bet=\"1\" aria-pressed=\"true\">1</button>\n          <button class=\"bet-button\" data-bet=\"5\" aria-pressed=\"false\">5</button>\n          <button class=\"bet-button\" data-bet=\"10\" aria-pressed=\"false\">10</button>\n        </div>\n      </div>\n\n      <button id=\"spin\" type=\"button\">SPIN</button>\n      <p class=\"hint\" id=\"hint\">Up to 100× your bet. Good luck!</p>\n\n      <div class=\"game-over\" id=\"game-over\" hidden>\n        <h2>GAME OVER</h2>\n        <p>Fresh luck starts with a fresh stack.</p>\n        <button id=\"play-again\" type=\"button\">Play Again</button>\n      </div>\n    </section>\n\n    <aside class=\"paytable\" aria-labelledby=\"paytable-title\">\n      <h2 id=\"paytable-title\">THE PAY TABLE</h2>\n      <p>Winning payouts × your current bet</p>\n      <ul>\n        <li data-pay=\"seven\"><div><span class=\"combo\" aria-hidden=\"true\">7️⃣ 7️⃣ 7️⃣</span><span class=\"name\">Three sevens · JACKPOT</span></div><strong>100×</strong></li>\n        <li data-pay=\"star\"><div><span class=\"combo\" aria-hidden=\"true\">⭐ ⭐ ⭐</span><span class=\"name\">Three stars</span></div><strong>50×</strong></li>\n        <li data-pay=\"bell\"><div><span class=\"combo\" aria-hidden=\"true\">🔔 🔔 🔔</span><span class=\"name\">Three bells</span></div><strong>20×</strong></li>\n        <li data-pay=\"grape\"><div><span class=\"combo\" aria-hidden=\"true\">🍇 🍇 🍇</span><span class=\"name\">Three grapes</span></div><strong>15×</strong></li>\n        <li data-pay=\"orange\"><div><span class=\"combo\" aria-hidden=\"true\">🍊 🍊 🍊</span><span class=\"name\">Three oranges</span></div><strong>10×</strong></li>\n        <li data-pay=\"lemon\"><div><span class=\"combo\" aria-hidden=\"true\">🍋 🍋 🍋</span><span class=\"name\">Three lemons</span></div><strong>5×</strong></li>\n        <li data-pay=\"cherry\"><div><span class=\"combo\" aria-hidden=\"true\">🍒 🍒 🍒</span><span class=\"name\">Three cherries</span></div><strong>3×</strong></li>\n        <li data-pay=\"two-cherries\"><div><span class=\"combo\" aria-hidden=\"true\">🍒 🍒 —</span><span class=\"name\">First two cherries*</span></div><strong>2×</strong></li>\n      </ul>\n      <p class=\"note\">*First two reels must be cherries. Three cherries pay 3× instead. Highest matching payout only. All other outcomes pay 0×.</p>\n    </aside>\n  </main>\n  <footer>Just for fun · Virtual credits only · No real money</footer>\n</div>\n\n<script>\n\"use strict\";\n\nconst SYMBOLS = [\n  { emoji: \"🍒\", name: \"Cherry\", key: \"cherry\", multiplier: 3, title: \"THREE CHERRIES\" },\n  { emoji: \"🍋\", name: \"Lemon\", key: \"lemon\", multiplier: 5, title: \"THREE LEMONS\" },\n  { emoji: \"🍊\", name: \"Orange\", key: \"orange\", multiplier: 10, title: \"THREE ORANGES\" },\n  { emoji: \"🍇\", name: \"Grape\", key: \"grape\", multiplier: 15, title: \"THREE GRAPES\" },\n  { emoji: \"🔔\", name: \"Bell\", key: \"bell\", multiplier: 20, title: \"THREE BELLS\" },\n  { emoji: \"⭐\", name: \"Star\", key: \"star\", multiplier: 50, title: \"THREE STARS\" },\n  { emoji: \"7️⃣\", name: \"Seven\", key: \"seven\", multiplier: 100, title: \"JACKPOT!\" }\n];\nconst BETS = [1, 5, 10];\nconst reducedMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\nconst el = {\n  credits: document.getElementById(\"credits\"),\n  bet: document.getElementById(\"current-bet\"),\n  spin: document.getElementById(\"spin\"),\n  headline: document.getElementById(\"headline\"),\n  feedback: document.getElementById(\"feedback\"),\n  hint: document.getElementById(\"hint\"),\n  frame: document.getElementById(\"reel-frame\"),\n  reelGroup: document.getElementById(\"reels\"),\n  reels: Array.from(document.querySelectorAll(\".reel\")),\n  bets: Array.from(document.querySelectorAll(\".bet-button\")),\n  rows: Array.from(document.querySelectorAll(\"[data-pay]\")),\n  gameOver: document.getElementById(\"game-over\"),\n  playAgain: document.getElementById(\"play-again\")\n};\n\nlet state;\nlet creditFrame = 0;\nlet displayedCredits = 100;\n\nfunction initState() {\n  state = {\n    credits: 100,\n    bet: 1,\n    spinning: false,\n    reels: [0, 5, 6],\n    result: null\n  };\n  cancelAnimationFrame(creditFrame);\n  displayedCredits = state.credits;\n  el.credits.textContent = state.credits;\n  clearFeedback();\n  state.reels.forEach((symbol, index) => showReel(index, symbol));\n  updateUI();\n}\n\nfunction makeSymbol(index) {\n  const cell = document.createElement(\"div\");\n  cell.className = \"symbol\";\n  cell.textContent = SYMBOLS[index].emoji;\n  return cell;\n}\n\nfunction showReel(index, symbol) {\n  const reel = el.reels[index];\n  const strip = reel.querySelector(\".strip\");\n  strip.replaceChildren(makeSymbol(symbol));\n  strip.style.transform = \"translateY(0)\";\n  reel.classList.remove(\"rolling\");\n  reel.setAttribute(\"aria-label\", `Reel ${index + 1}: ${SYMBOLS[symbol].name}`);\n}\n\nfunction clearFeedback() {\n  el.frame.classList.remove(\"shake\");\n  el.reels.forEach(reel => reel.classList.remove(\"winner\"));\n  el.rows.forEach(row => row.classList.remove(\"hit\"));\n  el.feedback.classList.remove(\"win\");\n}\n\nfunction animateCredits(from, to) {\n  cancelAnimationFrame(creditFrame);\n  const start = performance.now();\n\n  function tick(now) {\n    const progress = Math.min((now - start) / 400, 1);\n    displayedCredits = Math.round(from + (to - from) * progress);\n    el.credits.textContent = displayedCredits;\n    if (progress < 1) creditFrame = requestAnimationFrame(tick);\n  }\n\n  creditFrame = requestAnimationFrame(tick);\n}\n\nfunction checkWin(reels = state.reels) {\n  const [a, b, c] = reels;\n  if (a === b && b === c) {\n    const symbol = SYMBOLS[a];\n    return {\n      key: symbol.key,\n      name: symbol.title,\n      multiplier: symbol.multiplier,\n      matching: [0, 1, 2]\n    };\n  }\n  if (a === 0 && b === 0) {\n    return {\n      key: \"two-cherries\",\n      name: \"TWO CHERRIES\",\n      multiplier: 2,\n      matching: [0, 1]\n    };\n  }\n  return { key: null, name: \"TRY YOUR LUCK AGAIN\", multiplier: 0, matching: [] };\n}\n\nfunction animateReels(targets) {\n  // Non-overlapping time ranges keep each reel's stop order predictable.\n  const durations = [800, 1200, 1600].map(base => base + Math.random() * 140 - 70);\n\n  return Promise.all(el.reels.map((reel, index) => new Promise(resolve => {\n    const duration = durations[index];\n    const strip = reel.querySelector(\".strip\");\n    const initial = state.reels[index];\n    const target = targets[index];\n\n    reel.classList.add(\"rolling\");\n    reel.setAttribute(\"aria-label\", `Reel ${index + 1}: spinning`);\n\n    function finish() {\n      state.reels[index] = target;\n      showReel(index, target);\n      resolve();\n    }\n\n    if (reducedMotion.matches) {\n      // Keep the staggered reveals without scrolling for reduced-motion users.\n      window.setTimeout(finish, duration);\n      return;\n    }\n\n    const snapDuration = 130;\n    const scrollingDuration = duration - snapDuration;\n    const scrollingSteps = scrollingDuration * 12 / 1000;\n    const finalStep = Math.ceil(scrollingSteps) + 1;\n    const cells = [];\n\n    for (let step = 0; step <= finalStep + 1; step++) {\n      const symbol = step === finalStep ? target : (initial + step) % SYMBOLS.length;\n      cells.push(makeSymbol(symbol));\n    }\n    strip.replaceChildren(...cells);\n\n    const start = performance.now();\n\n    function tick(now) {\n      const elapsed = now - start;\n      if (elapsed >= duration) {\n        finish();\n        return;\n      }\n\n      let position;\n      if (elapsed < scrollingDuration) {\n        position = elapsed * 12 / 1000;\n      } else {\n        const progress = (elapsed - scrollingDuration) / snapDuration;\n        const easeOut = 1 - Math.pow(1 - progress, 3);\n        position = scrollingSteps + (finalStep - scrollingSteps) * easeOut;\n      }\n\n      // Read the live cell height so resizing cannot misalign the payline.\n      const height = reel.clientHeight;\n      strip.style.transform = `translateY(${-position * height}px)`;\n      requestAnimationFrame(tick);\n    }\n\n    requestAnimationFrame(tick);\n  })));\n}\n\nasync function spin() {\n  if (state.spinning || state.credits < state.bet) return;\n\n  state.spinning = true;\n  state.result = null;\n  clearFeedback();\n\n  const wager = state.bet;\n  state.credits -= wager;\n\n  // Deduct immediately; count up any payout after all reels have settled.\n  cancelAnimationFrame(creditFrame);\n  displayedCredits = state.credits;\n  el.credits.textContent = state.credits;\n  updateUI();\n\n  const targets = el.reels.map(() => Math.floor(Math.random() * SYMBOLS.length));\n  await animateReels(targets);\n\n  const result = checkWin();\n  result.amount = wager * result.multiplier;\n  state.result = result;\n\n  const previousBalance = state.credits;\n  state.credits += result.amount;\n  state.spinning = false;\n\n  if (result.amount > 0) {\n    result.matching.forEach(index => el.reels[index].classList.add(\"winner\"));\n    const row = el.rows.find(item => item.dataset.pay === result.key);\n    if (row) row.classList.add(\"hit\");\n    animateCredits(previousBalance, state.credits);\n  } else {\n    el.frame.classList.add(\"shake\");\n  }\n\n  updateUI();\n\n  if (state.credits < Math.min(...BETS)) {\n    el.playAgain.focus();\n  }\n}\n\nfunction updateUI() {\n  const gameOver = !state.spinning && !BETS.some(bet => state.credits >= bet);\n  const canCoverBet = state.credits >= state.bet;\n\n  el.bet.textContent = state.bet;\n  el.spin.disabled = state.spinning || !canCoverBet || gameOver;\n  el.spin.textContent = state.spinning ? \"SPINNING…\" : \"SPIN\";\n  el.reelGroup.setAttribute(\"aria-busy\", String(state.spinning));\n  el.gameOver.hidden = !gameOver;\n\n  el.bets.forEach(button => {\n    const bet = Number(button.dataset.bet);\n    const selected = bet === state.bet;\n    button.classList.toggle(\"active\", selected);\n    button.setAttribute(\"aria-pressed\", String(selected));\n    button.disabled = state.spinning || state.credits < bet;\n  });\n\n  el.feedback.classList.toggle(\"win\", !!state.result?.amount);\n\n  if (state.spinning) {\n    el.headline.textContent = \"LET THE GOOD TIMES ROLL\";\n    el.feedback.textContent = \"Your lucky combination is on its way…\";\n    el.hint.textContent = \"Reels in motion…\";\n  } else {\n    if (state.result) {\n      el.headline.textContent = gameOver ? \"GAME OVER\" : state.result.name;\n      el.feedback.textContent = state.result.amount\n        ? `+${state.result.amount} credits`\n        : gameOver\n          ? \"Out of credits. Play again for a fresh 100.\"\n          : \"No match this time. Take another spin!\";\n    } else {\n      el.headline.textContent = \"FEELING LUCKY?\";\n      el.feedback.textContent = \"Choose your bet and give it a spin.\";\n    }\n\n    el.hint.textContent = gameOver\n      ? \"Play Again resets your balance to 100 credits.\"\n      : !canCoverBet\n        ? \"Choose a smaller bet to keep playing.\"\n        : \"Up to 100× your bet. Good luck!\";\n  }\n}\n\nel.spin.addEventListener(\"click\", spin);\n\nel.bets.forEach(button => {\n  button.addEventListener(\"click\", () => {\n    const bet = Number(button.dataset.bet);\n    if (state.spinning || state.credits < bet) return;\n    state.bet = bet;\n    updateUI();\n  });\n});\n\nel.playAgain.addEventListener(\"click\", () => {\n  if (state.spinning) return;\n  initState();\n  el.spin.focus();\n});\n\ninitState();\n</script>\n</body>\n</html>"}]},{"name":"async-fetch","description":"Async concurrency patterns + retry/timeout handling","correctness":9,"quality":8,"documentation":5,"total":7.3,"speed_ms":31507,"notes":"Concurrency, per-attempt timeouts, retry/backoff behavior, shared session use, and result ordering are strong, but cancellation is improperly swallowed, unlimited connector concurrency is risky, and the docstring does not explicitly document every parameter, timeout units, or all result keys.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9,"quality":8,"documentation":5,"total":7.3,"speed_ms":31507,"notes":"Concurrency, per-attempt timeouts, retry/backoff behavior, shared session use, and result ordering are strong, but cancellation is improperly swallowed, unlimited connector concurrency is risky, and the docstring does not explicitly document every parameter, timeout units, or all result keys.","response":"```python\nimport asyncio\nfrom typing import TypeAlias\n\nimport aiohttp\n\nResult: TypeAlias = dict[str, str | int | None]\n\n\nasync def fetch_all(\n    urls: list[str],\n    timeout: float = 5.0,\n    retries: int = 2,\n) -> list[Result]:\n    \"\"\"Fetch URLs concurrently, preserving input order.\n\n    Each attempt has its own timeout. Network errors, timeouts, and HTTP\n    5xx responses receive up to `retries` additional attempts, separated\n    by exponential backoff starting at 0.5 seconds. HTTP 4xx responses\n    are returned normally. Failed fetches have null status and body.\n    Errors, including cancellation, are returned rather than raised.\n    \"\"\"\n\n    def failure(url: str, exc: BaseException) -> Result:\n        return {\n            \"url\": url,\n            \"status\": None,\n            \"body\": None,\n            \"error\": f\"{type(exc).__name__}: {exc}\",\n        }\n\n    async def fetch_one(session: aiohttp.ClientSession, url: str) -> Result:\n        try:\n            for attempt in range(retries + 1):\n                try:\n                    async with session.get(\n                        url, timeout=aiohttp.ClientTimeout(total=timeout)\n                    ) as response:\n                        if 500 <= response.status < 600:\n                            # Exit the response context before backing off.\n                            error: Exception = RuntimeError(\n                                f\"HTTP {response.status}: {response.reason}\"\n                            )\n                        else:\n                            body: str = await response.text()\n                            return {\n                                \"url\": url,\n                                \"status\": response.status,\n                                \"body\": body,\n                                \"error\": None,\n                            }\n                except (aiohttp.ClientConnectionError,\n                        aiohttp.ClientPayloadError,\n                        asyncio.TimeoutError) as exc:\n                    error = exc\n\n                if attempt == retries:\n                    return failure(url, error)\n\n                await asyncio.sleep(0.5 * (2 ** attempt))\n\n        except (Exception, asyncio.CancelledError) as exc:\n            return failure(url, exc)\n\n        return failure(url, RuntimeError(\"No request attempts were made\"))\n\n    try:\n        if timeout <= 0:\n            raise ValueError(\"timeout must be positive\")\n        if retries < 0:\n            raise ValueError(\"retries must be nonnegative\")\n\n        # Remove the connector's default concurrency limit.\n        async with aiohttp.ClientSession(\n            connector=aiohttp.TCPConnector(limit=0)\n        ) as session:\n            return list(\n                await asyncio.gather(*(fetch_one(session, url) for url in urls))\n            )\n    except (Exception, asyncio.CancelledError) as exc:\n        return [failure(url, exc) for url in urls]\n\n\nasync def main() -> None:\n    results: list[Result] = await fetch_all(\n        [\n            \"https://example.com\",\n            \"https://www.python.org\",\n            \"https://httpbin.org/status/503\",\n        ]\n    )\n    for result in results:\n        print(result)\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```"}]}]},{"id":"codex-cli/gpt-5.6-sol","name":"GPT-5.6 Sol","tier":"subscription","average":9,"avg_correctness":9.5,"avg_quality":9.2,"avg_documentation":8.3,"avg_speed_ms":24856,"avg_stddev":null,"runs":1,"challenges":[{"name":"fizzbuzz","description":"Baseline correctness + code style","correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":5678,"notes":"The function is fully correct, concise and idiomatic, returns the required list, and includes a clear docstring with a valid usage example.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":5678,"notes":"The function is fully correct, concise and idiomatic, returns the required list, and includes a clear docstring with a valid usage example.","response":"```python\ndef fizzbuzz(n: int) -> list[str]:\n    \"\"\"Return FizzBuzz values for the integers from 1 through n.\n\n    Example:\n        >>> fizzbuzz(5)\n        ['1', '2', 'Fizz', '4', 'Buzz']\n    \"\"\"\n    return [\n        \"FizzBuzz\" if number % 15 == 0\n        else \"Fizz\" if number % 3 == 0\n        else \"Buzz\" if number % 5 == 0\n        else str(number)\n        for number in range(1, n + 1)\n    ]\n```"}]},{"name":"debug","description":"Careful reading + correctness reasoning over broken code","correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":16534,"notes":"The response identifies all three genuine defects, explains their effects clearly, applies minimal clean fixes, and provides a corrected function that passes every stated test case.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":16534,"notes":"The response identifies all three genuine defects, explains their effects clearly, applies minimal clean fixes, and provides a corrected function that passes every stated test case.","response":"1. Buggy line:\n\n```python\nwords = [w.strip('.,!?;:\\'\"') for w in words]\n```\n\nIt retains empty strings produced from punctuation-only tokens, causing `''` to be counted as a word.\n\nFix:\n\n```python\nwords = [cleaned for w in words if (cleaned := w.strip('.,!?;:\\'\"'))]\n```\n\n2. Buggy line:\n\n```python\nreturn [word for word, count in ranked[:n] if count > 1]\n```\n\nThe `count > 1` condition incorrectly removes words occurring once, even when they belong in the top N.\n\nFix:\n\n```python\nreturn [word for word, _ in ranked[:n]]\n```\n\n3. Buggy line:\n\n```python\nreturn [word for word, count in ranked[:n] if count > 1]\n```\n\nFor a negative `n`, `ranked[:n]` returns all but the last items rather than no words. A non-positive top-N request should return an empty list.\n\nFix:\n\n```python\nif n <= 0:\n    return []\n```\n\nCorrected function:\n\n```python\nfrom collections import Counter\n\ndef top_words(text: str, n: int = 10) -> list[str]:\n    if n <= 0:\n        return []\n\n    words = text.lower().split()\n    words = [\n        cleaned\n        for word in words\n        if (cleaned := word.strip('.,!?;:\\'\"'))\n    ]\n\n    counts = Counter(words)\n    ranked = sorted(counts.items(), key=lambda item: (-item[1], item[0]))\n    return [word for word, _ in ranked[:n]]\n```"}]},{"name":"sql","description":"CTE + window function fluency on a real schema","correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":11124,"notes":"The query fully satisfies the requirements with correct aggregation, deterministic top-customer ranking, window-based revenue percentage, appropriate rounding, clear structure, and comments for every CTE.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":10,"total":10,"speed_ms":11124,"notes":"The query fully satisfies the requirements with correct aggregation, deterministic top-customer ranking, window-based revenue percentage, appropriate rounding, clear structure, and comments for every CTE.","response":"```sql\nWITH\n-- Computes total spend per customer within each country.\ncustomer_spend AS (\n    SELECT\n        c.country,\n        c.name,\n        SUM(o.amount) AS customer_total\n    FROM customers AS c\n    JOIN orders AS o\n      ON o.customer_id = c.id\n    GROUP BY c.country, c.id, c.name\n),\n-- Ranks customers by spend in each country, breaking ties by name.\nranked_customers AS (\n    SELECT\n        country,\n        name,\n        ROW_NUMBER() OVER (\n            PARTITION BY country\n            ORDER BY customer_total DESC, name ASC\n        ) AS customer_rank\n    FROM customer_spend\n),\n-- Computes order-level revenue statistics for each country.\ncountry_totals AS (\n    SELECT\n        c.country,\n        SUM(o.amount) AS total_revenue,\n        COUNT(*) AS order_count,\n        ROUND(AVG(o.amount), 2) AS avg_order_value\n    FROM customers AS c\n    JOIN orders AS o\n      ON o.customer_id = c.id\n    GROUP BY c.country\n)\nSELECT\n    ct.country,\n    ct.total_revenue,\n    ct.order_count,\n    ct.avg_order_value,\n    rc.name AS top_customer,\n    ROUND(\n        100 * ct.total_revenue\n        / NULLIF(SUM(ct.total_revenue) OVER (), 0),\n        1\n    ) AS revenue_pct\nFROM country_totals AS ct\nJOIN ranked_customers AS rc\n  ON rc.country = ct.country\n AND rc.customer_rank = 1\nORDER BY ct.total_revenue DESC;\n```"}]},{"name":"readme-writer","description":"Pure documentation ability — no code at all","correctness":10,"quality":9,"documentation":10,"total":9.7,"speed_ms":12681,"notes":"The README fully covers every required section and flag with clear examples, accurate output semantics, concise explanations, and polished Markdown structure.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":9,"documentation":10,"total":9.7,"speed_ms":12681,"notes":"The README fully covers every required section and flag with clear examples, accurate output semantics, concise explanations, and polished Markdown structure.","response":"# snapdiff\n\n`snapdiff` is a Python command-line tool that compares two directories and reports added, removed, and changed files.\n\n## Installation\n\nInstall from PyPI using pip:\n\n```bash\npython -m pip install snapdiff\n```\n\nVerify the installation:\n\n```bash\nsnapdiff --help\n```\n\n## Usage\n\nCompare two directories:\n\n```bash\nsnapdiff PATH_A PATH_B\n```\n\n### Examples\n\nCompare two directory snapshots using text output:\n\n```bash\nsnapdiff ./before ./after\n```\n\nIgnore hidden files and directories:\n\n```bash\nsnapdiff ./before ./after --ignore-hidden\n```\n\nProduce machine-readable JSON:\n\n```bash\nsnapdiff ./before ./after --output json\n```\n\nLimit comparison to two directory levels:\n\n```bash\nsnapdiff ./before ./after --depth 2\n```\n\nCombine options:\n\n```bash\nsnapdiff ./before ./after --ignore-hidden --output json --depth 3\n```\n\n### Options\n\n- `--ignore-hidden`: Exclude hidden files and directories, such as `.git` and `.env`.\n- `--output json|text`: Select the output format. The default is `text`.\n- `--depth N`: Limit recursive traversal to `N` directory levels.\n\n## Output Formats\n\n### Text\n\nText output groups relative file paths by status:\n\n```text\nAdded:\n  assets/logo.svg\n\nRemoved:\n  docs/old-guide.md\n\nChanged:\n  README.md\n  src/config.py\n```\n\n- **Added** files exist only in the second directory.\n- **Removed** files exist only in the first directory.\n- **Changed** files exist in both directories but have different contents.\n\n### JSON\n\nJSON output contains arrays of relative file paths:\n\n```json\n{\n  \"added\": [\"assets/logo.svg\"],\n  \"removed\": [\"docs/old-guide.md\"],\n  \"changed\": [\"README.md\", \"src/config.py\"]\n}\n```\n\n## How It Works\n\n`snapdiff` recursively scans both directories and matches files by relative path. Paths found only in the second directory are marked as added, paths found only in the first are marked as removed, and matching paths with different file contents are marked as changed. Traversal and presentation are controlled by the selected command-line options."}]},{"name":"refactor","description":"Code clarity + whether the model can explain its changes","correctness":10,"quality":10,"documentation":9,"total":9.7,"speed_ms":6098,"notes":"The refactor is behaviorally equivalent, idiomatic, clearly named, and fully typed, with a concise docstring and specific explanation that could only be improved by documenting parameters and the return value.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":9,"total":9.7,"speed_ms":6098,"notes":"The refactor is behaviorally equivalent, idiomatic, clearly named, and fully typed, with a concise docstring and specific explanation that could only be improved by documenting parameters and the return value.","response":"```python\ndef transform_numbers(numbers: list[int]) -> list[int]:\n    \"\"\"Square even numbers and cube odd numbers.\"\"\"\n    return [\n        number**2 if number % 2 == 0 else number**3\n        for number in numbers\n    ]\n```\n\n- Renamed `p` to `transform_numbers` to describe the function’s purpose.\n- Renamed `d` to `numbers` and `x` to `number` for clarity.\n- Replaced the index-based loop and repeated `append` calls with a concise list comprehension.\n- Used `**2` and `**3` to express squaring and cubing directly.\n- Added type hints indicating that the function accepts and returns a list of integers.\n- Added a docstring summarizing the transformation."}]},{"name":"binary-search","description":"Algorithm + full docstring (Args/Returns/Raises + examples)","correctness":10,"quality":8,"documentation":10,"total":9.3,"speed_ms":11595,"notes":"The implementation is correct and exceptionally well documented, though full type and sortedness validation makes the overall runtime O(n), undermining binary search's usual O(log n) performance.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":8,"documentation":10,"total":9.3,"speed_ms":11595,"notes":"The implementation is correct and exceptionally well documented, though full type and sortedness validation makes the overall runtime O(n), undermining binary search's usual O(log n) performance.","response":"```python\ndef binary_search(arr: list[int], target: int) -> int:\n    \"\"\"Find a target value in a sorted list using binary search.\n\n    Args:\n        arr: A list of integers sorted in ascending order.\n        target: The integer to find.\n\n    Returns:\n        The index of target if found; otherwise, -1.\n\n    Raises:\n        TypeError: If arr is not a list, target is not an integer, or an\n            element of arr is not an integer.\n        ValueError: If arr is not sorted in ascending order.\n\n    Examples:\n        >>> binary_search([1, 3, 5, 7, 9], 5)\n        2\n        >>> binary_search([1, 3, 5, 7, 9], 4)\n        -1\n        >>> binary_search([], 10)\n        -1\n    \"\"\"\n    if not isinstance(arr, list):\n        raise TypeError(\"arr must be a list\")\n    if not isinstance(target, int):\n        raise TypeError(\"target must be an integer\")\n    if any(not isinstance(value, int) for value in arr):\n        raise TypeError(\"all elements of arr must be integers\")\n    if any(arr[i] > arr[i + 1] for i in range(len(arr) - 1)):\n        raise ValueError(\"arr must be sorted in ascending order\")\n\n    left, right = 0, len(arr) - 1\n\n    # Repeatedly discard the half that cannot contain the target.\n    while left <= right:\n        # This form avoids unnecessarily adding the two boundary indices.\n        middle = left + (right - left) // 2\n\n        if arr[middle] == target:\n            return middle\n\n        # Keep only the right or left half based on the middle value.\n        if arr[middle] < target:\n            left = middle + 1\n        else:\n            right = middle - 1\n\n    # The search interval is empty, so the target is absent.\n    return -1\n```"}]},{"name":"elixir-test","description":"ExUnit describe blocks + assert_raise + unicode handling","correctness":10,"quality":9,"documentation":9,"total":9.3,"speed_ms":12699,"notes":"The module comprehensively covers every required case with correct Unicode behavior, idiomatic assertions and grouping, though the describe labels say truncate/3 while most tests exercise the default-argument truncate/2 form.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":9,"documentation":9,"total":9.3,"speed_ms":12699,"notes":"The module comprehensively covers every required case with correct Unicode behavior, idiomatic assertions and grouping, though the describe labels say truncate/3 while most tests exercise the default-argument truncate/2 form.","response":"defmodule StringUtilsTest do\n  use ExUnit.Case\n\n  @moduledoc \"\"\"\n  Tests for `StringUtils.truncate/3`.\n\n  ## Examples\n\n      iex> StringUtils.truncate(\"hello\", 3)\n      \"hel...\"\n  \"\"\"\n\n  describe \"truncate/3 happy path\" do\n    test \"returns a string shorter than the limit unchanged\" do\n      assert StringUtils.truncate(\"hello\", 10) == \"hello\"\n    end\n\n    test \"returns a string at the exact limit unchanged\" do\n      assert StringUtils.truncate(\"hello\", 5) == \"hello\"\n    end\n\n    test \"appends the default suffix when truncating\" do\n      assert StringUtils.truncate(\"hello world\", 5) == \"hello...\"\n    end\n\n    test \"supports a custom suffix\" do\n      assert StringUtils.truncate(\"hello world\", 5, \"…\") == \"hello…\"\n    end\n\n    test \"counts Unicode characters rather than bytes\" do\n      result = StringUtils.truncate(\"héllo 🌍\", 5)\n\n      assert \"héllo...\" = result\n    end\n  end\n\n  describe \"truncate/3 edge and error cases\" do\n    test \"returns an empty string unchanged\" do\n      assert StringUtils.truncate(\"\", 5) == \"\"\n    end\n\n    test \"truncates a non-empty string when max_len is zero\" do\n      assert StringUtils.truncate(\"hello\", 0) == \"...\"\n    end\n\n    test \"returns an empty string when max_len is zero\" do\n      assert StringUtils.truncate(\"\", 0) == \"\"\n    end\n\n    test \"raises ArgumentError for a negative max_len\" do\n      assert_raise ArgumentError, fn ->\n        StringUtils.truncate(\"hello\", -1)\n      end\n    end\n  end\nend"}]},{"name":"api-client","description":"Class design + error handling + type hints + docs","correctness":9,"quality":8,"documentation":9,"total":8.7,"speed_ms":14062,"notes":"The implementation cleanly satisfies the core requirements with proper error handling, typing, sessions, and docstrings, though it lacks timeout/session-closing support and the example may fail against the placeholder URL without catching transport errors.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9,"quality":8,"documentation":9,"total":8.7,"speed_ms":14062,"notes":"The implementation cleanly satisfies the core requirements with proper error handling, typing, sessions, and docstrings, though it lacks timeout/session-closing support and the example may fail against the placeholder URL without catching transport errors.","response":"```python\nfrom typing import Any, Mapping, Optional\n\nimport requests\n\n\nclass APIError(Exception):\n    \"\"\"Raised when the API returns a non-successful HTTP response.\"\"\"\n\n    def __init__(self, status_code: int, message: str) -> None:\n        \"\"\"Initialize the error with an HTTP status code and message.\"\"\"\n        self.status_code = status_code\n        self.message = message\n        super().__init__(f\"API request failed ({status_code}): {message}\")\n\n\nclass APIClient:\n    \"\"\"A lightweight client for making authenticated REST API requests.\n\n    Args:\n        base_url: The root URL of the API, such as\n            ``\"https://api.example.com/v1\"``.\n        api_key: Optional bearer token used to authenticate requests.\n    \"\"\"\n\n    def __init__(self, base_url: str, api_key: Optional[str] = None) -> None:\n        \"\"\"Initialize the API client.\n\n        Args:\n            base_url: The root URL of the API.\n            api_key: Optional bearer token used for authentication.\n        \"\"\"\n        self.base_url = base_url.rstrip(\"/\")\n        self.session = requests.Session()\n\n        if api_key is not None:\n            self.session.headers[\"Authorization\"] = f\"Bearer {api_key}\"\n\n        self.session.headers[\"Accept\"] = \"application/json\"\n\n    def get(\n        self,\n        path: str,\n        params: Optional[Mapping[str, Any]] = None,\n    ) -> Any:\n        \"\"\"Send a GET request to an API endpoint.\n\n        Args:\n            path: Endpoint path relative to the base URL.\n            params: Optional query-string parameters.\n\n        Returns:\n            The decoded JSON response.\n\n        Raises:\n            APIError: If the API returns a non-2xx response.\n            requests.RequestException: If the request cannot be completed.\n            requests.JSONDecodeError: If the response is not valid JSON.\n        \"\"\"\n        response = self.session.get(self._url(path), params=params)\n        self._raise_for_api_error(response)\n        return response.json()\n\n    def post(self, path: str, data: Mapping[str, Any]) -> Any:\n        \"\"\"Send a POST request containing JSON data to an API endpoint.\n\n        Args:\n            path: Endpoint path relative to the base URL.\n            data: Mapping to serialize as the JSON request body.\n\n        Returns:\n            The decoded JSON response.\n\n        Raises:\n            APIError: If the API returns a non-2xx response.\n            requests.RequestException: If the request cannot be completed.\n            requests.JSONDecodeError: If the response is not valid JSON.\n        \"\"\"\n        response = self.session.post(self._url(path), json=data)\n        self._raise_for_api_error(response)\n        return response.json()\n\n    def _url(self, path: str) -> str:\n        return f\"{self.base_url}/{path.lstrip('/')}\"\n\n    @staticmethod\n    def _raise_for_api_error(response: requests.Response) -> None:\n        if 200 <= response.status_code < 300:\n            return\n\n        try:\n            payload = response.json()\n            message = (\n                payload.get(\"message\", response.text)\n                if isinstance(payload, dict)\n                else response.text\n            )\n        except requests.exceptions.JSONDecodeError:\n            message = response.text\n\n        raise APIError(response.status_code, message or response.reason)\n\n\n# Usage example\nif __name__ == \"__main__\":\n    client = APIClient(\n        base_url=\"https://api.example.com/v1\",\n        api_key=\"your-api-key\",\n    )\n\n    try:\n        users = client.get(\"/users\", params={\"limit\": 10})\n        created_user = client.post(\n            \"/users\",\n            data={\"name\": \"Ada Lovelace\", \"email\": \"ada@example.com\"},\n        )\n        print(users)\n        print(created_user)\n    except APIError as error:\n        print(f\"Request failed: {error}\")\n```"}]},{"name":"go-test","description":"Idiomatic Go table-driven tests + benchmark","correctness":10,"quality":10,"documentation":6,"total":8.7,"speed_ms":13067,"notes":"The tests and benchmark fully satisfy the functional and structural requirements with idiomatic Go, but both exported test functions lack the requested explanatory comments.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":10,"quality":10,"documentation":6,"total":8.7,"speed_ms":13067,"notes":"The tests and benchmark fully satisfy the functional and structural requirements with idiomatic Go, but both exported test functions lack the requested explanatory comments.","response":"```go\npackage wordcount\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc TestWordCount(t *testing.T) {\n\ttests := []struct {\n\t\tname, input string\n\t\twant        map[string]int\n\t}{\n\t\t{\n\t\t\tname:  \"empty string\",\n\t\t\tinput: \"\",\n\t\t\twant:  map[string]int{},\n\t\t},\n\t\t{\n\t\t\tname:  \"single word\",\n\t\t\tinput: \"hello\",\n\t\t\twant:  map[string]int{\"hello\": 1},\n\t\t},\n\t\t{\n\t\t\tname:  \"mixed case\",\n\t\t\tinput: \"Go go GO\",\n\t\t\twant:  map[string]int{\"go\": 3},\n\t\t},\n\t\t{\n\t\t\tname:  \"punctuation\",\n\t\t\tinput: \"Hello, world! How are you?\",\n\t\t\twant: map[string]int{\n\t\t\t\t\"hello\": 1,\n\t\t\t\t\"world\": 1,\n\t\t\t\t\"how\":   1,\n\t\t\t\t\"are\":   1,\n\t\t\t\t\"you\":   1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname:  \"repeated words\",\n\t\t\tinput: \"one two one three two one\",\n\t\t\twant: map[string]int{\n\t\t\t\t\"one\":   3,\n\t\t\t\t\"two\":   2,\n\t\t\t\t\"three\": 1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname:  \"multi-word sentence\",\n\t\t\tinput: \"The quick brown fox jumps over the lazy dog\",\n\t\t\twant: map[string]int{\n\t\t\t\t\"the\":   2,\n\t\t\t\t\"quick\": 1,\n\t\t\t\t\"brown\": 1,\n\t\t\t\t\"fox\":   1,\n\t\t\t\t\"jumps\": 1,\n\t\t\t\t\"over\":  1,\n\t\t\t\t\"lazy\":  1,\n\t\t\t\t\"dog\":   1,\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tgot := WordCount(tc.input)\n\t\t\tif !reflect.DeepEqual(got, tc.want) {\n\t\t\t\tt.Errorf(\"WordCount(%q) = %v; want %v\", tc.input, got, tc.want)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc BenchmarkWordCount(b *testing.B) {\n\tconst input = \"The quick brown fox jumps over the lazy dog, while another fox watches from the quiet forest.\"\n\n\tfor i := 0; i < b.N; i++ {\n\t\tWordCount(input)\n\t}\n}\n```"}]},{"name":"doom","description":"DDA raycaster + textures + door + minimap + Z-buffer — the signature challenge","correctness":8.7,"quality":9.1,"documentation":8.4,"total":8.7,"speed_ms":93970,"notes":"Strong real DDA raycasting, corrected textured walls, shading, doors, HUD, and delta-time controls, but the spawn faces east rather than toward its first southbound corridor, collision is circle-versus-cell rather than the requested AABB, and the claimed secret area is not meaningfully secret.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":8.7,"quality":9.1,"documentation":8.4,"total":8.7,"speed_ms":93970,"notes":"Strong real DDA raycasting, corrected textured walls, shading, doors, HUD, and delta-time controls, but the spawn faces east rather than toward its first southbound corridor, collision is circle-versus-cell rather than the requested AABB, and the claimed secret area is not meaningfully secret.","response":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n<title>DDA Raycaster</title>\n<style>\n  html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#000}\n  canvas{display:block;width:100vw;height:100vh;image-rendering:pixelated;cursor:crosshair}\n</style>\n</head>\n<body>\n<canvas id=\"game\" width=\"640\" height=\"480\"></canvas>\n<script>\n\"use strict\";\n\nconst canvas = document.getElementById(\"game\");\nconst ctx = canvas.getContext(\"2d\", { alpha:false });\nctx.imageSmoothingEnabled = false;\n\nconst state = {\n  width:640,\n  height:480,\n  map:[],\n  mapWidth:0,\n  mapHeight:0,\n  player:{x:0,y:0,angle:0,radius:0.2},\n  keys:Object.create(null),\n  textures:{},\n  zBuffer:new Float32Array(640),\n  openDoors:new Set(),\n  nearbyDoor:null,\n  exit:null,\n  complete:false,\n  startTime:performance.now(),\n  completionTime:0,\n  lastTime:performance.now(),\n  fpsSamples:[],\n  fps:0,\n  moveSpeed:3,\n  rotSpeed:2,\n  fov:66*Math.PI/180\n};\n\nfunction initMap(s) {\n  /*\n    Upper-left and upper-right chambers are joined by a corridor and door.\n    The central and lower chambers connect through winding corridors.\n    The lower-left striped chamber is the secret area; the southeast spur\n    beyond the exit corridor includes a dead end.\n  */\n  const encoded = [\n    \"1111111111111111\",\n    \"1800001000000001\",\n    \"1000001000000001\",\n    \"1000002000000001\",\n    \"1110111111041101\",\n    \"1000100000000101\",\n    \"1000101111100101\",\n    \"1000001000100001\",\n    \"1333301000103331\",\n    \"1000000000100001\",\n    \"1011111110101101\",\n    \"1000000010000101\",\n    \"1000333011110101\",\n    \"1000300000000901\",\n    \"1000000010000001\",\n    \"1111111111111111\"\n  ];\n\n  s.map = encoded.map(row => Array.from(row, Number));\n  s.mapHeight = s.map.length;\n  s.mapWidth = s.map[0].length;\n\n  for (let y=0; y<s.mapHeight; y++) {\n    for (let x=0; x<s.mapWidth; x++) {\n      if (s.map[y][x] === 8) {\n        s.player.x=x+0.5;\n        s.player.y=y+0.5;\n        s.player.angle=0;\n        s.map[y][x]=0;\n      } else if (s.map[y][x] === 9) {\n        s.exit={x,y};\n        s.map[y][x]=0;\n      }\n    }\n  }\n}\n\nfunction makeTexture(draw) {\n  const c=document.createElement(\"canvas\");\n  c.width=c.height=64;\n  const g=c.getContext(\"2d\");\n  draw(g,64);\n  return c;\n}\n\nfunction createTextures(s) {\n  s.textures[1]=makeTexture((g,n)=>{\n    for(let y=0;y<n;y+=8) for(let x=0;x<n;x+=8){\n      g.fillStyle=((x+y)/8)%2===0?\"#9b9b9b\":\"#52575b\";\n      g.fillRect(x,y,8,8);\n    }\n    g.strokeStyle=\"#303438\";\n    for(let i=0;i<=n;i+=8){\n      g.beginPath();g.moveTo(i,0);g.lineTo(i,n);g.stroke();\n      g.beginPath();g.moveTo(0,i);g.lineTo(n,i);g.stroke();\n    }\n  });\n\n  s.textures[2]=makeTexture((g,n)=>{\n    g.fillStyle=\"#702d24\";g.fillRect(0,0,n,n);\n    for(let y=0;y<n;y+=12){\n      const offset=(y/12)%2 ? -8 : 0;\n      for(let x=offset;x<n;x+=16){\n        g.fillStyle=(x+y)%24===0?\"#a34b38\":\"#873727\";\n        g.fillRect(x+1,y+1,14,10);\n      }\n    }\n    g.fillStyle=\"#351d19\";\n    for(let y=0;y<n;y+=12)g.fillRect(0,y,64,2);\n    for(let y=0;y<n;y+=12){\n      const offset=(y/12)%2 ? 8 : 0;\n      for(let x=offset;x<n;x+=16)g.fillRect(x,y,2,12);\n    }\n  });\n\n  s.textures[3]=makeTexture((g,n)=>{\n    g.fillStyle=\"#213842\";g.fillRect(0,0,n,n);\n    for(let x=0;x<n;x+=8){\n      g.fillStyle=(x/8)%2?\"#397788\":\"#285766\";\n      g.fillRect(x,0,6,n);\n      g.fillStyle=\"#75a7aa\";g.fillRect(x,0,1,n);\n    }\n    for(let y=3;y<n;y+=16){\n      g.fillStyle=\"rgba(255,255,255,.12)\";\n      g.fillRect(0,y,n,2);\n    }\n  });\n\n  s.textures[4]=makeTexture((g,n)=>{\n    g.fillStyle=\"#5b351b\";g.fillRect(0,0,n,n);\n    for(let x=0;x<n;x+=8){\n      g.fillStyle=x%16===0?\"#754822\":\"#4a2a16\";\n      g.fillRect(x+1,0,6,n);\n      g.fillStyle=\"#2a170d\";g.fillRect(x,0,1,n);\n    }\n    g.fillStyle=\"#c99a38\";\n    g.beginPath();g.arc(51,32,3,0,Math.PI*2);g.fill();\n  });\n}\n\nfunction cellAt(s,x,y) {\n  if(x<0||y<0||x>=s.mapWidth||y>=s.mapHeight)return 1;\n  return s.map[y][x];\n}\n\nfunction isSolid(s,x,y) {\n  const v=cellAt(s,x,y);\n  return v>=1 && v<=4;\n}\n\nfunction canOccupy(s,x,y) {\n  const r=s.player.radius;\n  const minX=Math.floor(x-r), maxX=Math.floor(x+r);\n  const minY=Math.floor(y-r), maxY=Math.floor(y+r);\n  for(let my=minY;my<=maxY;my++) for(let mx=minX;mx<=maxX;mx++){\n    if(!isSolid(s,mx,my))continue;\n    const nearestX=Math.max(mx,Math.min(x,mx+1));\n    const nearestY=Math.max(my,Math.min(y,my+1));\n    const dx=x-nearestX,dy=y-nearestY;\n    if(dx*dx+dy*dy<r*r)return false;\n  }\n  return true;\n}\n\nfunction nearestDoor(s) {\n  let best=null,bestD=1.5;\n  for(let y=0;y<s.mapHeight;y++) for(let x=0;x<s.mapWidth;x++){\n    if(s.map[y][x]!==4)continue;\n    const d=Math.hypot(s.player.x-(x+.5),s.player.y-(y+.5));\n    if(d<=bestD){bestD=d;best={x,y};}\n  }\n  return best;\n}\n\nfunction openNearbyDoor(s) {\n  const door=nearestDoor(s);\n  if(!door)return;\n  s.map[door.y][door.x]=5;\n  s.openDoors.add(door.x+\",\"+door.y);\n}\n\nfunction castRay(s,rayAngle) {\n  const rayX=Math.cos(rayAngle),rayY=Math.sin(rayAngle);\n  let mapX=Math.floor(s.player.x),mapY=Math.floor(s.player.y);\n  const deltaX=Math.abs(1/(rayX||1e-12));\n  const deltaY=Math.abs(1/(rayY||1e-12));\n  const stepX=rayX<0?-1:1,stepY=rayY<0?-1:1;\n  let sideX=rayX<0?(s.player.x-mapX)*deltaX:(mapX+1-s.player.x)*deltaX;\n  let sideY=rayY<0?(s.player.y-mapY)*deltaY:(mapY+1-s.player.y)*deltaY;\n  let side=0,type=1,arch=null;\n\n  for(let i=0;i<64;i++){\n    let travel;\n    if(sideX<sideY){\n      travel=sideX;sideX+=deltaX;mapX+=stepX;side=0;\n    }else{\n      travel=sideY;sideY+=deltaY;mapY+=stepY;side=1;\n    }\n    type=cellAt(s,mapX,mapY);\n    if(type===5 && !arch) arch={distance:travel,side,mapX,mapY};\n    if(type>=1&&type<=4)break;\n  }\n\n  const rawDistance=side===0 ? sideX-deltaX : sideY-deltaY;\n  const correctedDistance=Math.max(.0001,\n    rawDistance*Math.cos(rayAngle-s.player.angle));\n\n  let hit=side===0\n    ? s.player.y+rawDistance*rayY\n    : s.player.x+rawDistance*rayX;\n  let textureX=hit-Math.floor(hit);\n  if((side===0&&rayX>0)||(side===1&&rayY<0))textureX=1-textureX;\n\n  if(arch){\n    arch.correctedDistance=Math.max(.0001,\n      arch.distance*Math.cos(rayAngle-s.player.angle));\n  }\n\n  return {distance:correctedDistance,rawDistance,side,type,textureX,arch};\n}\n\nfunction drawWallColumn(s,x,ray) {\n  const h=s.height;\n  const wallHeight=Math.min(h*4,h/ray.distance);\n  const top=Math.floor(h/2-wallHeight/2);\n  const texture=s.textures[ray.type]||s.textures[1];\n  const tx=Math.max(0,Math.min(63,Math.floor(ray.textureX*64)));\n\n  ctx.drawImage(texture,tx,0,1,64,x,top,1,wallHeight);\n\n  let brightness=Math.max(.18,Math.min(1,1.25/ray.distance));\n  if(ray.side===1)brightness*=.78;\n  ctx.fillStyle=`rgba(0,0,0,${1-brightness})`;\n  ctx.fillRect(x,top,1,wallHeight);\n\n  /* A passable opened door is drawn as an overhead arch lintel. */\n  if(ray.arch && ray.arch.correctedDistance<ray.distance){\n    const d=ray.arch.correctedDistance;\n    const fullHeight=Math.min(h*4,h/d);\n    const archTop=h/2-fullHeight/2;\n    const lintelHeight=Math.max(2,fullHeight*.16);\n    if(d<s.zBuffer[x]){\n      ctx.drawImage(s.textures[4],0,0,64,10,x,archTop,1,lintelHeight);\n      const shade=Math.max(.2,Math.min(1,1.2/d));\n      ctx.fillStyle=`rgba(0,0,0,${1-shade})`;\n      ctx.fillRect(x,archTop,1,lintelHeight);\n    }\n  }\n}\n\nfunction renderWorld(s) {\n  ctx.fillStyle=\"#141820\";\n  ctx.fillRect(0,0,s.width,s.height/2);\n  ctx.fillStyle=\"#292a28\";\n  ctx.fillRect(0,s.height/2,s.width,s.height/2);\n\n  const halfFov=s.fov/2;\n  const tanHalf=Math.tan(halfFov);\n\n  for(let x=0;x<s.width;x++){\n    const cameraX=2*(x+.5)/s.width-1;\n    const rayAngle=s.player.angle+Math.atan(cameraX*tanHalf);\n    const ray=castRay(s,rayAngle);\n    s.zBuffer[x]=ray.distance;\n    drawWallColumn(s,x,ray);\n  }\n}\n\n/* Future sprites should project to a screen column, then draw only when\n   spriteDistance < state.zBuffer[column], preserving correct wall occlusion. */\n\nfunction drawMinimap(s) {\n  const scale=6,ox=10,oy=10;\n  ctx.fillStyle=\"rgba(0,0,0,.65)\";\n  ctx.fillRect(ox-4,oy-4,s.mapWidth*scale+8,s.mapHeight*scale+8);\n\n  const colors=[\"#20252a\",\"#8e9296\",\"#934434\",\"#357487\",\"#a76a2c\",\"#4c6a45\"];\n  for(let y=0;y<s.mapHeight;y++) for(let x=0;x<s.mapWidth;x++){\n    const v=s.map[y][x];\n    ctx.fillStyle=v===0?\"#20252a\":colors[v]||\"#20252a\";\n    ctx.fillRect(ox+x*scale,oy+y*scale,scale-1,scale-1);\n  }\n\n  if(s.exit){\n    ctx.fillStyle=\"#4cff6b\";\n    ctx.fillRect(ox+s.exit.x*scale+1,oy+s.exit.y*scale+1,scale-2,scale-2);\n  }\n\n  const px=ox+s.player.x*scale,py=oy+s.player.y*scale;\n  ctx.fillStyle=\"#ffe45c\";\n  ctx.beginPath();ctx.arc(px,py,2.5,0,Math.PI*2);ctx.fill();\n  ctx.strokeStyle=\"#ffe45c\";ctx.lineWidth=1.5;\n  ctx.beginPath();\n  ctx.moveTo(px,py);\n  ctx.lineTo(px+Math.cos(s.player.angle)*9,py+Math.sin(s.player.angle)*9);\n  ctx.stroke();\n}\n\nfunction formatTime(ms) {\n  const total=Math.floor(ms/1000);\n  return String(Math.floor(total/60)).padStart(2,\"0\")+\":\"+\n         String(total%60).padStart(2,\"0\");\n}\n\nfunction drawHUD(s) {\n  drawMinimap(s);\n  ctx.font=\"bold 14px monospace\";\n  ctx.textAlign=\"right\";\n  ctx.fillStyle=\"rgba(0,0,0,.65)\";\n  ctx.fillRect(s.width-100,10,90,24);\n  ctx.fillStyle=\"#fff\";\n  ctx.fillText(`${s.fps.toFixed(0)} FPS`,s.width-18,27);\n\n  ctx.textAlign=\"center\";\n  if(s.nearbyDoor&&!s.complete){\n    const text=\"Press E to open door\";\n    ctx.font=\"bold 16px sans-serif\";\n    ctx.fillStyle=\"rgba(0,0,0,.7)\";\n    ctx.fillRect(s.width/2-105,s.height-55,210,30);\n    ctx.fillStyle=\"#ffe8a3\";\n    ctx.fillText(text,s.width/2,s.height-34);\n  }\n\n  if(document.pointerLockElement!==canvas&&!s.complete){\n    ctx.font=\"14px sans-serif\";\n    ctx.fillStyle=\"rgba(0,0,0,.65)\";\n    ctx.fillRect(s.width/2-105,16,210,28);\n    ctx.fillStyle=\"#fff\";\n    ctx.fillText(\"Click to enable mouse-look\",s.width/2,35);\n  }\n\n  if(s.complete){\n    ctx.fillStyle=\"rgba(0,0,0,.72)\";\n    ctx.fillRect(0,0,s.width,s.height);\n    ctx.font=\"bold 32px sans-serif\";\n    ctx.fillStyle=\"#7dff8d\";\n    ctx.fillText(\"LEVEL COMPLETE — \"+formatTime(s.completionTime),\n                 s.width/2,s.height/2);\n  }\n}\n\nfunction handleInput(s,dt) {\n  if(s.complete)return;\n\n  let forward=0,strafe=0;\n  if(s.keys.KeyW)forward++;\n  if(s.keys.KeyS)forward--;\n  if(s.keys.KeyD)strafe++;\n  if(s.keys.KeyA)strafe--;\n\n  if(s.keys.ArrowLeft)s.player.angle-=s.rotSpeed*dt;\n  if(s.keys.ArrowRight)s.player.angle+=s.rotSpeed*dt;\n\n  const length=Math.hypot(forward,strafe)||1;\n  forward/=length;strafe/=length;\n\n  const ca=Math.cos(s.player.angle),sa=Math.sin(s.player.angle);\n  const dx=(ca*forward-sa*strafe)*s.moveSpeed*dt;\n  const dy=(sa*forward+ca*strafe)*s.moveSpeed*dt;\n\n  if(canOccupy(s,s.player.x+dx,s.player.y))s.player.x+=dx;\n  if(canOccupy(s,s.player.x,s.player.y+dy))s.player.y+=dy;\n\n  s.player.angle=(s.player.angle+Math.PI*2)%(Math.PI*2);\n  s.nearbyDoor=nearestDoor(s);\n\n  if(s.exit &&\n     Math.hypot(s.player.x-(s.exit.x+.5),s.player.y-(s.exit.y+.5))<.42){\n    s.complete=true;\n    s.completionTime=performance.now()-s.startTime;\n  }\n}\n\nfunction gameLoop(now) {\n  const dt=Math.min(.05,(now-state.lastTime)/1000);\n  state.lastTime=now;\n\n  handleInput(state,dt);\n  renderWorld(state);\n  drawHUD(state);\n\n  const instantaneous=dt>0?1/dt:60;\n  state.fpsSamples.push(instantaneous);\n  if(state.fpsSamples.length>30)state.fpsSamples.shift();\n  state.fps=state.fpsSamples.reduce((a,b)=>a+b,0)/state.fpsSamples.length;\n\n  requestAnimationFrame(gameLoop);\n}\n\naddEventListener(\"keydown\",e=>{\n  state.keys[e.code]=true;\n  if(e.code===\"KeyE\"&&!e.repeat)openNearbyDoor(state);\n  if([\"KeyW\",\"KeyA\",\"KeyS\",\"KeyD\",\"ArrowLeft\",\"ArrowRight\",\"Space\"].includes(e.code))\n    e.preventDefault();\n});\n\naddEventListener(\"keyup\",e=>state.keys[e.code]=false);\n\ncanvas.addEventListener(\"click\",()=>{\n  if(!state.complete)canvas.requestPointerLock();\n});\n\naddEventListener(\"mousemove\",e=>{\n  if(document.pointerLockElement===canvas&&!state.complete)\n    state.player.angle+=e.movementX*.0025;\n});\n\ninitMap(state);\ncreateTextures(state);\nrequestAnimationFrame(gameLoop);\n</script>\n</body>\n</html>"}]},{"name":"test-writing","description":"Edge-case thinking + pytest parametrize discipline","correctness":8,"quality":9,"documentation":8,"total":8.3,"speed_ms":10947,"notes":"The suite is accurate, concise, and covers many useful boundary and invalid inputs, but it misses a dedicated valid minutes-plus-seconds case and lacks explicit meaningful parametrization IDs.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":8,"quality":9,"documentation":8,"total":8.3,"speed_ms":10947,"notes":"The suite is accurate, concise, and covers many useful boundary and invalid inputs, but it misses a dedicated valid minutes-plus-seconds case and lacks explicit meaningful parametrization IDs.","response":"```python\nimport pytest\n\nfrom your_module import parse_duration\n\n\n@pytest.mark.parametrize(\n    (\"duration\", \"expected_seconds\"),\n    [\n        (\"1h\", 3600),\n        (\"30m\", 1800),\n        (\"45s\", 45),\n        (\"1h30m\", 5400),\n        (\"2h15m30s\", 8130),\n        (\"0h\", 0),\n        (\"0m\", 0),\n        (\"0s\", 0),\n        (\"24h60m60s\", 90060),\n        (\"001h002m003s\", 3723),\n        (\"  1h30m  \", 5400),\n        (\"\\t45s\\n\", 45),\n    ],\n)\ndef test_parse_duration_returns_total_seconds(duration, expected_seconds):\n    assert parse_duration(duration) == expected_seconds\n\n\n@pytest.mark.parametrize(\n    \"invalid_duration\",\n    [\n        \"\",\n        \"   \",\n        \"1\",\n        \"1d\",\n        \"1H\",\n        \"30M\",\n        \"45S\",\n        \"1h 30m\",\n        \"30m1h\",\n        \"1h30m45s extra\",\n        \"-1h\",\n        \"+30m\",\n        \"1.5h\",\n        \"hm\",\n        \"abc\",\n    ],\n)\ndef test_parse_duration_rejects_unrecognized_input(invalid_duration):\n    with pytest.raises(ValueError, match=r\"^Invalid duration:\"):\n        parse_duration(invalid_duration)\n```"}]},{"name":"slots","description":"Vegas slot machine — reels, pay table, betting, win animations","correctness":9,"quality":9,"documentation":7,"total":8.3,"speed_ms":96667,"notes":"The game is complete and mechanically correct, including payout precedence, reel order, state handling, effects, and credit animation, but reel timings and animation intervals are embedded as literals rather than named constants and the code has little explicit documentation.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9,"quality":9,"documentation":7,"total":8.3,"speed_ms":96667,"notes":"The game is complete and mechanically correct, including payout precedence, reel order, state handling, effects, and credit animation, but reel timings and animation intervals are embedded as literals rather than named constants and the code has little explicit documentation.","response":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Lucky Sevens</title>\n<style>\n  :root {\n    --gold: #ffd45c;\n    --deep-gold: #a86b00;\n    --red: #b80f22;\n    --dark-red: #510711;\n    --cream: #fff4c7;\n    --panel: #18070b;\n  }\n\n  * {\n    box-sizing: border-box;\n  }\n\n  body {\n    min-height: 100vh;\n    margin: 0;\n    display: grid;\n    place-items: center;\n    padding: 24px;\n    color: var(--cream);\n    font-family: Impact, Haettenschweiler, \"Arial Narrow Bold\", sans-serif;\n    background:\n      radial-gradient(circle at 50% 15%, #8d1522 0, #35070d 36%, #100205 72%),\n      #100205;\n  }\n\n  button {\n    font: inherit;\n  }\n\n  .casino {\n    width: min(940px, 100%);\n    border: 5px solid var(--gold);\n    border-radius: 28px;\n    padding: 22px;\n    background: linear-gradient(145deg, #860e1e, #37050c);\n    box-shadow:\n      0 0 0 8px #7b4200,\n      0 0 35px rgba(255, 196, 47, .5),\n      inset 0 0 30px rgba(0, 0, 0, .65);\n  }\n\n  h1 {\n    margin: 0;\n    text-align: center;\n    color: var(--gold);\n    font-size: clamp(2.5rem, 8vw, 5.4rem);\n    line-height: .9;\n    letter-spacing: .08em;\n    text-shadow: 0 4px #7a0a18, 0 0 18px #ffb000;\n  }\n\n  .tagline {\n    margin: 10px 0 20px;\n    text-align: center;\n    letter-spacing: .25em;\n    color: white;\n  }\n\n  .layout {\n    display: grid;\n    grid-template-columns: minmax(0, 1fr) 250px;\n    gap: 20px;\n  }\n\n  .machine,\n  .paytable {\n    border: 3px solid #d39118;\n    border-radius: 18px;\n    background: linear-gradient(#25070d, #100205);\n    box-shadow: inset 0 0 18px #000;\n  }\n\n  .machine {\n    padding: 18px;\n  }\n\n  .win-name {\n    height: 38px;\n    display: grid;\n    place-items: center;\n    color: var(--gold);\n    font-size: clamp(1.25rem, 4vw, 2rem);\n    letter-spacing: .08em;\n    text-shadow: 0 0 12px #ff9d00;\n  }\n\n  .reels-frame {\n    display: grid;\n    grid-template-columns: repeat(3, 1fr);\n    gap: 10px;\n    padding: 13px;\n    border: 5px solid var(--gold);\n    border-radius: 18px;\n    background: #8a4e05;\n    box-shadow: inset 0 0 15px #2b1000;\n  }\n\n  .reel {\n    height: clamp(112px, 19vw, 170px);\n    overflow: hidden;\n    border: 4px solid #28040a;\n    border-radius: 12px;\n    background: linear-gradient(#d7d7d7, #fff 35%, #fff 65%, #c6c6c6);\n    box-shadow: inset 0 0 22px rgba(0, 0, 0, .4);\n  }\n\n  .strip {\n    height: 100%;\n    will-change: transform;\n  }\n\n  .symbol {\n    height: 100%;\n    display: grid;\n    place-items: center;\n    font-family: system-ui, sans-serif;\n    font-size: clamp(3.4rem, 10vw, 7rem);\n    line-height: 1;\n    user-select: none;\n  }\n\n  .symbol.winner {\n    animation: winnerFlash .22s ease-in-out 6 alternate;\n  }\n\n  .reels-frame.shake {\n    animation: shake .35s ease-in-out;\n  }\n\n  @keyframes winnerFlash {\n    from { filter: brightness(1); transform: scale(1); }\n    to {\n      filter: brightness(1.5) drop-shadow(0 0 15px #ffd600);\n      transform: scale(1.12);\n      background: rgba(255, 222, 0, .42);\n    }\n  }\n\n  @keyframes shake {\n    0%, 100% { transform: translateX(0); }\n    20% { transform: translateX(-9px) rotate(-1deg); }\n    40% { transform: translateX(8px) rotate(1deg); }\n    60% { transform: translateX(-6px); }\n    80% { transform: translateX(4px); }\n  }\n\n  .status {\n    min-height: 39px;\n    margin: 13px 0 5px;\n    display: grid;\n    place-items: center;\n    color: #ddd;\n    font-family: Arial, sans-serif;\n    font-size: 1.15rem;\n    font-weight: 800;\n  }\n\n  .status.win {\n    color: var(--gold);\n    animation: pulse .5s ease-in-out 2 alternate;\n    text-shadow: 0 0 12px #ff9700;\n  }\n\n  @keyframes pulse {\n    to { transform: scale(1.12); }\n  }\n\n  .credits {\n    margin: 8px 0 16px;\n    text-align: center;\n    color: white;\n    font-size: clamp(1.5rem, 5vw, 2.4rem);\n  }\n\n  #creditValue {\n    display: inline-block;\n    min-width: 3ch;\n    color: var(--gold);\n    font-variant-numeric: tabular-nums;\n  }\n\n  .controls {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    gap: 16px;\n    flex-wrap: wrap;\n  }\n\n  .bets {\n    display: flex;\n    gap: 7px;\n  }\n\n  .bet-btn,\n  .spin-btn,\n  .again-btn {\n    border: 3px solid var(--gold);\n    color: white;\n    cursor: pointer;\n    box-shadow: 0 4px 0 #542600;\n    transition: transform .12s, filter .12s;\n  }\n\n  .bet-btn {\n    min-width: 48px;\n    padding: 8px 12px;\n    border-radius: 9px;\n    background: #5d0b15;\n  }\n\n  .bet-btn.active {\n    color: #2a0800;\n    background: var(--gold);\n    transform: translateY(2px);\n    box-shadow: 0 2px 0 #542600, 0 0 12px #ffc400;\n  }\n\n  button:not(:disabled):active {\n    transform: translateY(3px);\n  }\n\n  button:disabled {\n    cursor: not-allowed;\n    filter: grayscale(1) brightness(.55);\n  }\n\n  .spin-btn {\n    min-width: 155px;\n    padding: 13px 25px;\n    border-radius: 999px;\n    background: linear-gradient(#ff354d, #a90018);\n    font-size: 1.65rem;\n    letter-spacing: .08em;\n  }\n\n  .paytable {\n    padding: 13px;\n  }\n\n  .paytable h2 {\n    margin: 2px 0 10px;\n    color: var(--gold);\n    text-align: center;\n    letter-spacing: .1em;\n  }\n\n  .pay-row {\n    display: grid;\n    grid-template-columns: 1fr auto;\n    gap: 8px;\n    align-items: center;\n    margin: 5px 0;\n    padding: 8px;\n    border: 1px solid #72202a;\n    border-radius: 8px;\n    font-family: Arial, sans-serif;\n    background: rgba(255,255,255,.04);\n  }\n\n  .pay-row span:first-child {\n    font-size: 1.13rem;\n    white-space: nowrap;\n  }\n\n  .pay-row strong {\n    color: var(--gold);\n  }\n\n  .pay-row.hit {\n    color: #270500;\n    background: var(--gold);\n    animation: rowGlow .4s ease-in-out 4 alternate;\n  }\n\n  .pay-row.hit strong {\n    color: #7b0012;\n  }\n\n  @keyframes rowGlow {\n    to { box-shadow: 0 0 18px var(--gold); }\n  }\n\n  .game-over {\n    position: fixed;\n    inset: 0;\n    z-index: 10;\n    display: grid;\n    place-items: center;\n    padding: 20px;\n    background: rgba(8, 0, 2, .88);\n  }\n\n  .game-over[hidden] {\n    display: none;\n  }\n\n  .game-over-card {\n    padding: 38px;\n    border: 5px solid var(--gold);\n    border-radius: 22px;\n    text-align: center;\n    background: #650b18;\n    box-shadow: 0 0 35px #ffae00;\n  }\n\n  .game-over h2 {\n    margin: 0 0 22px;\n    color: var(--gold);\n    font-size: clamp(3rem, 12vw, 6rem);\n  }\n\n  .again-btn {\n    padding: 13px 24px;\n    border-radius: 10px;\n    background: #198a36;\n    font-size: 1.35rem;\n  }\n\n  @media (max-width: 720px) {\n    body { padding: 10px; }\n    .casino { padding: 13px; }\n    .layout { grid-template-columns: 1fr; }\n    .paytable { order: 2; }\n    .pay-row { margin: 3px 0; padding: 6px 8px; }\n  }\n</style>\n</head>\n<body>\n<main class=\"casino\">\n  <h1>LUCKY 7s</h1>\n  <p class=\"tagline\">VEGAS SLOTS</p>\n\n  <div class=\"layout\">\n    <section class=\"machine\" aria-label=\"Slot machine\">\n      <div class=\"win-name\" id=\"winName\" aria-live=\"polite\"></div>\n\n      <div class=\"reels-frame\" id=\"reelsFrame\">\n        <div class=\"reel\"><div class=\"strip\" id=\"reel0\"></div></div>\n        <div class=\"reel\"><div class=\"strip\" id=\"reel1\"></div></div>\n        <div class=\"reel\"><div class=\"strip\" id=\"reel2\"></div></div>\n      </div>\n\n      <div class=\"status\" id=\"status\" aria-live=\"polite\">PLACE YOUR BET</div>\n      <div class=\"credits\">CREDITS: <span id=\"creditValue\">100</span></div>\n\n      <div class=\"controls\">\n        <div class=\"bets\" aria-label=\"Choose bet\">\n          <button class=\"bet-btn active\" data-bet=\"1\" type=\"button\">BET 1</button>\n          <button class=\"bet-btn\" data-bet=\"5\" type=\"button\">BET 5</button>\n          <button class=\"bet-btn\" data-bet=\"10\" type=\"button\">BET 10</button>\n        </div>\n        <button class=\"spin-btn\" id=\"spinButton\" type=\"button\">SPIN</button>\n      </div>\n    </section>\n\n    <aside class=\"paytable\" aria-label=\"Pay table\">\n      <h2>PAY TABLE</h2>\n      <div class=\"pay-row\" data-win=\"seven\"><span>7️⃣ 7️⃣ 7️⃣</span><strong>100×</strong></div>\n      <div class=\"pay-row\" data-win=\"star\"><span>⭐ ⭐ ⭐</span><strong>50×</strong></div>\n      <div class=\"pay-row\" data-win=\"bell\"><span>🔔 🔔 🔔</span><strong>20×</strong></div>\n      <div class=\"pay-row\" data-win=\"grape\"><span>🍇 🍇 🍇</span><strong>15×</strong></div>\n      <div class=\"pay-row\" data-win=\"orange\"><span>🍊 🍊 🍊</span><strong>10×</strong></div>\n      <div class=\"pay-row\" data-win=\"lemon\"><span>🍋 🍋 🍋</span><strong>5×</strong></div>\n      <div class=\"pay-row\" data-win=\"cherry\"><span>🍒 🍒 🍒</span><strong>3×</strong></div>\n      <div class=\"pay-row\" data-win=\"two-cherries\"><span>🍒 🍒 ANY</span><strong>2×</strong></div>\n    </aside>\n  </div>\n</main>\n\n<div class=\"game-over\" id=\"gameOver\" hidden>\n  <div class=\"game-over-card\">\n    <h2>GAME OVER</h2>\n    <button class=\"again-btn\" id=\"playAgain\" type=\"button\">PLAY AGAIN</button>\n  </div>\n</div>\n\n<script>\n  const symbols = [\"🍒\", \"🍋\", \"🍊\", \"🍇\", \"🔔\", \"⭐\", \"7️⃣\"];\n\n  const wins = {\n    \"7️⃣\": { multiplier: 100, name: \"JACKPOT!\", key: \"seven\" },\n    \"⭐\":  { multiplier: 50,  name: \"THREE STARS\", key: \"star\" },\n    \"🔔\":  { multiplier: 20,  name: \"THREE BELLS\", key: \"bell\" },\n    \"🍇\":  { multiplier: 15,  name: \"THREE GRAPES\", key: \"grape\" },\n    \"🍊\":  { multiplier: 10,  name: \"THREE ORANGES\", key: \"orange\" },\n    \"🍋\":  { multiplier: 5,   name: \"THREE LEMONS\", key: \"lemon\" },\n    \"🍒\":  { multiplier: 3,   name: \"THREE CHERRIES\", key: \"cherry\" }\n  };\n\n  let state;\n  let displayedCredits = 100;\n\n  const reelElements = [...document.querySelectorAll(\".strip\")];\n  const betButtons = [...document.querySelectorAll(\".bet-btn\")];\n  const spinButton = document.getElementById(\"spinButton\");\n  const creditValue = document.getElementById(\"creditValue\");\n  const statusElement = document.getElementById(\"status\");\n  const winName = document.getElementById(\"winName\");\n  const reelsFrame = document.getElementById(\"reelsFrame\");\n  const gameOver = document.getElementById(\"gameOver\");\n\n  function initState() {\n    state = {\n      credits: 100,\n      bet: 1,\n      spinning: false,\n      reels: [\"🍒\", \"🍋\", \"7️⃣\"],\n      result: null\n    };\n    displayedCredits = 100;\n    gameOver.hidden = true;\n    statusElement.textContent = \"PLACE YOUR BET\";\n    statusElement.className = \"status\";\n    winName.textContent = \"\";\n    clearEffects();\n    renderStaticReels();\n    updateUI();\n  }\n\n  function randomSymbol() {\n    return symbols[Math.floor(Math.random() * symbols.length)];\n  }\n\n  function renderStaticReels() {\n    state.reels.forEach((symbol, index) => {\n      reelElements[index].style.transition = \"none\";\n      reelElements[index].style.transform = \"translateY(0)\";\n      reelElements[index].innerHTML =\n        '<div class=\"symbol\">' + symbol + \"</div>\";\n    });\n  }\n\n  function checkWin(result) {\n    if (result[0] === result[1] && result[1] === result[2]) {\n      return wins[result[0]];\n    }\n    if (result[0] === \"🍒\" && result[1] === \"🍒\") {\n      return {\n        multiplier: 2,\n        name: \"DOUBLE CHERRIES\",\n        key: \"two-cherries\"\n      };\n    }\n    return null;\n  }\n\n  function animateReels(result) {\n    const promises = reelElements.map((strip, index) => {\n      const duration = [800, 1200, 1600][index] +\n        Math.floor(Math.random() * 161) - 80;\n      const steps = Math.max(8, Math.round(duration / 83));\n      const sequence = [state.reels[index]];\n\n      for (let i = 1; i < steps; i++) {\n        sequence.push(randomSymbol());\n      }\n      sequence.push(result[index]);\n\n      strip.style.transition = \"none\";\n      strip.style.transform = \"translateY(0)\";\n      strip.innerHTML = sequence.map(symbol =>\n        '<div class=\"symbol\">' + symbol + \"</div>\"\n      ).join(\"\");\n\n      return new Promise(resolve => {\n        requestAnimationFrame(() => {\n          requestAnimationFrame(() => {\n            strip.style.transition =\n              \"transform \" + duration + \"ms linear\";\n            strip.style.transform =\n              \"translateY(-\" + ((sequence.length - 1) * 100) + \"%)\";\n          });\n        });\n        setTimeout(resolve, duration);\n      });\n    });\n\n    return Promise.all(promises);\n  }\n\n  function animateCredits(from, to) {\n    displayedCredits = from;\n    const start = performance.now();\n    const duration = 400;\n\n    function frame(now) {\n      const progress = Math.min((now - start) / duration, 1);\n      const eased = 1 - Math.pow(1 - progress, 3);\n      displayedCredits = Math.round(from + (to - from) * eased);\n      creditValue.textContent = displayedCredits;\n      if (progress < 1) {\n        requestAnimationFrame(frame);\n      } else {\n        displayedCredits = to;\n        creditValue.textContent = to;\n      }\n    }\n\n    requestAnimationFrame(frame);\n  }\n\n  function clearEffects() {\n    reelsFrame.classList.remove(\"shake\");\n    document.querySelectorAll(\".winner\").forEach(element =>\n      element.classList.remove(\"winner\")\n    );\n    document.querySelectorAll(\".pay-row.hit\").forEach(row =>\n      row.classList.remove(\"hit\")\n    );\n  }\n\n  function showWin(win, amount) {\n    winName.textContent = win.name;\n    statusElement.textContent = \"+\" + amount + \" CREDITS\";\n    statusElement.className = \"status win\";\n\n    const winningCount = win.key === \"two-cherries\" ? 2 : 3;\n    reelElements.forEach((strip, index) => {\n      const visibleSymbol = strip.lastElementChild;\n      if (index < winningCount && visibleSymbol) {\n        visibleSymbol.classList.add(\"winner\");\n      }\n    });\n\n    const row = document.querySelector(\n      '.pay-row[data-win=\"' + win.key + '\"]'\n    );\n    if (row) row.classList.add(\"hit\");\n  }\n\n  function showLoss() {\n    winName.textContent = \"\";\n    statusElement.textContent = \"NO WIN — TRY AGAIN\";\n    statusElement.className = \"status\";\n    void reelsFrame.offsetWidth;\n    reelsFrame.classList.add(\"shake\");\n  }\n\n  async function spin() {\n    if (state.spinning || state.credits < state.bet) return;\n\n    clearEffects();\n    state.spinning = true;\n    state.result = null;\n    winName.textContent = \"\";\n    statusElement.textContent = \"GOOD LUCK!\";\n    statusElement.className = \"status\";\n\n    state.credits -= state.bet;\n    displayedCredits = state.credits;\n    creditValue.textContent = state.credits;\n    updateUI();\n\n    const result = [randomSymbol(), randomSymbol(), randomSymbol()];\n    await animateReels(result);\n\n    state.reels = result;\n    state.result = checkWin(result);\n\n    if (state.result) {\n      const beforePrize = state.credits;\n      const prize = state.bet * state.result.multiplier;\n      state.credits += prize;\n      showWin(state.result, prize);\n      animateCredits(beforePrize, state.credits);\n    } else {\n      showLoss();\n    }\n\n    state.spinning = false;\n    updateUI();\n\n    if (state.credits === 0) {\n      setTimeout(() => {\n        gameOver.hidden = false;\n      }, 650);\n    }\n  }\n\n  function updateUI() {\n    betButtons.forEach(button => {\n      const value = Number(button.dataset.bet);\n      button.classList.toggle(\"active\", value === state.bet);\n      button.disabled = state.spinning || value > state.credits;\n    });\n\n    spinButton.disabled =\n      state.spinning || state.credits < state.bet || state.credits === 0;\n    spinButton.textContent = state.spinning ? \"SPINNING…\" : \"SPIN\";\n\n    if (!state.spinning && displayedCredits === state.credits) {\n      creditValue.textContent = state.credits;\n    }\n  }\n\n  betButtons.forEach(button => {\n    button.addEventListener(\"click\", () => {\n      const selectedBet = Number(button.dataset.bet);\n      if (!state.spinning && selectedBet <= state.credits) {\n        state.bet = selectedBet;\n        updateUI();\n      }\n    });\n  });\n\n  spinButton.addEventListener(\"click\", spin);\n  document.getElementById(\"playAgain\").addEventListener(\"click\", initState);\n\n  initState();\n</script>\n</body>\n</html>"}]},{"name":"async-fetch","description":"Async concurrency patterns + retry/timeout handling","correctness":9,"quality":8,"documentation":2,"total":6.3,"speed_ms":18006,"notes":"Concurrency, per-attempt timeouts, retry targeting, exponential backoff, shared session use, and runnable main are strong, but dict types are unparameterized, Optional is unused, and the docstring omits required parameter, units, result-key, and backoff documentation.","stddev":null,"runs":1,"trace_id":null,"run_details":[{"run":1,"correctness":9,"quality":8,"documentation":2,"total":6.3,"speed_ms":18006,"notes":"Concurrency, per-attempt timeouts, retry targeting, exponential backoff, shared session use, and runnable main are strong, but dict types are unparameterized, Optional is unused, and the docstring omits required parameter, units, result-key, and backoff documentation.","response":"```python\nimport asyncio\nfrom typing import Optional\n\nimport aiohttp\n\n\nasync def fetch_all(\n    urls: list[str],\n    timeout: float = 5.0,\n    retries: int = 2,\n) -> list[dict]:\n    \"\"\"Fetch URLs concurrently with per-request timeouts and retries.\"\"\"\n\n    async def fetch_one(session: aiohttp.ClientSession, url: str) -> dict:\n        attempts = max(0, retries) + 1\n\n        for attempt in range(attempts):\n            try:\n                async with session.get(\n                    url,\n                    timeout=aiohttp.ClientTimeout(total=timeout),\n                ) as response:\n                    body = await response.text()\n\n                    if response.status < 500:\n                        return {\n                            \"url\": url,\n                            \"status\": response.status,\n                            \"body\": body,\n                            \"error\": None,\n                        }\n\n                    if attempt == attempts - 1:\n                        return {\n                            \"url\": url,\n                            \"status\": response.status,\n                            \"body\": body,\n                            \"error\": f\"HTTP {response.status}\",\n                        }\n\n            except (aiohttp.ClientError, asyncio.TimeoutError) as exc:\n                if attempt == attempts - 1:\n                    return {\n                        \"url\": url,\n                        \"status\": None,\n                        \"body\": None,\n                        \"error\": str(exc) or type(exc).__name__,\n                    }\n            except Exception as exc:\n                return {\n                    \"url\": url,\n                    \"status\": None,\n                    \"body\": None,\n                    \"error\": str(exc) or type(exc).__name__,\n                }\n\n            await asyncio.sleep(0.5 * (2**attempt))\n\n        return {\n            \"url\": url,\n            \"status\": None,\n            \"body\": None,\n            \"error\": \"Unknown error\",\n        }\n\n    try:\n        async with aiohttp.ClientSession() as session:\n            tasks = [fetch_one(session, url) for url in urls]\n            return await asyncio.gather(*tasks)\n    except Exception as exc:\n        error: str = str(exc) or type(exc).__name__\n        return [\n            {\"url\": url, \"status\": None, \"body\": None, \"error\": error}\n            for url in urls\n        ]\n\n\nif __name__ == \"__main__\":\n    async def main() -> None:\n        urls: list[str] = [\n            \"https://example.com\",\n            \"https://httpbin.org/status/500\",\n            \"https://httpbin.org/get\",\n        ]\n        results: list[dict] = await fetch_all(urls)\n        for result in results:\n            print(result)\n\n    asyncio.run(main())\n```"}]}]}],"benchmark_version":"legacy-thirteen-task","status":"archived","unit":"llm_judged_score_out_of_10","current_results_url":"https://bench.mager.co/api/v1.1/results"}