Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 19:30, bbgirl8638
Of the following pieces of information in a document, for which would you most likely insert a mail merge field?
Answers: 3
image
Computers and Technology, 23.06.2019 20:00, boo3972
Match the file formats with the types of multimedia they can store
Answers: 2
image
Computers and Technology, 23.06.2019 21:20, FlowerChild1229
For positive constants a and b, the force between two atoms in a molecule is given f(r) = −a r2 + b r3 , where r > 0 is the distance between the atoms. note: a and b are upper case letters. (a) find f '(r) = (b) find the critical point for f(r). r = (c) find f ''(r) = (d) find the value of r so that f ''(r) = 0.
Answers: 1
image
Computers and Technology, 23.06.2019 23:30, econsta3
Perform an online search about the booting process of a computer and list all the steps
Answers: 2
Do you know the correct answer?
I NEED THE ANSWER AS SOON AS POSSIBLE. ANSWER THE QUESTION TO GET 50 POINTS. Write the code in Jav...

Questions in other subjects:

Konu
Social Studies, 11.11.2020 01:00
Konu
Advanced Placement (AP), 11.11.2020 01:00