subject

I NEED THE ANSWER AS SOON AS POSSIBLE. ANSWER THE QUESTION TO GET 50 POINTS. Write the code in Java

The name of the game is Marbles. Two players alternately take marbles from a pile. In each move, a player chooses how many marbles to take. The player must take at least one but at most half of the marbles. Then the other player takes a turn. The player who takes the last marble loses.

Write a program in which the computer plays against a human opponent. Generate a random integer between 10 and 100 to denote the initial size of the pile. Generate a random value (either 0 or 1) to decide whether the computer plays smart or "st*pid". In "st*pid" mode, the computer simply takes a random legal value (between 1 and n/2) from the pile whenever it has a turn. In smart mode the computer takes off enough marbles to make the size of the pile a power of two minus 1- that is, 3, 7,15, 31, or 63. That is always a legal move, except if the size of the pile is currently one less then a power of 2. In that case, the computer makes a random legal move. Note that the computer cannot be beaten in smart mode when it has the first move, unless the

pile size happens to be 15, 31, or 63. Of course, a human player who gets the first turn and knows the winning strategy can win against the computer.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:00
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
You will subnet the network address 172.31.103.0/24. the network has the following requirements: · room-114 lan will require 27 host ip addresses · room-279 lan will require 25 host ip addresses · room-312 lan will require 14 host ip addresses · room-407 lan will require 8 host ip addresses how many subnets are needed in the network topology?
Answers: 2
question
Computers and Technology, 24.06.2019 20:30
Which key should you press to leave the cell as it originally was? a. delete b. cancel c. backspace d. enter
Answers: 1
You know the right answer?
I NEED THE ANSWER AS SOON AS POSSIBLE. ANSWER THE QUESTION TO GET 50 POINTS. Write the code in Jav...
Questions
question
Mathematics, 22.03.2020 06:29
Questions on the website: 13722363