Write a game program guess which tries to guess

Assignment Help Computer Engineering
Reference no: EM13322627

Write a game program guess which tries to guess what number you have chosen in as few guesses as possible. It can only ask you whether the number is less than some other number. The dialog on the console panel should look something like this:

Choose a number between 0 and 16.

Is it less than 8? y

Is it less than 4? n

Is it less than 6? n

Is it less than 7? n

Your number is 7.

The expected user inputs are y for "yes" and n for "no".

You will want to keep track of the range of numbers that might have been chosen based on the answers that have been given so far until there is only one number left. You can approximately divide an integer by 2 by right-shifting it by one bit.

*NOTE: the program is the one doing the guessing while the user is the one who inputs a number 0-16 for the computer to guess.

 

Reference no: EM13322627

Questions Cloud

Find period of vibration and max acceleration of cylinder : A 30 lb uniform cylinder can roll without sliding on a 15 degree incline. A belt is attached to the rim of the cylinder, and a spring holds the cylinder at rest. If the center of the cylinder is moved 2 in.
What is the resistance of the car : A toy car is driven by a battery of 9V. it draws a current of 2mA. what is the resistance of the car
Write mips assembly language program to recursively compute : Write a MIPS assembly language program to recursively compute the nth term of Perrin's sequence. n will be input from the keyboard.
Define what is the initial pressure of h2s in the flask : An empty 5.00- flask is charged with 0.450g of pure H2S(g) , at 25 degrees celsius What is the initial pressure of H2S(g) in the flask
Write a game program guess which tries to guess : You will want to keep track of the range of numbers that might have been chosen based on the answers that have been given so far until there is only one number left. You can approximately divide an integer by 2 by right-shifting it by one bit.
What is the wavelength of the light in air : A glass sheet measuring 10cm X 25cm is covered by a very thin opaque coating. In the middle of this sheet is a thin, What is the wavelength of the light in air
What is the chlorine concentration when the tank is put back : A water tower containing 4000 m3 of water has been taken out of service to install a chlorine monitor. The concentration of chlorine in the water tower was 2.0 mg/L when the tower was taken out of service.
Benefits of enterprise agreements : Outline and analyse the nature, methods and benefits of enterprise agreements in enhancing workplace productivity.
Determine a sorption coefficient for the soil at the site : Chromium contamination is a problem at a number of hazardous-waste sites. At one site local concentrations of chromium reached 60,000 mg chromium/kg soil and 19,000 mg/L chromium in the water.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Problem on sql statement

Problem on  SQL statement

  Identify connectivity of each relationship

Identify connectivity of each relationship

  Knowledge of agency level enterprise operating systems

information of advanced Relational Database management Systems (RDMS) operating over a wide-area network. (note: Please explain RDMS operating over a WAN.)

  Which subnet mask should you select

Your company is assigned the network address 150.50.0.0. You need to create seven subnets on the network. A router on one of the subnets will connect the network to the Internet. All computers on the network will need access to the Internet. What ..

  Program on string representing

Program on  string representing

  What are the pros and cons of a dhcp server

What are the pros and cons of having a DHCP server on each network segment, versus having some of the network segments receive their IP address and network configuration via a router using a DHCP relay agent? Consider how your answer depends on th..

  Define how each type compromises a system

define how each type compromises a system. How can these different types of malware be stopped.

  Listing the name and salary of all employees

List the name and hours worked per week for each employee who works on the Reorganization project. Order the list by hours worked in explaning order and by last name within each amount of hours.

  Find the value of standardization and the move to xhtml

find the value of standardization and the move to XHTML

  Design a "clear" button that clears all of the hours worked

make a "Calculate" button to perform the pay calculations for all of the employees.

  Take a demand-paging system

Consider a demand-paging system with the following time-measured utilizations.

  Dbmss have their own language

Explain Do all DBMSs have their own language? Is it similar to a programming language.

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