0

## Secrets of Nim (Abacan 2)

Published on Thursday, September 27, 2012 in , , , ,

In my previous post, I introduced a new version of Nim called Abacan, and introduced one strategy for winning it.

In this post, I'll teach the rest of the strategy you'll need to win Abacan every time. Before we do that, though, I'll go through a quick review.

In Abacan, you have 5 rows of beads. There are rows of 1, 3, 5, 7, and 9 beads. Players alternate taking turns, and can only move 1, 2, or 3 beads, all in the same row, on their turn. The last player to move a bead is the loser.

The strategy taught last time involves first reducing the number of beads in each row to a number from 0 to 3. In situations where the rows reduced to all 1s and 0s, or all 1s and 0s with a single 2 or 3, you simply move so that the reduced rows become an odd number of 1s. For example, rows of 1, 1, 4, 6, and 8 beads can be reduced to rows of 1, 1, 0, 2, and 0 beads. From there, it's a simple matter to see that the “2” row (reduced from 6) should have 1 bead removed from it, leaving the other player with 1, 1, 4, 5, and 8 beads (which reduces to 1, 1, 0, 1, and 0 beads - the equivalent of 3 piles of 1).

You should always reduce the numbers of beads first, then see if you can apply the strategy above first. This “odd 1s” approach is effectively the endgame strategy of multi-pile MisÃ¨re Nim, as taught in Secrets of Nim (Part 3). In Abacan, however, it can be used well before the end.

What happens, though, if you reduce the rows of beads and find that there's more than one row containing the equivalent of 2 or 3 beads? In that case, you'll need a second strategy.

Strategy 2: In the Secrets of Nim (Part 2) and Visualizing Multi-Pile Nim posts, I discuss the importance of pairing up similar values using the binary. Thankfully, there won't be any need to delve into binary conversion in the Abacan version.

If you have a set of reduced rows containing multiple rows of 2 and/or 3 beads, you'll use the second strategy. In this strategy, you'll want to leave your opponent with rows that, when reduced, have any 1s, 2s, and 3s paired up with each other. You don't need to worry about pairing up 0s.

This can sound confusing, so let's use the starting arrangement of 1, 3, 5, 7, and 9 beads as an example. The first step is to reduce the arrangement from 1, 3, 5, 7, and 9 beads to its equivalent, which is rows of 1, 3, 1, 3, and 1 beads.

Since we can't use strategy 1 from the previous post, we move on to strategy 2, pairing up all the 1s, 2s, and 3s. With the reduced rows of 1, 3, 1, 3, and 1, it's not difficult to see how we can leave our opponent with a pair of 1s and a pair of 3s.

Taking 1 bead from the first row would make leave your opponent with 3, 5, 7, and 9 beads, which reduces to 3, 1, 3, and 1. You could also remove 1 from the 3rd row, leaving your opponent with rows of 1, 3, 4, 7, and 9, which reduces to rows 1, 3, 0, 3, 1. Another alternative is leaving your opponent with rows of 1, 3, 5, 7, and 8 beads, which reduces to rows of 1, 3, 1, 3, and 0 beads.

Now you know that it's to your advantage to move first, and that your first move should be sliding over 1 bead from the row of either 1, 5, or 9. Since 1, 5, and 9 are all equivalent after performing modulus 4, all 3 of these moves have the same effect.

Full approach: This is almost everything you need to know to win Abacan:

1) Mentally reduce the number of beads in each row by using mod 4.
2) If the reduced rows are all 1s and 0s, or all 1s and 0s with a single 2 or 3, remove enough beads to make the reduced rows consist of an odd number of 1s (strategy 1).
3) If using strategy 1 doesn't apply, use strategy 2. Remove beads in such a way that all any 1s, 2s, and 3s remaining are paired up.
Practice, of course, is the best way to do this. As mentioned in the previous post, Wolfram|Alpha can generate random arrangements for you. You can also double-check your mental reductions of each row on Wolfram|Alpha.

As you do this, however, you'll still find certain arrangements you won't be able to solve. This is why I said you know almost everything you need to know.

Recognizing unsolvable arrangements: By playing first and practicing and using the strategies in these Abacan posts, you'll always be able to leave your opponent with an arrangement that will guarantee they will lose.

However, if the other person goes first, and makes the right move, it is possible that they'll leave you with a position from which you don't have a good move. Assuming they're not wise to the strategy and just got lucky, you'll likely be able to recover on a later move. When you can't make an effective move, the best thing to do is simply slide 1 bead in the row with the most beads remaining.

You'll still need to recognize arrangements you can't win. Fortunately, they all fall into 1 of 4 easily recognizable patterns when reduced:
A) An odd number of 1s: 11559 = 11111, 11458 = 11010
B) All numbers paired: 13578 = 13130
C) 1/2/3: 13468 = 13020
D) 1/2/3 plus paired numbers: 13569 = 13121
Once you've practiced to the point where you can mentally reduce the numbers, apply the strategies to give your opponent losing patterns, and recognize when you're given a losing pattern, you're ready and equipped to win Abacan!

For those who would like to delve deeper into the mathematics behind this strategy, you might enjoy this discussion of the game in the BoardGameGeek forums.

Just like any version of Nim, you can play Abacan with any number of objects, such as playing cards or coins. If, however, you enjoyed these tutorials on how to win it, please consider helping this blog out by purchasing Abacan through the Grey Matters Store.