JavaRanch » Java Forums »
Other »
Programming Diversions
| Author |
Self-Documenting Pangrams
|
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
|
|
Task: Find a Self Documenting Pangram that includes your name in the "prefix"
Garrett Rowe found a pangram with six a's, one b, one c, three d's, thirty-four e's, seven f's, three g's, seven h's, nine i's, one j, one k, two l's, two m's, twenty-one n's, fifteen o's, two p's, one q, eleven r's, twenty-five s's, twenty-two t's, three u's, six v's, ten w's, three x's, five y's, and one z.
Your turn!
|
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
|
 |
Ryan McGuire
Ranch Hand
Joined: Feb 18, 2005
Posts: 890
|
|
From the linked page:
> Interestingly, it seems that some inputs never resolve to a solution. I have not investigated this too deeply, but multiple quiz solvers reported the same issue.
It would seem to me that there are some seed sentences that have have no stable solution. Let's say the entire rest of the seed sentence had no 'e's in it and the 'e' count was randomly set to 4: "four e's". After one correcting pass, that would become "one e". That would then have to be corrected to "two e's". Then back to "one e". Then "two e's". ...
These loops could of course involve many letters and have a fairly large loop size.
|
 |
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
|
|
Ryan McGuire wrote:From the linked page:
> Interestingly, it seems that some inputs never resolve to a solution. I have not investigated this too deeply, but multiple quiz solvers reported the same issue.
It would seem to me that there are some seed sentences that have have no stable solution. Let's say the entire rest of the seed sentence had no 'e's in it and the 'e' count was randomly set to 4: "four e's". After one correcting pass, that would become "one e". That would then have to be corrected to "two e's". Then back to "one e". Then "two e's". ...
These loops could of course involve many letters and have a fairly large loop size.
That's true. Although 'e' is a bad example since it is probably the most common letter. You could put a check in the program for cycles like this. I used the "Random Robbinsonizing" technique which has the advantage that you don't have to check for cycles, but theoretically you could never zero in on a solution given a certain prefix. Incidentally, I just found another one:
Garrett Rowe's Scala program found this pangram which has nine a's, one b, three c's, three d's, thirty-nine e's, seven f's, six g's, fourteen h's, twelve i's, one j, one k, three l's, three m's, twenty-two n's, fourteen o's, three p's, one q, eighteen r's, twenty-nine s's, twenty-four t's, six u's, four v's, eight w's, three x's, five y's, and one z.
|
 |
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
|
|
Since all good things come in threes, I'll do one more 'classic'
Only a fool would check that Garrett Rowe's computer generated sentence has seven a's, one b, five c's, four d's, fourty-one e's, seven f's, five g's, nine h's, eleven i's, one j, two k's, six l's, two m's, twenty-two n's, eighteen o's, two p's, one q, eleven r's, thirty s's, twenty-three t's, five u's, eight v's, nine w's, three x's, six y's, and one z.
|
 |
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
|
|
I'm getting cocky now. I've made some optimizations to my algorithm and now I'm on a roll. This is my last one.
This self-documenting pangram for the JavaRanch Meaningless Drivel forum contains nine a's, one b, four c's, four d's, thirty-seven e's, twelve f's, five g's, eight h's, nineteen i's, two j's, one k, six l's, five m's, twenty-nine n's, fifteen o's, two p's, one q, eleven r's, thirty-one s's, twenty-one t's, five u's, ten v's, six w's, three x's, five y's, and one z.
Found it after a mere 233,890 iterations.
|
 |
 |
|
|
subject: Self-Documenting Pangrams
|
|
|
|