may-set-loop-alternating-receiver.ts 697 B

123456789101112131415
  1. // An alternating receiver in a loop: the script's ONLY ask site is
  2. // `(turn ? black : white).ask(…)`, so EVERY ask is a may-set — the shape that made the
  3. // one-step rule erase an actor from the picture. Expansion draws two copies, one per
  4. // candidate lane, and the loop's carry becomes the 2x2 product: the black <-> white
  5. // alternation cycle plus a self-loop on each copy, since nothing rules out the same
  6. // candidate being selected in consecutive rounds.
  7. const black = agent("black");
  8. const white = agent("white");
  9. let board = "empty";
  10. let turn = true;
  11. while (board.length < 40) {
  12. board = await (turn ? black : white).ask<string>(`move on ${board}`);
  13. turn = !turn;
  14. }
  15. return board;