Thread: A guessing game

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    9

    Question A guessing game

    I have an assignment to write a number guessing game. That I think I can do, but there's a catch. The assignment reads..

    With each good guess out of 10 the player should be able to eliminate half of the numbers. Show why any number from 1 to 1000 can be guessed in 10 or fewer tries.

    Can someone explain?

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    do a websearch or a board search for "binary search".

    All will be revealed to you. Think about it first. How could you do it. And you can in your head quite easily.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    10
    what about if on the first error you give them an idea as to how much off they approximately are?

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    nope just a simple its this way and not that way
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Originally posted by zbap
    what about if on the first error you give them an idea as to how much off they approximately are?
    Then they could simply add (or subtract) the number given to their number and find the answer.

  6. #6
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Hey lyanette, think of it this way. If I said pick a number between 1 and 1000, what number would YOU pick? Why would you pick that number? If I said that number was too low, what number would you pick next? Why did you pick that one? Keep going. That should answer your question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 20q game problems
    By Nexus-ZERO in forum C Programming
    Replies: 24
    Last Post: 12-17-2008, 05:48 PM
  2. Need book to program game into multiplayer...
    By edomingox in forum Game Programming
    Replies: 3
    Last Post: 10-02-2008, 09:26 AM
  3. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  4. Random guessing game
    By Nalif in forum C Programming
    Replies: 16
    Last Post: 10-26-2006, 03:05 AM
  5. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM