lantern

cookie-jar-accuse

cookie-jar-accuse

Generate an accusation verse, pop the accused player.

config

_context:
  accused: Marcus
  game_over: false
  lyrics:
  - Who stole the cookie from the cookie jar?
  - George stole the cookie from the cookie jar!
  - Who, me?
  - Yes, you!
  - Couldn't be!
  - Then who?
  - ''
  - Who stole the cookie from the cookie jar?
  - Charlie stole the cookie from the cookie jar!
  - Who, me?
  - Yes, you!
  - Couldn't be!
  - Then who?
  - ''
  - Who stole the cookie from the cookie jar?
  - Marcus stole the cookie from the cookie jar!
  - Who, me?
  - Yes, you!
  - Couldn't be!
  - Then who?
  - ''
  original_count: 5
  players:
  - Tara
  - Xavier
  remaining: 2
  round: 3
consumes: dict
produces: dict

fetch

# Read directly from config - pipeline passes flat context
players = list(config.get('players', []))
lyrics = list(config.get('lyrics', []))
round_num = config.get('round', 0)

if len(players) < 2:
    # Not enough players, pass through
    result = {
        "players": players,
        "lyrics": lyrics,
        "round": round_num,
        "game_over": len(players) <= 1
    }
else:
    # Pop first player as accused
    accused = players.pop(0)
    
    # Generate verse
    verse = [
        "Who stole the cookie from the cookie jar?",
        f"{accused} stole the cookie from the cookie jar!",
        "Who, me?",
        "Yes, you!",
        "Couldn't be!",
        "Then who?",
        ""
    ]
    lyrics.extend(verse)
    
    result = {
        "players": players,
        "accused": accused,
        "lyrics": lyrics,
        "round": round_num + 1,
        "remaining": len(players),
        "game_over": False
    }

Tags

tags:
  - fence:chain
  - demo
  - cookie-jar
  - pattern:pipeline

Provenance

Document

  • Status: πŸ”΄ Unverified

Changelog

  • 2026-01-26 00:14: Node created by mcp - Creating accuse stage for staged cookie-jar pipeline