Volkan Yazici wrote:

> I saw Roger HUI's solution 
> to Palindromic Pangram puzzle and [am] very
> interested in the algorithm used behind.
> I'm a  foreigner to J ... what I really wonder
> [about] is the algorithm/logic of the solution,
> instead of J itself. [W]ould somebody mind
> translating codes in the boxes located in
> solution page to pseudo codes?

I'm happy to do so.  At the end of this message I've
provided English interpretations of the contents of
those boxed areas of the web page in question,
http://www.jsoftware.com/jwiki/Puzzles/Palindromic_Pangram

I'd like to emphasize a few things, first. It is
important to note that what Roger Hui describes in
that webpage is a process through which he obtained a
solution, but not by writing a program that produced
the complete output. His notes that appear between the
J-session boxes are vital to understanding the
technique he used in solving the problem.

The boxed areas show console input (indented by three
spaces) and (sometimes) resulting output (flush left).
In my interpretation I've made these input and output
modes more explicit.

The translation I've given below might not seem like
pseudo-code, but it is a fair representation of the
meaning of the programs (insofar as I've succeeded).
I've glossed over some details (such as assignments).

This example makes a fine demonstration of how J
shines as a tool for problem-solving.  By putting the
J in plain English I hope those who do not (yet) read
J see how it's interactive nature assisted the process
of contriving a palindromic pangram.

[Begin list of eight boxes of J session input/output]
----------------------
J:      How many characters are in the provided
word-list ("dictionary")?
output: 1749989
J:      What are the final ten characters in the
dictionary, represented as numbers?
output: 10 122 121 122 122 121 118 97 115 10
J:      What is the count of words in the dictionary?
output: 173528
----------------------
J:      How many of the words are individually
palindromic?
output: 103
J:      What letters are included in such words,
combined?
output: abcdefghiklmnoprstuvwxy
J:      This is the alphabet.
output: abcdefghijklmnopqrstuvwxyz
J:      Removing included letters from the alphabet,
which letters remain?
output: jqz
----------------------
J:      How many words in the list contain the letter
j?
output: 2467
J:      How many words in the list contain the letter
q?
output: 2541
----------------------
J:      Show me, in a display of ten columns, all
words of not more than five letters that contain j.
(Resulting output is not shown.)
----------------------
J:      Show me, in a display of ten columns, all
words of not more than five letters that contain q.
(Resulting output is not shown.)
----------------------
J:      This is the centerpiece, the hand-constructed
palindrome that will serve as the center of the
pangram.
----------------------
J:      This is the framing piece, the
hand-constructed palindrome that contains all letters
missing from the center section.
J:      Create the palindromic pangram by joining
three pieces together. The centerpiece goes between
the framing piece to its left, and a reversed copy of
the framing piece to its right.
J:      Show the completed palindromic pangram.
output: bib civic dewed gag huh kayak oxo pullup refer
tenet raj ooze am suq us mae zoo jar tenet refer
pullup oxo kayak huh gag dewed civic bib
J:      How many characters make up this solution?
output: 136
----------------------
J:      Test that the candidate answer (1) is
palindromic, (2) is pangramic, and (3) is comprised
entirely of words that appear in the supplied
dictionary.
output: Confirmation
----------------------
[End list of eight boxes of J session input/output]



--
Tracy B. Harms
 
     A good programming language is a conceptual universe
     for thinking about programming.
                                        Alan Perlis


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to