Question: Problem 1 . Pebbles Game. Two players play a game, starting with three piles of n pebbles each. Players alternate turns. On each turn, a
Problem Pebbles Game. Two players play a game, starting with three piles of pebbles each. Players
alternate turns. On each turn, a player may do one of the following:
take one pebble from any pile
take two pebbles each from two different piles
The player who takes the last pebbles wins the game.
Write an algorithm that, given determines whether the first player can "force" a win. That is can the
first player choose moves such that, regardless of what the other player does, they will always win.
In addition, write a procedure that tells a player which move if any they should make to force a win given
the current triple of pebbles in each pile.
What is the complexity of your solution?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
