Write a function playexpert

Assignment Help Computer Engineering
Reference no: EM13324667

Write a function playExpert(marbles) that given a number of marbles returns the number of marbles that the computer will take following the expert mode rules. The number of marbles left on the pile will be 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 return a random number of marbles.

>>> playExpert(90)

27 (if computer takes 27 there will 90-27= 63 (26-1) marbles left )

>>playExpert(31) number of marbles a power of 2 minus 1
12
Make sure that your tests show that the function works for both cases.

 

Reference no: EM13324667

Questions Cloud

Create a text file called scores.txt with notepad : Create a text file called scores.txt with notepad with two lines: the first two lines are the computer scores and the second line human scores.
Describe the order driven market trading system : Describe the order driven market trading system , the quote driven trading system and the hybrid trading system and provide examples.
Define what is the concentration of the acid : If an 20 mL acetic acid is neutralized with 50 mL of 0.8 M NaOH, what is the concentration of the acid
Find the maximum time taken for the block to come to a rest : If the initial speed of the block is increased to infinity, it turns out that the time taken for the block to come to a rest approaches a finite value whereas the distance traveled approaches infinity, Find the maximum time taken for the block to c..
Write a function playexpert : Write a function playExpert(marbles) that given a number of marbles returns the number of marbles that the computer will take following the expert mode rules.
What must the risk free rate be : A stock has an expected return of 15.9 percent and a beta of 1.70, and the expected return on the market is 11.2 percent. What must the risk free rate be?
Evaluate the minimum concentration of koh required : Potassium hydroxide is used to precipitate each of the cations from their respective solution. Determine the minimum concentration of KOH required for precipitation to begin in 2.8*10^-3 M Fe(NO3)2
The gsm network includes several subcomponents : The GSM network includes several subcomponents How does GSM allow multiple vendors opportunity to supply hardware that are cross functional in this network?
Determine the strength of the electric field : A very small call (m = 4 gms) hangs on a thread at an angle of ? = 30o. What is the strength of the electric field

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write program that computes the cost of a long distance call

Write program that computes the cost of a long distance call

  Programming for a pattern

Write down a program in order to print the following pattern on screen.

  Applications of electronic data in health care field

Analyze the recent applications of the electronic data interchange within the health care field and find which is the most promising. Describe your rationale.

  Create a program generates a 3-digit random number 100 times

Write down a C# application that generates a 3-digit random number 100 times. Display the output for each of the generated numbers and the sum of all 100 numbers. Every 10th number you should display a String consisting of a any phrase of your cho..

  Threats resolved by redhat linux

The switches have the VLANs defined, one for the offices, one for the MIS, and one for the warehouse. Recognize what threats are resolved by the Redhat linux.

  Describe python modules and packages

Describe Python modules and packages

  A java based program to calculate the maximum heart rate

Write down a java based program to calculate the Maximum heart rate of person based on the person age and height. Notify for the low end of the target zone (65%) and high end of the target zone (90%).

  What is the best way for sending people out

What is the best way for sending people out if one wants the total competition to be over as early as possible? More precisely give an efficient algorithm that produces a schedule whose completion time is as small as possible.

  Why the computer storage is getting bigger

as it is true that computer storage is getting bigger and faster, how does that help us? As we start saving more and more information, it is really possible for the average person to keep all of the information organized? For large companies sure,..

  What is the atleast number of keys

What is the minimum number of keys that are hashed to their home positions using the linear probing technique? define with an example using a 5-cell array.

  Using a simulator the boson simulator

Using a simulator the boson simulator (or routers) I want to create a four router topology. Using any interfaces of my choice. I am given /24 networks - choosing interface addresses from the given network ID.

  What are java predefined methods

What are java predefined methods

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd