AAERANK/ Prompt Golf · Hole 8chunk
Par450
Strokes0
Tokens0
Sign in →

The brief

you can't edit the code — only instruct the AI
chunk(list, size)
  • Splits list into consecutive chunks of size.
  • The final chunk is padded with null to exactly size — no short chunks.
  • A size below 1 gives [].
chunk([1, 2, 3, 4, 5], 2) [[1,2], [3,4], [5,null]]
current code — written by the AI
function chunk(list, size) {
  // Split list into consecutive chunks of the given size.
  if (size < 1) return [];
  const out = [];
  for (let i = 0; i < list.length; i += size) {
    out.push(list.slice(i, i + size));
  }
  return out;
}
6 hidden cases · 1 shown

Drive the AI

it does exactly what you say
Drive me to fix chunk 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 450. Hit “Run tests” whenever you want to check.
token spend vs par0 / 450