MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

The Game of Nim is a famous studied 2 player strategy game. http://en.wikipedia.org/wiki/Nim

There are 3 heaps, and you are given the number of pebbles in each heap. Player 1 and 2 take turns removing pebbles from each heap. Game ends when a player cannot remove any pebbles from any heap, and the last player able to do so is the winner.

Given the number of pebbles in each heap, determine if player-1 will win assuming that both player play their optimal strategy, ie their best possible moves.

5 correct solutions
4 incorrect solutions

Last solution submitted on Aug 26, 2015

1 Comment