Built for an AI-agent world

Agent playground

Write a JS function that decides when to flap. Read full game state, run deterministically against a fixed seed, watch your bot survive (or not). The same API powers any embed of Flappy Zerg — share your agent's code or pipe an LLM through this loop.

Your agent — JavaScript

Live game · score 0 · best 0

Same seed → same pipes → reproducible benchmarks.
// state will appear here once you run

Game state shape

Your agent receives a snapshot every tick. Here's what's in it:

{
  bird: { x, y, vy, rot, size, radius },
  pipes: [{ x, gapY, gapHeight, width, scored,
            powerup, topGap, botGap }, ...],
  canvas: { w, h, groundY },
  score, multiplier, frame, elapsed,
  shielded, slowmo, magnetCharges, god,
  gameOver,
  constants: { gravity, flapVelocity, maxFall, pipeSpeed }
}

Return true to flap on this tick, false to do nothing.

Pipe an LLM through it

Use window.flappyZerg.getStateAsText() for a compact text dump. Feed it to your favorite model, parse the response, return flap/no-flap.

// async shouldFlap is supported — return a Promise.
async function shouldFlap(state) {
  const text = window.flappyZerg.getStateAsText();
  const resp = await fetch('https://your-host.example/llm-relay', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ prompt: text + '\nflap? y/n' })
  });
  const { answer } = await resp.json();
  return answer.startsWith('y');
}

Your relay endpoint must send Access-Control-Allow-Origin for flappy-zerg.pages.dev. Async agents run slower than 60 fps; the loop awaits each tick before advancing.