Two Balls, Four Events, One Clock
A two-ball exchange has a moment that feels almost impolite: the second ball leaves your hand before the first one lands. Wait too long and the rhythm collapses into two separate throws. Throw too early and your hands have an awkward conversation.
We can explore the timing without drawing a single arc. A discrete event simulation keeps track of meaningful changes and jumps the clock directly from one event to the next. This idea found a home in the simulation languages of the 1960s, when programmers modelled systems such as queues and industrial processes.
Here are two throws, 300 milliseconds apart. Each ball spends 600 milliseconds in the air. Rust builds a list of events and sorts it by time:
fn main() {
let throws = [(0, "A"), (300, "B")];
let mut events = Vec::new();
for (time, ball) in throws {
events.push((time, "throw", ball));
events.push((time + 600, "catch", ball));
}
events.sort_by_key(|event| event.0);
for (time, action, ball) in events {
println!("{time:4} ms: {action} {ball}");
}
}
Haskell describes the same event list with a list comprehension, then sorts the resulting tuples:
import Data.List (sort)
main :: IO ()
main = mapM_ showEvent events
where
throws = [(0, "A"), (300, "B")]
events = sort [(t + dt, action, ball)
| (t, ball) <- throws,
(dt, action) <- [(0, "throw"), (600, "catch")]]
showEvent (t, action, ball) =
putStrLn (show t ++ " ms: " ++ action ++ " " ++ ball)
Both programs print throws at 0 and 300 milliseconds, followed by catches at 600 and 900. Between 300 and 600 milliseconds, both balls are airborne: that’s the overlap that makes this an exchange.
Jumping between events avoids calculating hundreds of uneventful intermediate moments. The trade-off is that this model knows nothing about a ball’s position between throw and catch, or whether a hand is ready. It is a useful sketch of the rhythm, not a physics lesson. If events share a timestamp, a real simulation also needs an explicit rule for which happens first.