# Swine in a Line

I’m eager to get people’s responses to my first Barefoot Math video series, discussing the Swine-in-a-Line game (also the topic of my July 2017 Mathematical Enchantments essay). I state the puzzle in part 1, I give a few hints in part 2 , the solution is given in part 3, and tips for how one could find the solution (without knowing it ahead of time the way I did!) are given in part 4. I explain the solution to the “one left, one out” variant in part 5 and explain the connection with James Tanton’s “Exploding Dots”.

## 5 thoughts on “Swine in a Line”

1. Some people ask: “Does it matter which pig moves which left and which moves right?” My answer is, Not in the game as I intended it. Remember, the game ends when every pen has exactly one pig in it; it doesn’t matter which pig is where. Since the winning position doesn’t depend on which pig is where, the winning strategy doesn’t depend on this either.

Like

2. Some people ask: “When there’s more than one pen that has more than one pig in it, do I get to choose which pen to deal with first?” Absolutely! But it’s important that you deal with one pen completely before dealing with another pen. If, say, pen 4 has a pig in it and pen 5 has two pigs in it, and you send one of the pigs in pen 5 to pen 4, you have to send the other pig in pen 5 to pen 6 before you start worrying about the fact that pen 4 now has two pigs in it. That’s why I make a ritual of saying “Left, right” in the video, so that you view the two operations as a single action that needs to be completed before other actions are taken. (You could actually do “Right, left” instead if you prefer. The point is that the two operations need to be done together.)

Like

3. ykallus says:

The winning move when there are pigs in pens 2, 7, and 9 is (rot13 for spoilers) gb chg n cvt va gur friragu cra. I gave up and cheated: I got Mathematica to calculate which of the 512 game positions win and which lose. Once I had the list of losing positions, I quickly realized the pattern and the winning strategy.

Like