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”
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.
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.)
And then there’s the question “Why pigs?” See my blog essay “Will ’17 be the year of the pig?”: https://mathenchant.wordpress.com/2016/12/10/will-17-be-the-year-of-the-pig/
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.
See how Mike Lawler’s kids approached and solved the puzzle: