Game of Nim - MATLAB Cody - MATLAB Central

Problem 1481. Game of Nim

Difficulty:Rate

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.

Problem 5) Prev: 1478 Next: 1482

Solution Stats

55.88% Correct | 44.12% Incorrect
Last Solution submitted on Jul 18, 2023

Problem Comments

Solution Comments

Show comments
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Group

Board Games I Image
Board Games I
  • 16 Problems
  • 21 Finishers

Problem Recent Solvers34

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page