Alveyworld Inc.
  • Home
  • Apple Basics
  • Join Alveyworld

Guess the Number Game

1/12/2016

0 Comments

 
AssignmentThis assignment is to make your computer program guess a number that the user chooses between 1 and 1000 in no more than 10 guesses.
The algorithm used in this assignment is called a binary search. After each guess, the algorithm cuts the number of possible answers to search in half. 
Your program should start by printing instructions to the screen, explaining that the user should pick a number between 1 and 1000 and the computer will guess it in no more than 10 tries. It then starts making guesses, and after each guess it asks the user for feedback. The user should be instructed to enter -1 if the computer needs to guess a lower number, 0 if the computer guessed correctly, and 1 if the computer needs to guess a higher number.
When the program guesses correctly, it should report how many guesses were required. If the user enters an invalid response, the instructions should be repeated and the user allowed to try again. You may assume that the user never gives a false answer.

(Read the full assignment here)

0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Computer Programming

    This course is a full year. Students will be studying the basics of computer programming. The programming tool we will use is the popular and powerful language called Python (Python.org). Students will be exploring the fundamental logical concepts of programming that apply to any programming language.

    computerprogrammingidisclosure.pdf
    File Size: 184 kb
    File Type: pdf
    Download File

    Archives

    April 2016
    February 2016
    January 2016
    November 2015
    October 2015
    September 2015
    August 2015

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
  • Apple Basics
  • Join Alveyworld