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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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