Modeling pancake flipping