The simulation assumes that all the pearls sit at the bottom of the cup and are layered on top of each other.

As such, when you poke a straw straight down into a cup with n layers of pearls, you will get an n amount of pearls in the straw (refer to image above). The rest of the straw up to the drink's height is tea.

The simulation also assumes that the drinker stops sipping tea once all n pearls are in their mouth i.e an "optimised sip.