Jump to content
BrainDen.com - Brain Teasers
  • 0

Maximum times with optimize guess method in Guess number gam


Guest
 Share

Question

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.

The answer is d. 7 times.

Guess#1: 1234, Result: 0A1B ... MaxRemains: 1440

Guess#2: 0156, Result: 0A1B ... MaxRemains: 378

Guess#3: 2507, Result: 0A1B(a) or 0A2B(B) ... MaxRemains: 88

Guess#4a: 5672, Result: 0A0B(a), 0A1B(B) or 0A2B© ... MaxRemains: 18

--Guess#5a: 8049, Result: 0A3B(a), 0A4B(B), 1A2B©, 1A3B(d), or 2A2B(e) ... MaxRemains: 3

----Guess#6a: 3890, Result: 1A3B(a) or 2A2B(B) ... MaxRemains: 1

------Guess#7a: 9380 ... 7 times

------Guess#7b: 3980 ... 7 times

--Guess#5b: 4781, Result: 0A2B or 1A2B ... MaxRemains: 3

--Guess#5c: 6748, Result: 1A1B or 1A2B ... MaxRemains: 3

Guess#4b: 3074, Result: 0A1B(d), 0A2B(e) or 1A1B(f) ... MaxRemains: 14

--Guess#5d. 6728, Result: 0A3B, 0A4B, 1A1B, or 2A2B ... MaxRemains: 2

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...