Problem Solving, Presenting, and Programming: A Matter of Giving and Taking
T Tom Verhoeff · OLYMPIADS IN INFORMATICS · 2016
Nim is a well-known two-person game, where players alternate taking items from one of multiple piles.Finding a winning strategy for such games is a nice exercise in problem solving.Typically, the winning strategy for classical nim is explained in terms of nim sums, involving binary notation of numbers.I explain how to understand and play a winning strategy without prior knowledge of binary notation, which is useful when presenting this strategy in primary school.Programming that strategy is also an interesting challenge.This can be done elegantly in a functional language that supports patterns, such as the Wolfram Language.I conclude by giving you a variant of nim to work out yourself.