subject

Modify the following code so that: Make the pool start with a random number ([20, 30] inclusive) of coins.
Based on the number of the randomly generated coins at the beginning,
let the computer determine whether Player 1 or Player 2 will be the
winner based on the winning strategy (by printing out the winner).
After deciding the supposed winner and loser, let the computer play
out both of the roles. For the winner, the computer should be applying
the winning strategy; for the loser, the computer should generate a
random amount of coins while following all the rules of the game
Rules of the game:
a) The game starts with 22 coins in a common pool
b) The goal of the game is to take the last coin
c) Two players take turns removing 1, 2, or 3 coins from the pool
d) A player can NOT take more coins than remaining coins in the pool
e) After each turn, the judge announces how many coins remain in the
pool
f) When the last coin is taken, the judge announces the winner
turn=0 #turn=1 remaining coins-24 print(Take turns removing 1, 2, or 3 coins. ) print(You win if you take the last coin.)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:00
The following function returns a string of length n whose characters are all 'x'. give the order of growth (as a function of n) of the running time. recall that concatenating two strings in java takes time proportional to the sum of their lengths. public static string f(int n) { if (n == 0) return ""; if (n == 1) return "x"; return f(n/2) + f(n - n/2); } options: a) constant b) logarithmic c) linear d) linearithmic e)quadratic f)cubic g) exponential
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
While inserting images, the picture command is usually used to insert photos from a digital camera, and the clip art command is usually used to a.edit the sizes and other characteristics of photos that have been inserted. b.take a screenshot of an image and copy it to the clipboard for pasting. c.search for drawings or other images from a library of prepared pictures. d.make illustrations using lines and shapes that are easy to manipulate.
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
Write the pseudo code for this problem based on what you learned from the video. the purpose is to design a modular program that asks the user to enter a distance in kilometers, and then converts that distance to miles. the conversion formula is as follows: miles = kilometers x 0.6214
Answers: 3
You know the right answer?
Modify the following code so that: Make the pool start with a random number ([20, 30] inclusive) of...
Questions
question
Mathematics, 18.03.2021 01:50
question
Mathematics, 18.03.2021 01:50
question
Mathematics, 18.03.2021 01:50
question
Arts, 18.03.2021 01:50
Questions on the website: 13722363