You will implement a program where the computer plays


You will implement a program where the computer plays against a human opponent. The game will start with a random number of marbles between 10 and 100. A random number between 0 and 1 will be used to decide who takes the first turn (0 computer, 1 human opponent) and the human opponent has to decide whether he or she wants the computer to play in a novice or expert mode. In the novice mode the computer will always take a random number between 1 and half of the marbles that there are in the pile at the moment whenever it is its turn. In the expert mode the computer always takes enough marbles to make the number of marbles left on the pile a power of 2 minus 1 (e.g, 3, 7, 31) except if the size of the pile is already one less than the power of 2. In that case the computer will take a random number of marbles. Note that the computer will always win in expert mode if it has the first turn but also a human opponent will always win if he or she knows the winning strategy.

Solution Preview :

Prepared by a verified Expert
Software Engineering: You will implement a program where the computer plays
Reference No:- TGS0663308

Now Priced at $30 (50% Discount)

Recommended (96%)

Rated (4.8/5)