Variants of the Nim game have been played since ancient times. This challenge uses a specific version: there’s a row of 15, 16, or 17 balls. Two players take turns removing 1, 2, or 3 balls from the row, and whoever removes the last ball loses.
You could play this with kids using pencils or matches — but here you’re playing against a computer. Define the rules for a winning strategy: who should go first, and how many balls should be taken after each of the computer’s moves?
Send your solutions to DecisionManagementCommunity@gmail.com, or open a pull request to add yours here.