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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, luisanavarrogarcia
Which of the following statements correctly identifies a problem with sanitization methods? a. methods are not available to remove data ensuring that unauthorized personnel cannot retrieve data. b. even fully incinerated media can offer extractable data. c. personnel can perform sanitization steps improperly. d. stored data is physically etched into the media.
Answers: 1
image
Computers and Technology, 22.06.2019 03:30, brin1021
Jessie has received a contract to build a real-time application for a baker. however, the baker doesn't want to invest too much money. his only requirement is that he wants the customers to know which cupcakes are available at what time and in what quantity. so his core requirement is that the details of product should be in real time. what platform can jessie use to develop this application?
Answers: 1
image
Computers and Technology, 23.06.2019 17:30, Annlee23
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
image
Computers and Technology, 23.06.2019 18:30, sawyerfauver
The computers in the sales department did not have enough data storage capacity to contain all the information the department needed to store, and it was taking a long time for team members to access the data they needed. to fix the problem, the technician installed new, larger hard drives on all the computers.
Answers: 1
You know the right answer?
Modify the following code so that: Make the pool start with a random number ([20, 30] inclusive) of...

Questions in other subjects:

Konu
Mathematics, 19.05.2020 14:59
Konu
Mathematics, 19.05.2020 14:59