control-flow-loop-condition-step.ts 533 B

12345678910
  1. // KNOWN APPROXIMATION (docs/analysis.md, "The control-flow graph"): the walk
  2. // evaluates a `while` condition once, before the loop region, so a step issued inside the
  3. // condition sits OUTSIDE the loop on the CFG and appears to run once. Pinned here so a
  4. // future `head` sub-region shows up as a deliberate golden change, not a surprise.
  5. let rounds = 0;
  6. while ((await agent("gate").ask<string>(`continue? round ${rounds}`)) === "yes") {
  7. await agent("worker").ask<string>(`work round ${rounds}`);
  8. rounds += 1;
  9. }
  10. return rounds;