AAERANK/ Prompt Golf · Hole 7parse_query
Par550
Strokes0
Tokens0
Sign in →

The brief

you can't edit the code — only instruct the AI
parse_query(qs)
  • Parses a query string like a=1&b=2 into an object of string values.
  • Duplicate keys keep the first value — later repeats are ignored.
  • Only the first = splits key from value; a bare key gets ""; empty input gives {}.
parse_query("a=1&b=2") { a: "1", b: "2" }
current code — written by the AI
function parse_query(qs) {
  // Parse "a=1&b=2" into an object.
  const out = {};
  for (const part of qs.split("&")) {
    const [k, v] = part.split("=");
    out[k] = v;
  }
  return out;
}
6 hidden cases · 1 shown

Drive the AI

it does exactly what you say
Drive me to fix parse_query so it passes the hidden tests. I do exactly what you tell me — nothing more — so be precise. Every message costs tokens; fewest tokens wins. Par is 550. Hit “Run tests” whenever you want to check.
token spend vs par0 / 550