## Monday, April 04, 2005

i wrote a 'Game' for my HP Programmable Calculator along time ago...
Originally on my HP28, Then another Version for my 48sx, then another very elegant version for my 42, then another, fatter version for my 48gx.
The premise of The Game is very much like 'MasterMind'--
In that you try to Guess a Hidden Number.
For BeanHead; The Calculator Generates a Secret Number of Some Given Number of Digits, So that No Digit is Repeated...
That is: 246891 would be a Valid Secret Number
While 246841 would Not-- Since 4 is used Twice.
Then you Guess; Say 561092 and The Calculator Returns a '1' -- Meaning that you got One Right.
But it doesn't tell you Which One you got Right.
In most Versions that i wrote, the number of Digits was Fixed at Six.
And what Surprised me-- Was that i would Routinely Guess The Secret Number in as Little as 12 Guess',
Even though there were 151,200 different Secret Numbers Possible...!!!
With Only One Digit...! You would have to Guess 6 Times on Average...!
With Two Digits; 8 Guess', with a Possible Number of Secret Numbers of 90...!!!
Twelve Guess' for Six Numbers seemed Very Small to me...!
i was sure that i must have some Serious Jedi Electrifical ESP or Somesuch...!!!
With this Latest Version of BeanHead, i can Specify the number of Desired Digits from 1 to 8.
( The Screen Can't Handle More than Eight with Two Columns of Displayed Guess'! )
---
With One Digit; There are 10 Different Secret Numbers, and it would take, On Average 5.9 Guess' to Find It.
With Two Digits; There are 90 Secret Numbers; Optimal Guess': 7.9
Three Digits have 720 Secret Numbers and asks for 8.3 Guess'
Four Digits have 5,040 Secret Numbers and it's supposed that 9.9 Guess' will be made
Five Digits have 30,240 Secret Numbers and will expect 10.6 Guess'
Six Digits have 151,200 Secret Numbers and you might try 12.2 Guess'
Seven Digits have 604,800 Secret Numbers and you'll Need 14.1 Guess'
Eight Digits have 1,814,400 Secret Numbers and Requires 14.5 Guess'

--
Projected Guess' for
Nine Digits would be 15.7 Guess'
Ten Digits would be 16.9 Guess'
--
It seems that, with more Digits in The Secret Number, That actually provides the Guesser with More Digits that will provide more Clues to what the remaining Digits are...
--
Here's an Actual Game: Guess' Needed : 13
147852 : 0 Zero means None Correct!
258963 : 0 Notice that i'm adding one to each Digit... for now.
369074 : 1 One Right... But Which One...???
470185 : 2 Two Right...!!! Without trying...!
360185 : 3 ESP Guess' 0185 but 3 or 6 must be Right...
760289 : 3 ESP says 6, 0 & 8
860381 : 3 6,0 & 8 still look good...
960487 : 2 Oops...! What Now...!!!
790385 : 1 Everything is All Wrong...???
310245 : 2 Which 2 are Correct...???
140855 : 1 At this point, Look over all the Results...!
860142 : 5 HA! Which one is Wrong...???
860149 : 6 ESP or Supreme Logical Thinking...???
---
Still: 13 guess'...
[ ??? ]
---
Eep me for a listing of BeanHead... if you have an HP48, or if not, i could provide you with a rough Flowchart that you could use to write your own version...!