White elephant gift exchanges, also known as Yankee swaps or, somewhat creepily, “dirty Santa” games, are a fun alternative to the old office staple “secret Santa.” Like secret Santa, everyone brings one gift and takes one home. But a Yankee swap adds the opportunity for fun, intrigue and cutthroat competition.

Of course, as with any gift exchange, the real goal is to win. In the video above, my colleagues Simone and Jody help me explain the surefire, guaranteed way to make sure you take home the best gift in your Yankee swap.

For the uninitiated, a Yankee swap works like this: Everyone brings a wrapped gift (often subject to a dollar limit) and draws numbers at random to determine playing order. The first player opens a gift. Each subsequent player has a choice: Either open a gift or steal one that’s already been opened. Get your gift stolen? You get to make the same choice: open or steal.

As you might already have figured out, the best way to win is to go last — you can pick almost any gift you want! Alas, you can’t control your playing order. What you can control is your strategy when your turn comes up. Should you always steal? Never steal? Steal only under certain circumstances? These are all questions of game theory.

I built a model to help explore Yankee swap strategies, which you can check out on GitHub. The basic strategy, though, has three steps:

As each gift is opened, mentally assign it a value (perhaps a dollar value or a 1-to-5 ranking); When it’s your turn, average the value of all the opened gifts (whether or not they’re available for stealing); If there is a stealable gift “worth” at least as much as the average, steal it! Otherwise, open a gift. (Depending on the rules you’re playing by, not every gift might be available for stealing.)

Happy swapping! (And remember: The most important thing is to win.)

Video featuring Ben Casselman, Simone Landon and Jody Avirgan. Camera and edit by Jordan Schulkin, produced by Ryan Nantell.