Jump to content


Welcome to BrainDen.com - Brain Teasers Forum

Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account.
As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends.

Of course, you can also enjoy our collection of amazing optical illusions and cool math games.

If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top.
If you have a website, we would appreciate a little link to BrainDen.

Thanks and enjoy the Den :-)
Guest Message by DevFuse
 

Photo
- - - - -

Maximum times with optimize guess method in Guess number gam


  • Please log in to reply
2 replies to this topic

#1 Benson

Benson

    Junior Member

  • Members
  • PipPip
  • 23 posts

Posted 27 September 2007 - 12:04 PM

Guess number game: pick 4 digits from 0-9. one digit cannot pick twice.
Then, create a method to guess that number. If the position is right, marks "A". otherwise, marks "B". Then, count As and Bs.

For example, the answer is "1234", but guess "1024". Then the result is "2A1B".

With best guessing method (you need to find), and in worst situation, choose the maximum times the method needs to guess any 4 digits-non-repeat numbers.

a.4,
b.5
c.6
d.7
e.8
f.9
g.10
h.11
i.12
j.none of above.

Spoiler for solution

  • 0

#2 bonanova

bonanova

    bonanova

  • Moderator
  • PipPipPipPip
  • 5775 posts
  • Gender:Male
  • Location:New York

Posted 27 September 2007 - 12:11 PM

I did this, once, back in school.
It was a computer game, and there were colors instead of numbers,
and there could be repeats.

I'll try to work this out later,
but right now my intuition is saying it can be done in ...
Spoiler for solution

  • 0
The greatest challenge to any thinker is stating the problem in a way that will allow a solution.
- Bertrand Russell

#3 Benson

Benson

    Junior Member

  • Members
  • PipPip
  • 23 posts

Posted 30 September 2007 - 04:13 AM

Why is 8?

Maximum times -> worst case.

Worst case : So, if the answer is cheated, it should do:
Choose the result that ends up with largest availablilities.

For example, it always replies first guess with "1B" (5040 -> 1440).

So, the second guess as a optimize guess method should pick the inside range one to gest smallest narrow down-ed range. So, the output looks like, for example:
1234 -> 1B
4096 -> 1B
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users