Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a. Ask the player to think about an integer number between 0 and 128. b. Set a as the lower end, b as the high

a. Ask the player to think about an integer number between 0 and 128. b. Set a as the lower end, b as the high end, and t as the time of calculation c. Set initial values, a = 0, b = 128, t = 0 d. Calculate the average number between a and b. Set it as M. e. Set t = t + 1

f. Ask the player if M is the correct number: If yes, print The number you thought of is M and I guessed it t tries. End the process.

Else If t = 6 If yes, print I am sorry that I cannot guess it after 6 attempts. End the process. Else Ask the player if M is larger than the correct number: If yes, set b = M, jump to Step d. Else Set a = M, jump to Step d

Questions: Can the process catch if the number the player has chosen is 0 or 128? Why or why not? If 0 or 128 cannot be caught, what should be done to correct it?

Where should the test for the numbers 0 and 128 be placed?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe how theories advance psychological science.

Answered: 1 week ago