// Juggle Three - Concurrency with Juggler Orange
// Teaching event handling through juggling

program JuggleThree {

  // Create three balls
  balls MyBalls {
    ball1: Red
    ball2: Blue
    ball3: Green
  }

  // Set the rhythm (timing)
  rhythm JuggleRhythm {
    beat 1: throw ball1
    beat 2: catch ball3
    beat 3: throw ball2
    beat 4: catch ball1
    beat 5: throw ball3
    beat 6: catch ball2
    repeat from beat 1
  }

  // Ask Orange to juggle!
  Orange do juggle MyBalls with JuggleRhythm

  // Count successful catches
  show Orange.catches + " catches!"

  if Orange.drops == 0 {
    show "Perfect juggling!"
  }

}

// What the child sees (blocks):
// ┌─────────────────────┐
// │ 🔴🔵🟢 Create Balls │
// │ [3 balls]           │
// └─────────────────────┘
// ┌─────────────────────┐
// │ 🎵 Set Rhythm       │
// │ ┌─────────────────┐ │
// │ │ Beat 1: Throw 🔴│ │
// │ │ Beat 2: Catch 🟢│ │
// │ │ Beat 3: Throw 🔵│ │
// │ │ Beat 4: Catch 🔴│ │
// │ │ ...             │ │
// │ │ 🔄 Repeat       │ │
// │ └─────────────────┘ │
// └─────────────────────┘
// ┌─────────────────────┐
// │ 🟠 Orange do        │
// │ [Juggle] [Balls]    │
// │ with [Rhythm]       │
// └─────────────────────┘

// Hidden learning: Concurrency!
// Multiple balls in the air at once
// Events happen in a specific order
// Some things must wait for others
// This is how async/await works!
