text:
Find The Wordiest Combination Lock
I have a combination padlock which has letters instead of numbers. It looks like this: http://pictures.picpedia.com/2012/09/Word_Combination_Padlock.jpg There are 5 reels, each of which has 10 different letters on it.
Most people like to use a word for their combination rather than an arbitrary string of letters. (Less secure, of course, but easier to remember.) So when manufacturing the lock, it would be good to build it to have a combination of letters which can be used to create as many 5-letter English words as possible.
Your task, should you choose to accept it, is to find an assignment of letters to reels which will allow as many words as possible to be created. For example, your solution might be
ABCDEFGHIJ DEFGHIJKLM ZYXWVUTSR ABCDEFGHIJ ABCDEFGHIJ
(If you weren't feeling too imaginative, that is).
For consistency, please use the word list at http://www.cs.duke.edu/~ola/ap/linuxwords
Any 5-letter word in that list is OK, including proper names. Ignore Sino- and L'vov and any other words in the list which contain a non a-z character.
The winning program is the one which produces the largest set of words. In the event that multiple programs find the same result, the first one to be posted wins. The program should run in under 5 minutes.
Edit: since activity has died down, and no better solutions have come out, I declare Peter Taylor the winner! Thanks everyone for your inventive solutions.

How can one count proper names considering that they vary so much across cultures?

@elssar, If I understand correctly, any word in the list is OK, regardless if it's a proper name (in any culture).

Oh right, the in there, didn't see that

So, not a code question; but logic?

This is tagged as [tag:code-challenge]: what's the challenge? All you've asked for is the value which maximises a function whose domain's size is about 110.3 bits. So it's not feasible to brute-force the problem, but it should be feasible to get the exact answer, and maybe even to prove it correct. Bearing all that in mind, what are the prerequisites for an answer to be considered, and what criteria are you going to use to select a winner?

How do we handle the words with hyphens and apostrophes?

Edited to try and clear up the questions above.

+1 Lovely challenge. Anyone can produce an answer. But finding the optimal answer is far harder than it first seems.

The current best I found was 1210 and since then just heats the room. Has anyone any higher number? @PeterTaylor: It is possible to reduce the number of bits a bit (remove combinations which for each position alone are not able to produce at least 1210 possible words).

@Howard, I looked into that when the best answer I'd seen was 1115 and it was pretty bad. My current best is 1275, and I'm about to post the code.

@Howard, in fact even with a cutoff of 1275, there are 109.7 bits of domain to brute force. Go up to a cutoff of 2000 and there are 99.5 bits, which is still impractical, and likely to exclude all actual results anyway.

Here's the word checker I'm using.  Press input and replace the strings with your strings.  (It'd be nice if you put this in the main question.)

@PeterTaylor About the bits thing - just forgot the ;-) after "reduce a bit". I would be happy to see if anybody can reduce calculation time to reasonable ranges.

1275 words by simple greedy hill-climbing
Code is C#. Solution produced is
Score 1275 from ^[bcdfgmpstw][aehiloprtu][aeilnorstu][acdeklnrst][adehklrsty]$

I'm using that output format because it's really easy to test:
grep -iE "^[bcdfgmpstw][aehiloprtu][aeilnorstu][acdeklnrst][adehklrsty]$" linuxwords.txt | wc

namespace Sandbox {
    class Launcher {
        public static void Main(string[] args)
        {
            string[] lines = _Read5s();
            int[][] asMasks = lines.Select(line => line.ToCharArray().Select(ch => 1 << (ch - 'a')).ToArray()).ToArray();
            Console.WriteLine(string.Format("{0} words found", lines.Length));

            // Don't even bother starting with a good mapping.
            int[] combos = _AllCombinations().ToArray();
            int[] best = new int[]{0x3ff, 0x3ff, 0x3ff, 0x3ff, 0x3ff};
            int bestSc = 0;
            while (true)
            {
                Console.WriteLine(string.Format("Score {0} from {1}", bestSc, _DialsToString(best)));

                int[] prevBest = best;
                int prevBestSc = bestSc;

                // Greedy hill-climbing approach
                for (int off = 0; off < 5; off++)
                {
                    int[] dials = (int[])prevBest.Clone();

                    dials[off] = (1 << 26) - 1;
                    int[][] filtered = asMasks.Where(mask => _Permitted(dials, mask)).ToArray();
                    int sc;
                    dials[off] = _TopTen(filtered, off, out sc);
                    if (sc > bestSc)
                    {
                        best = (int[])dials.Clone();
                        bestSc = sc;
                    }
                }

                if (bestSc == prevBestSc) break;
            }

            Console.WriteLine("Done");
            Console.ReadKey();
        }

        private static int _TopTen(int[][] masks, int off, out int sc)
        {
            IDictionary<int, int> scores = new Dictionary<int, int>();
            for (int k = 0; k < 26; k++) scores[1 << k] = 0;

            foreach (int[] mask in masks) scores[mask[off]]++;

            int rv = 0;
            sc = 0;
            foreach (KeyValuePair<int, int> kvp in scores.OrderByDescending(kvp => kvp.Value).Take(10))
            {
                rv |= kvp.Key;
                sc += kvp.Value;
            }
            return rv;
        }

        private static string _DialsToString(int[] dials)
        {
            StringBuilder sb = new StringBuilder("^");
            foreach (int dial in dials)
            {
                sb.Append('[');
                for (int i = 0; i < 26; i++)
                {
                    if ((dial & (1 << i)) != 0) sb.Append((char)('a' + i));
                }
                sb.Append(']');
            }
            sb.Append('$');
            return sb.ToString();
        }

        private static IEnumerable<int> _AllCombinations()
        {
            // \binom{26}{10}
            int set = (1 << 10) - 1;
            int limit = (1 << 26);
            while (set < limit)
            {
                yield return set;

                // Gosper's hack:
                int c = set & -set;
                int r = set + c;
                set = (((r ^ set) >> 2) / c) | r;
            }
        }

        private static bool _Permitted(int[] dials, int[] mask)
        {
            for (int i = 0; i < dials.Length; i++)
            {
                if ((dials[i] & mask[i]) == 0) return false;
            }
            return true;
        }

        private static string[] _Read5s()
        {
            System.Text.RegularExpressions.Regex word5 = new System.Text.RegularExpressions.Regex("^[a-z][a-z][a-z][a-z][a-z]$", System.Text.RegularExpressions.RegexOptions.Compiled);
            return File.ReadAllLines(@"d:\tmp\linuxwords.txt").Select(line => line.ToLowerInvariant()).Where(line => word5.IsMatch(line)).ToArray();
        }
    }
}

I was just about to edit my answer with this exact solution, but you beat me to it.

When I run the same hill-climbing search from 1000 random starting combinations and select the best of the 1000 local optima found, it seems to always produce the same solution, so it seems likely to be the global optimum.

That depends on your definition of likely ;-) But it is further "confirmed" by other approaches which yield 1275 as maximum. (And where did the Quantum-Tic-Tac-Toe go?)

@Howard, that was just an artifact of .Net not supporting multiple entry points in a single project. I have one "sandbox" project which I use for stuff like this, and I usually change the Main method to call different _Main methods.

I tried a genetic algorithm and got the same result in a few minutes, and then nothing in the next hour, so I wouldn't be surprised if it's the optimum.

Several different approaches I have tried have all also settled on this same solution. I agree- I see no reason to think it isn't optimal.

You should be able to use ^\w{5}$ or ^[a-z]{5}$ as your regex filter.

Also grep -c as a sidenote.

Python (3), 1273 ≈ 30.5%
This is a really naïve approach: keep a tally of the frequency of each letter in each position, then eliminate the "worst" letter until the remaining letters will fit on the reels.  I'm surprised it seems to do so well.
What's most interesting is that I have almost exactly the same output as the C# 1275 solution, except I have an N on my last reel instead of A.  That A was my 11th-to-last elimination, too, even before throwing away a V and a G.
from collections import Counter

def main(fn, num_reels, letters_per_reel):
    # Read ye words
    words = []
    with open(fn) as f:
        for line in f:
            word = line.strip().upper()
            if len(word) == num_reels and word.isalpha():
                words.append(word)

    word_pool_size = len(words)

    # Populate a structure of freq[reel_number][letter] -> count
    freq = [Counter() for _ in range(num_reels)]
    for word in words:
        for r, letter in enumerate(word):
            freq[r][letter] += 1

    while True:
        worst_reelidx = None
        worst_letter = None
        worst_count = len(words)
        for r, reel in enumerate(freq):
            # Skip reels that already have too-few letters left
            if len(reel) <= letters_per_reel:
                continue

            for letter, count in reel.items():
                if count < worst_count:
                    worst_reelidx = r
                    worst_letter = letter
                    worst_count = count

        if worst_letter is None:
            # All the reels are done
            break

        # Discard any words containing this worst letter, and update counters
        # accordingly
        filtered_words = []
        for word in words:
            if word[worst_reelidx] == worst_letter:
                for r, letter in enumerate(word):
                    freq[r][letter] -= 1
                    if freq[r][letter] == 0:
                        del freq[r][letter]
            else:
                filtered_words.append(word)
        words = filtered_words

    for reel in freq:
        print(''.join(sorted(reel)))

    print("{} words found (~{:.1f}%)".format(
        len(words), len(words) / word_pool_size * 100))

Produces:
BCDFGMPSTW
AEHILOPRTU
AEILNORSTU
ACDEKLNRST
DEHKLNRSTY
1273 words found (~30.5%)

What does the percentage represent?

percentage of the given words that can be made with the proposed set of reels

Okay. (Whoa, I just saw who you were.)

ha, small world.

Mathematica, 1275 words again and again...
This code is not Golfed as the question does not appear to call for that.
wordlist = Flatten @ Import @ "http://www.cs.duke.edu/~ola/ap/linuxwords";
shortlist = Select[ToLowerCase@wordlist, StringMatchQ[#, Repeated[LetterCharacter, {5}]] &];
string = "" <> Riffle[shortlist, ","];

set = "a" ~CharacterRange~ "z";
gb = RandomChoice[set, {5, 10}];

best = 0;
While[True,
  pos = Sequence @@ RandomInteger /@ {{1, 5}, {1, 10}};
  old = gb[[pos]];
  gb[[pos]] = RandomChoice @ set;
  If[best < #,
    best = #; Print[#, "   ", StringJoin /@ gb],
    gb[[pos]] = old
  ] & @ StringCount[string, StringExpression @@ Alternatives @@@ gb]
]

The word count quickly (less than 10 seconds) evolves to 1275 on most runs but never gets beyond that.  I tried perturbing the letters by more than one at a time in an attempt to get out of a theoretical local maximum but it never helped.  I strongly suspect that 1275 is the limit for the given word list.  Here is a complete run:

36   {tphcehmqkt,agvkqxtnpy,nkehuaakri,nsibxpctio,iafwdyhone}

37   {tpicehmqkt,agvkqxtnpy,nkehuaakri,nsibxpctio,iafwdyhone}

40   {tpicehmqkt,agvkqxtnpy,nkehuaakri,nsibxpctio,iafldyhone}

42   {tpicehmqkt,agvkqxtnpy,nkehuaakri,nsfbxpctio,iafldyhone}

45   {tpicehmrkt,agvkqxtnpy,nkehuaakri,nsfbxpctio,iafldyhone}

48   {tpicehmrkt,agvkwxtnpy,nkehuaakri,nsfbxpctio,iafldyhone}

79   {tpicehmskt,agvkwxtnpy,nkehuaakri,nsfbxpctio,iafldyhone}

86   {tpicehmskt,agvkwxtnpy,nkehuaakri,esfbxpctio,iafldyhone}

96   {tpicehmskt,agvkwxtnpy,nkehuaokri,esfbxpctio,iafldyhone}

97   {tpicehmskt,agvkwxtnpy,nkehuaokri,esfbxpctio,ipfldyhone}

98   {tpicehmskv,agvkwxtnpy,nkehuaokri,esfbxpctio,ipfldyhone}

99   {tpicehmskv,agvkwxtnpy,nkehuaokri,esfbzpctio,ipfldyhone}

101   {tpicehmskv,agvkwxtnpy,nkehuaokri,esfhzpctio,ipfldyhone}

102   {tpicehmskv,agvkwxtnpy,nkehuaokri,esfhzpctno,ipfldyhone}

105   {tpicehmskv,agvkwxtnpy,nkehuaokri,esfhzmctno,ipfldyhone}

107   {tpicehmskn,agvkwxtnpy,nkehuaokri,esfhzmctno,ipfldyhone}

109   {tpgcehmskn,agvkwxtnpy,nkehuaokri,esfhzmctno,ipfldyhone}

115   {tpgcehmsan,agvkwxtnpy,nkehuaokri,esfhzmctno,ipfldyhone}

130   {tpgcehmsan,agvkwxtnpy,nkehuaokri,esfhzmctno,ipfldyhons}

138   {tpgcehmsan,agvkwxtnpy,nkehuaokri,esfhzmctno,ipfldytons}

143   {tpgcehmsab,agvkwxtnpy,nkehuaokri,esfhzmctno,ipfldytons}

163   {tpgcehmsab,auvkwxtnpy,nkehuaokri,esfhzmctno,ipfldytons}

169   {tpgcehmsab,auvkwctnpy,nkehuaokri,esfhzmctno,ipfldytons}

176   {tpgcehmsab,auvkwctnpy,nkehuaokri,esfhzmctno,ihfldytons}

189   {tpgcehmsab,auvkwchnpy,nkehuaokri,esfhzmctno,ihfldytons}

216   {tpgcehmsab,auvkwchnpy,nkehtaokri,esfhzmctno,ihfldytons}

220   {tpgcehmsab,auvkwthnpy,nkehtaokri,esfhzmctno,ihfldytons}

223   {tpgcehmsab,auvkwthnpy,nkehtaokri,esfhbmctno,ihfldytons}

234   {tpgcehmsab,auvkwthnpy,nkegtaokri,esfhbmctno,ihfldytons}

283   {tpgcehmsab,auvkwthnpy,nkegtaokri,esfhbrctno,ihfldytons}

285   {tpdcehmsab,auvkwthnpy,nkegtaokri,esfhbrctno,ihfldytons}

313   {tpdcehmsab,auvkwthnly,nkegtaokri,esfhbrctno,ihfldytons}

371   {tpdcehmsab,auvkethnly,nkegtaokri,esfhbrctno,ihfldytons}

446   {tpdcehmsab,auvoethnly,nkegtaokri,esfhbrctno,ihfldytons}

451   {tpdcehmslb,auvoethnly,nkegtaokri,esfhbrctno,ihfldytons}

465   {tpdcwhmslb,auvoethnly,nkegtaokri,esfhbrctno,ihfldytons}

545   {tpdcwhmslb,auioethnly,nkegtaokri,esfhbrctno,ihfldytons}

565   {tpdcwhmslb,auioethnly,nkegtaocri,esfhbrctno,ihfldytons}

571   {tpdcwhmslb,auioethnly,nkegtaocri,esfhwrctno,ihfldytons}

654   {tpdcwhmslb,auioethnly,nkegtaocri,esfhwrctno,ihfedytons}

671   {tpdcwhmslb,auioethnly,nkegtaocri,esfhirctno,ihfedytons}

731   {tpdcwhmslb,auioethnly,nkegtaocri,esfhirctno,ihredytons}

746   {tpdcwhmslb,arioethnly,nkegtaocri,esfhirctno,ihredytons}

755   {tpdcwhmslb,arioethnuy,nkegtaocri,esfhirctno,ihredytons}

772   {tpdcwhmslb,arioethnuy,nkegtaocri,ekfhirctno,ihredytons}

786   {tpdcwhmslb,arioethnuy,nkegtaocri,ekfhirctno,lhredytons}

796   {tpdcwhmslb,arioethnuy,nkegtaocri,ekfhgrctno,lhredytons}

804   {tpdcwhmslb,arioethwuy,nkegtaocri,ekfhgrctno,lhredytons}

817   {tpdcwhmslb,arioethwuy,nklgtaocri,ekfhgrctno,lhredytons}

834   {tpdcwhmslb,arioethwuy,nklgtaocri,ekfhdrctno,lhredytons}

844   {tpdcwhmslb,arioethwup,nklgtaocri,ekfhdrctno,lhredytons}

887   {tpdcwhmslb,arioethwup,nklgtaocri,ekshdrctno,lhredytons}

901   {tpdcwhmslb,arioethwup,nklgtaouri,ekshdrctno,lhredytons}

966   {tpdcwhmslb,arioethwup,nklgtaouri,elshdrctno,lhredytons}

986   {tpdcwhmsfb,arioethwup,nklgtaouri,elshdrctno,lhredytons}

1015   {tpdcwhmsfb,arioethwup,nklgtaouri,elsidrctno,lhredytons}

1039   {tpdcwhmsfb,arioethwup,nklgtaouri,elsidrctno,khredytons}

1051   {tpdcwhmsfb,arioethwup,nklgtaouri,elskdrctno,khredytons}

1055   {tpdcwhmsfb,arioethwup,nklgtaouri,elskdrctno,khredytlns}

1115   {tpdcwhmsfb,arioethwup,nelgtaouri,elskdrctno,khredytlns}

1131   {tpdcwhmsfb,arioethwup,nelwtaouri,elskdrctno,khredytlns}

1149   {tpdcwhmsfb,arioethwup,nelwtaouri,elskdrctna,khredytlns}

1212   {tpdcwhmsfb,arioelhwup,nelwtaouri,elskdrctna,khredytlns}

1249   {tpdcwhmsfb,arioelhwup,nelstaouri,elskdrctna,khredytlns}

1251   {tpgcwhmsfb,arioelhwup,nelstaouri,elskdrctna,khredytlns}

1255   {tpgcwdmsfb,arioelhwup,nelstaouri,elskdrctna,khredytlns}

1258   {tpgcwdmsfb,arioelhwup,nelstaouri,elskdrctna,khredytlas}

1262   {tpgcwdmsfb,arioelhwut,nelstaouri,elskdrctna,khredytlas}

1275   {tpgcwdmsfb,arioelhput,nelstaouri,elskdrctna,khredytlas}

Here are some other "winning" selections:
{"cbpmsftgwd", "hriuoepatl", "euosrtanli", "clknsaredt", "yhlkdstare"}
{"wptdsgcbmf", "ohlutraeip", "erotauinls", "lknectdasr", "sytrhklaed"}
{"cftsbwgmpd", "ropilhtaue", "niauseltor", "clstnkdrea", "esdrakthly"}
{"smgbwtdcfp", "ihulpreota", "ianrsouetl", "ekndasctlr", "kehardytls"}

As Peter comments these are actually the same solution in different orders.  Sorted:
{"bcdfgmpstw", "aehiloprtu", "aeilnorstu", "acdeklnrst", "adehklrsty"}

@belisarius Thanks!  It's more interesting with ENABLE2k.

I've been considering Combinatorica's NetworkFlow for this one, but haven't found a useful way to use it

@belisarius I hope you find a way; I'd like to see that.

@belisarius by the way my code for shortlist feels long, and though this is not Golf I'd like something shorter.  Can you help?

I think your "winning" selections are all the same modulo permutation within dials.

@Peter I suspect(ed) that myself but I was too lazy to prove it.  How long does your C code take to converge on the 1275 solution?  (Or how many per second if it's really fast.)

It takes 12 times round the main loop to converge, and running under Mono on my Linux box does it 100 times in just over 5 seconds.

Python, 1210 words (~ 29%)
Assuming I counted the words correctly this time, this is slightly better than
FakeRainBrigand's solution.  The only difference is I add each reel in order, and then remove all words from the list that don't match the reel so I get a slightly better distribution for the next reels.  Because of this, it gives the exact same first reel.
word_list = [line.upper()[:-1] for line in open('linuxwords.txt','r').readlines() if len(line) == 6]
cur_list = word_list
s = ['']*5
for i in range(5):
    count = [0]*26
    for j in range(26):
        c = chr(j+ord('A'))
        count[j] = len([x for x in cur_list if x[i] == c])
    s[i] = [chr(x+ord('A')) for x in sorted(range(26),lambda a,b: count[b] - count[a])[:10]]
    cur_list = filter(lambda x:x[i] in s[i],cur_list)
for e in s:
    print ''.join(e)
print len(cur_list)

The program outputs
SBCAPFDTMG
AOREILUHTP
ARIOLENUTS
ENTLRCSAID
SEYDTKHRNL
1210

Nice, and 1210 works in my checker.

iPython (273 210 Bytes, 1115 words)
1115/4176* ~ 27%
I calculated these in iPython, but my history (trimmed to remove debugging) looked like this.
with open("linuxwords") as fin: d = fin.readlines()
x = [w.lower().strip() for w in d if len(w) == 6]
# Saving for later use:
# with open("5letter", "w") as fout: fout.write("\n".join(x))
from string import lowercase as low
low=lowercase + "'"
c = [{a:0 for a in low} for q in range(5)]
for w in x:
    for i, ch in enumerate(w):
        c[i][ch] += 1

[''.join(sorted(q, key=q.get, reverse=True)[:10]) for q in c]

If we're going for short; I could trim it to this.
x = [w.lower().strip() for w in open("l") if len(w)==6]
c=[{a:0 for a in"abcdefghijklmnopqrstuvwxyz'-"}for q in range(5)]
for w in[w.lower().strip()for w in open("l") if len(w)==6]:
 for i in range(5):c[i][w[i]]+=1
[''.join(sorted(q,key=q.get,reverse=True)[:10])for q in c]

Shortened:
c=[{a:0 for a in"abcdefghijklmnopqrstuvwxyz'-"}for q in range(5)]
for w in[w.lower() for w in open("l")if len(w)==6]:
 for i in range(5):c[i][w[i]]+=1
[''.join(sorted(q,key=q.get,reverse=True)[:10])for q in c]

My results were: ['sbcapfdtmg', 'aoeirulhnt', 'aironeluts', 'etnlriaosc', 'seyrdtnlah'].
*My math on the 4176 may be a little short due to words with hyphens or apostrophes being omitted

While this solution is a good heuristic and will likely return a good solution, I do not believe it is guaranteed to return the optimal solution.  The reason is that you are not capturing the constraints between the reels: You are treating each reel as an independent variable when in fact they are dependent.  For example, it might be the case that the words that share the most common first letter have a large variance in the distribution of their second letter.  If such is the case, then your solution might produce combinations of reels that in fact do not allow any words at all.

Q
? (todo) words
Words should be stored in a file called words
(!:')10#/:(desc')(#:'')(=:')(+:)w@(&:)(5=(#:')w)&(&/')(w:(_:)(0:)`:words)in\:.Q.a

Runs in about 170 ms on my i7. It analyses the wordlist, looking for the most common letter in each position (obviously filtering out any non-candidates). It's a lazy naive solution but produces a reasonably good result with minimal code.
Results:
"sbcapfdtmg"
"aoeirulhnt"
"aironeluts"
"etnlriaosc"
"seyrdtnlah"

How many 5 letter words did you find?

I did the same thing in python and got 16353.

Is this the same greedy algorithm as FakeRainBrigand's?

It appears to be the same result as FakeRainBrigand's, so my count is probably wrong.

@cardboard_box, your result is definitely wrong. There aren't that many 5-letter words in the dictionary.

Yep, it's 1115.  I counted the number of correct letters in any word instead of the number of correct words.  I think I need another coffee.

Edit: Now that the rules have been modified, this approach is disqualified.  I'm going to leave it here in case anyone is interested until I eventually getting around to modifying it for the new rules.
Python: 277 Characters
I'm pretty sure that the generalized version of this problem is NP-Hard, and the question didn't require finding the fastest solution, so here's a brute-force method of doing it:
import itertools,string
w=[w.lower()[:-1] for w in open('w') if len(w)==6]
v=-1
for l in itertools.product(itertools.combinations(string.ascii_lowercase,10),repeat=5):
 c=sum(map(lambda d:sum(map(lambda i:i[0] in i[1],zip(d,l)))==5,w))
 if c>v:
  v=c
  print str(c)+" "+str(l)

Note that I renamed the word list file to just "w" to save a few characters.
The output is the number of words that are possible from a given configuration followed by the configuration itself:
34 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'))
38 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k'))
42 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l'))
45 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'n'))
50 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'r'))
57 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 's'))
60 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'k', 's'))
64 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'l', 's'))
67 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'n', 's'))
72 (('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'r', 's'))
...

The last line of output before the program terminates is guaranteed to be the optimal solution.

I'd love to see a C or ASM version of your code so that it could actually finish this year :-)  Or at least run it until it gets to 1116.  Could you write it without itertools, so I can run it on jython?  (faster than regular python, but easier than cython.)

Nevermind about the jython thing.  I needed to grab the alpha.  It still crashed (too much memory) but that appears unavoidable.

I'm pretty sure that even if this were implemented in assembly it would take longer than my lifetime to complete on current hardware :-P

The issue is that I am iterating over (26 choose 10)^5 ≈ 4.23*10^33 possibilities.  Even if we could test one possibility per nanosecond, it would take about 10^7 times the current age of the universe to finish.

There are two characters which don't appear in the 5th position in any word in the given word list, so you can reduce the number of possibilities by a factor of about 4. That's how I got "about 110.3 bits" in my comment on the question.


text:
Emulate an Intel 8086... COMPLETELY

Possible Duplicate:
Emulate an Intel 8086 CPU

I know that there already is a code golf for this, but that one didn't require much. This one, however, is for masochists only! >:) OK, you need to emulate an entire 8086, every single opcode. Not every flag needs to be computed, but every single documented opcode needs to be implemented.
However, that's just the beginning. I STRONGLY encourage you to support more than just this. NEC V20? Why not? Soviet clones? Don't mind if I do.
For some help, opcodes 0x60 - 0x6F are just aliases for opcodes 0x70 - 0x7F on the 8086 and 8088 ONLY. If you ask the guy who runs reenigne.org, he'll say the same thing, simply because it's been proven by hardware tests, on an IBM XT.
Anyways, for bonus points, emulate an entire V20, 286, or 386, no facets left unemulated.

What is the metric here?

added the [tag:code-challenge] tag. every puzzle needs a 'type'.

The other thread you mention is Emulate an Intel 8086 CPU, and I'm voting to close as a duplicate of that on the basis that any solution to this challenge is also a solution to that challenge. If you want solutions to the extended challenge to get double points, I think a better approach is to find someone willing to sponsor bounties.

Minority Opinion: I don't consider it a problem to have an expanded version of the same challenge. Something you can graduate towards by first solving the smaller one. But I cast the final close vote as "Not a real question" for the reason cited by dmckee. The beauty of the original question was the well-chosen subset and the well-written test program which exercised the desired subset. Where does this one end? Pentium? MMX? The fun was in the 0-60 part. That said, if this were edited to provide nicer constraints, perhaps a single output device, and a testing program, that'd be different.hth

... and most vitally winning criteria.

C++ - 5084 lines
github.com/Alegend45/IBM5150/blob/master/cpu.h
This emulates the entire 8086, the 80186 instruction set, and part of the NEC V20. This took me over 3 weeks.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Bouncing ball simulation
Print, on STDOUT, a pattern which shows in what direction a bouncing ball will take.
The following assumptions are made:

The ball starts at the top left corner: 0, 0 with zero initial velocity.
Gravity is 9.8ms^-2 exactly, towards the floor (y positive.)
The ball weighs 500g exactly.
The ball bounces at 45 or 135 degrees to the floor unless you want to add the appropriate calculations to add variable trajectories. (Bonus arbitrary points!)
The ball has a spring constant coefficient of restitution/bouncyness constant of 0.8 exactly.
The ball is perfectly spherical and does not deform when it bounces.
The room is 25 characters high, 130 characters wide. Each x and y is 1 metre and each ball position represents a discrete sample -- the exact time period is deliberately unspecified, but the display should make the ball's path sufficiently clear. The output should show the path of the ball, not just the final position.
The floor and ball should be indicated using characters on STDOUT, which may be the same. The presence of no ball or floor surface shall be indicated with a space character.
You are allowed to assume rounding to three decimal places in any calculations. (Solutions using purely integers may be particularly interested in this rule.)
The simulation stops when either the ball does not move from the floor or it leaves the room (x > width of area.)
The program must simulate the ball's path, not simply load it from a file or have it encoded somehow in the program. The test for this will be to optionally change one of the constants. If the program does not calculate a new, correct result, then it does not qualify.

Example output:
*
*
*
*
*
*
*
*
*
*                         ***********
*                    *****           ****
*                 ****                   ***
*               ***                        ***
*              **                             **
*           ***                                 **
*          **                                     **                          *********
*         *                                        **                      ****       ****
*       **                                           *                   **               **
*      *                                              **               **                   **
*     *                                                 *            **                       **              ********
*   **                                                   *          **                         **          ****      ****
*  *                                                      **      **                             **       **            **
* *                                                        **    **                               **    **                **    **
**                                                          **  **                                 **  **                  **  **
*                                                            ****                                   ****                    ***
**********************************************************************************************************************************

Determination of winner. I will accept the answer which:

Meets the rules as defined above.
Bonus featureness will be considered.
Is the shortest and most elegant (subjective decision.)

Is the input and/or starting speed (energy?) missing, or am I blind? As I see it now I could just draw the box and say the ball is stationary, or gzip your image and display it on every run.

@shiona The ball starts as if you have just let it go at 0,0. I will update the rules to clarify that actual calculation must take place.

but If I decide the ball has the speed of 0.0001 m/s (or whatever small enough) to the direction of 45°, the ball does not visibly leave the ground with your chosen resolution. I think problems should always have some sort of an input (user, random, etc.) to make hard coding a single answer impossible.

0,0 is at the top left of the screen, so gravity will get it moving. It falls ~24 m in the first bounce. See the diagram.

Are the stars on the left the y-axis or are they marking the ball's path? If they mark the ball's path, this physics simulations seems a little dubious because the ball has no motion component to the right, so when bouncing on a flat floor, it should bounce back straight up and not to the right. Also, the angles would get flatter on each bounce (if we have a motion component to the right).

@ThomasW. They are the ball's path. As I said, the ball always bounces at 45 or 135 degrees, to make the simulation a little easier (no sin/cos necessary), and more interesting. I know a real ball wouldn't do this.

@ThomasO Oh, sorry. I was sure I missed something about the problem. I thought the ball was shot from the lower left.

"The ball has a spring constant of 0.8 exactly." What you apparently mean has nothing to do with a "spring constant" (that could only matter if the ball did in fact deform on bouncing), it is rather a kind of friction term.

@leftaroundabout It's been a long time since I did physics. I'll call it the "bouncyness constant", if you want.

I like bouncyness constant! But that 45° thing, meh...

Is the "spring constant" or "bouncyness constant" a coefficient of restitution, a coefficient of restitution squared, or what?

@Peter It's a simple coefficient of restitution. Upon researching it, that appears to be what I was thinking of when I typed spring constant.

I've adjusted the rules to allow for any trajectory.

Is this code-golf or code-challenge or what ? Please tag appropriately.

Given that the ball is simply dropped, what makes the ball move rightward? Why doesn't it simply move up and down?

I'm with David on this -- how does your ball pick up that rightward motion, and why doesn't it gain more of it with every bounce?

Python 143 bytes
u=v=x=y=0
a=[[s]*130for s in' '*24+'*']
while x<129:
 if y+v>24:v*=-.8;u=-v
 v+=98e-4;x+=u;y+=v;a[int(y)][int(x)]=s
for r in a:print''.join(r)

The resulting curve is slightly different than the example, but this is because the velocity is adjusted before the ball goes into the floor, instead of after it already has.
*
*
*
*
*
*
*
*
*
*                     ***************
*                 ****               ****
*               ***                     ***
*             **                           **
*           ***                              **
*         **                                   **                          ******
*        **                                     **                     ****     *****
*       *                                         **                 ***             ***
*     **                                           **              **                  **
*    *                                               *           **                      **            *********
*   *                                                 **        **                        **         ***       ***
*  *                                                   **     **                            **     ***           **        *****
* *                                                     **   **                              **   **               **   ***    ***
**                                                       ** **                                ** **                 ** **
*                                                         ***                                   **                   ***
**********************************************************************************************************************************

Python 132 bytes
A more realistic version, that starts with a constant x velocity:
v=x=y=0
a=[[s]*130for s in' '*24+'*']
while x<129:v=(y+v<24or-.8)*v+98e-4;x+=.3;y+=v;a[int(y)][int(x)]=s
for r in a:print''.join(r)

Produces:
****
    **
     ***
       **
        **
         **
          **
           *
            *
            **                   *********
             *                 **        **
              *              **            **
              **            **              **
               *           **                **
               **         **                  **                *****
                *        **                    **             ***   ****
                 *       *                      **          **         **
                 **     *                        *         **            **
                  *    **                         *       *               **          *******
                  *    *                          **    **                 **      ***       **
                   *  *                            *    *                   **    **           **       *******
                   * **                             *  *                     *   **             **    ***     ***      ****
                    **                              ***                       * *                ** **          **  ****  ****
                    **                               **                        **                 ***             ***        *****
**********************************************************************************************************************************

Congratulations, it's amazing!

I'll submit my own solution in Python. Only slightly simplified; I'm sure there are much better ways of doing it! 282 280 characters. The example output in the question post was generated using this program.
import sys;o=sys.stdout.write
py=px=vy=vx=0;g=98e-4;h=25;w=130;k=.8;p=[]
while 1:
 vy+=g;py+=vy;px+=vx
 if py>h:vy=-vy*k;vx=-vy
 if px>w:break
 p.append([int(px),int(py)])
py=0
while py<=h:
 px=0
 while px<w:
  if [px,py] in p or py==h:o('*')
  else:o(' ')
  px+=1
 o('\n');py+=1

The way your ball "bounces always 45 degrees" is highly unphysical. The normal and reasonable way to simulate a bouncing ball in 2D is to leave the x-component of the velocity constant and only mirror the y-component (i.e., to account for repulsion perpendicular to the surface but neglect friction tangent to it). You don't need any trigonometric functions or suchlike to do that!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Javascript: Create a 10x10 array of 1s
Obviously this challenge would be trivial with separate functions and libraries, so they aren't allowed.
Your code must conform to an ECMAscript specification (any spec will do), so no browser-specific answers.
The array must be accessible after it is instantiated.
I have an answer that I'll withhold for now.
Note: this challenge is specific to javascript because it is notoriously inconvenient to make multi-dimensional arrays in javascript.

I'm at 57 characters. Is this a good score?

Ok, definitely not :-)

Are you sure you don't just want this nice 1x1 array of 10s? [10]

Would that be [[10]]?

Javascript ES6, 30
(x=i=>Array(10).fill(i))(x(1))

ES6 in action :)

Hi, this question is like 2 years old. It's probably a better use of your JS code golfing skills to answer more recent questions ;)

@George I don't think there's anything wrong with answering old challenges. (Some challenge authors will also update the accepted answer if a new winner comes along, no matter how old the challenge is.)

@MartinBüttner This answer is not elligible for being accepted as ES6 is younger(it came in 2015 :)) than this challenge, and Array.fill() is ES6 only :)

I just answered because I saw other ES6 answers too. I don't think there is anything wrong with this. The author might update his question and others might take advantage of multiple ways of solving the problem above.

ES6 has been accepted long before its draft actually got frozen (that is in 2015, a few days back). I am not sure though whether that is correct or incorrect.

My ES6 answer on this question isn't even valid in the ES6 spec anymore :P

One day I imagine it may be as simple as x=Matrix(10,10).fill(1). If that day ever comes, I will change that to be the accepted answer.

@Martin Büttner, Looks like I was wrong ;)

One of the requirements is The array must be accessible after it is instantiated.  You need another couple of characters to assign it to a variable (but would, currently, still have the shortest answer).

Javascript, 34 bytes
for(r=[b=[i=10]];i--;r[i]=b)b[i]=1

Since it's apparently OK to make the rows equal by reference, I guess it's apparently OK to rely on that fact. This helps us shave off one for-loop by building the table at the same time as its rows. So, here's my new contestant.
Since r[0] and b[0] are overwritten during the loop, they can contain garbage. This gives us another free execution slot to shave off some commas. Sadly, r=b=[] won't do, since then they are equal by-ref.
Also, it scales well (99x99 is still 34 bytes), doesn't require ES5 (the new functions have terribly long names, anyways), and as a bonus, it's unreadable :-)

Beautiful.  Absolutely beautiful.

Damn, I ended up with: c=[b=[i=10]];while(i--)b[i]=c,c[i]=1. Should have known!!!

ECMAScript 6 - 33 Characters
x=(y=[..."1111111111"]).map(x=>y)

Outputs a 10x10 array of "1"s.
This abuses the fact that the string "1111111111" has all the requisite properties to be treated as if it is an array so you can use the spread operator ... to transform it into an array of characters and then map it to a copy of the array with each element referencing the "original".
Or with only one variable name (for 35 characters):
x=(x=x=>[..."1111111111"])().map(x)

Or for extra confusion (but at 45 characters)
x=[];x[9]=x;x=[...x].map(y=>[...x].map(x=>1))

or (43 characters)
y=y=>[...x].map(x=>y);x=[];x[9]=x;x=y(y(1))

Nice abuse of the ... operator!

44 bytes
for(a=[i=10];i;)a[--i]=[1,1,1,1,1,1,1,1,1,1]

Previous version:
for(a=i=[];i^10;)a[i++]=[1,1,1,1,1,1,1,1,1,1]

Very clever update!

for(a=[i=9];i;)a[i--]=[1,1,1,1,1,1,1,1,1,1]

@AmericanUmlaut that doesn't work

I like ^ for !=

45 characters
x=[a=[1,1,1,1,1,1,1,1,1,1],a,a,a,a,a,a,a,a,a]

Each element points to the same array, but the spec doesn't mention anything against that!

the spec says that "The array must be accessible after it is instantiated.". I guess that means you should have an extra x= at the beginning

a very nice solution nevertheless (+1)

That is not very practical though as a change to a value will reflect on all arrays.

Javascript, 51
a=[];for(i=10;i;i--,a.push([1,1,1,1,1,1,1,1,1,1]));

Or if all indices are allowed to point to the same array:
Javascript, 41
a=[1,1,1,1,1,1,1,1,1,1];a=a.map(a.sort,a)

All of the indices now point to the same column, which is probably unwanted. (Try a[0][1] = 5; console.log(a[1][1])).

Yeah I didn't see that. I've updated my answer.

JavaScript, 45 44 Bytes
Best I have so far.  (Still trying).
x=[];while(x.push([1,1,1,1,1,1,1,1,1,1])-10);

Shorter (thanks mellamokb!)
for(x=[];x.push([1,1,1,1,1,1,1,1,1,1])-10;);

Note that for is almost always preferable to while when golfing. The basic statement is the same length (while() vs for(;;)), but for gives you more flexibility.  In this case, you could put x=[] in the initializer of the for and save one character.

@mellamokb, thanks for the tip :-)

Javascript, 47
Since my original solution has been beaten, I will now post it.
for(a=[],i=10;i--;a[i]='1111111111'.split(''));

Unfortunately, 0x3FF.toString(2) isn't quite as efficient as just listing the string out, which isn't quite as efficient as just statically declaring the array.
You can shave off one character this way (46):
for(a=[],i=10;i--;a[i]=[1,1,1,1,1,1,1,1,1,1]);

You can save 2 more characters like so: (44)
for(a=[i=10];i--;)a[i]=[1,1,1,1,1,1,1,1,1,1]

Another 44 byte solution using JS 1.8 function expression closures (FF only atm):
x=(x=[1,1,1,1,1,1,1,1,1,1]).map(function()x)

You can save one char by initializing i in a like this: a=[i=10]

JavaScript, 57 bytes
r=eval("["+(A=Array(11)).join("["+A.join("1,")+"],")+"]")

Before golfing:
a=Array(11).join("1,");
b=Array(11).join("["+a+"],")
c=eval("["+b+"]")

Note: This needs ES5, so don't expect much from IE.

Wow! I wrote eval('a=['+(b=Array(11)).join('['+b.join("1,")+'],')+']'). Apart from having different quotes and my having the variable inside eval, these are exactly the same

a=eval("["+Array(11).join("[1,1,1,1,1,1,1,1,1,1],")+"]") has 56

54
This has already been beaten, but here's my solution:
function x(){return[1,1,1,1,1,1,1,1,1,1]}x=x().map(x)

Arrow functions will do interesting things to JavaScript golfing. Now if only I could figure out how to trivially Curry builtins.

You'd need to insert x= before x().map (or y=, etc) to make it accessible, right?

@Schmiddty Yes, so updated.

39 bytes
Using array comprehension in ECMAScript 7:
x=[x for(y in x=[1,1,1,1,1,1,1,1,1,1])]

There are no array comprehensions in ES6, that's an ES7 proposal.

@afonsomatos at the time I made this answer, it was still part of the ES6 draft. It's updated now though :)

Replacing [1,1,1,1,1,1,1,1,1,1] with Array(10).fill(1) shaves 4 chars.

56 characters
Rather long answer, but will be better for 100x100 etc.
for(a=[[i=k=0]];++i<100;m?0:a[k=i/10]=[1])a[k][m=i%10]=1

ES6, 54
It's not the shortest, but I thought I'd go for a different approach to what's already here.
a=(''+{}).split('').slice(0,10).map(_=>a.map(_=>1))

 Cast an object to a string "[object Object]"
 Split the string into chars ["[", "o", "b", ... "]" ]
 Grab a slice of just 10
 Map the result of mapping 1 onto the initial slice

Where can I test it? It doesn't work right in my FF.

I'd missed out some parens, however, because a already existed that version seemed to have worked. Updated version should work in FF and node with the --harmony flags.

Now it returns right array, but it's not assigned to any variable.

Javascript, 36 chars (ECMA 6)
(a=[b=[]]).fill(b.fill(a[9]=b[9]=1))

Tested in my browser (Firefox on Ubuntu) and in the Codecademy Javascript interpreter

61 for fun
eval("r=["+("["+(Array(11).join("1,"))+"],").repeat(11)+"]")

Javascript - 64 63 59 characters

for(var a=b=[],i=100;i-->0;b[i%10]=1)if(i%10==0){a[i/10]=b;b=[]}

for(var a=b=[i=100];i-->0;b[i%10]=1)if(i%10==0){a[i/10]=b;b=[]}

One char saved by hiding the iterator in the array.
for(a=b=[1],i=100;i--;b[i%10]=1)if(i%10==0){a[i/10]=b;b=[]}

Saved some chars with Jans suggestions.
Readable version:
for(var a = b = [i = 100]; i-- > 0; b[i % 10] = 1) {
  if(i % 10 == 0) {
    a[i / 10] = b;
    b = [];
  }
}

Yes, it's not the shortest solution, but another approach without using readymade [1,1,1,1,1,1,1,1,1,1] arrays.

Change i-->0 to i--. While the "downto" operator is nice, it's not really neccessary. ==0 could be shaved off by two bits as well. Also, leave out var. While normally useful, four useless bytes are just unacceptable here.

Javascript 69 characters (for now)
b=[]
a=[]
for(i=100;i-->0;){
a.push(1)
if(i%10===0){b.push(a);a=[]}
}

JavaScript 73
function h(){s="1111111111",r=[10],i=-1;while(++i<10){r[i]=s.split("");}}

r=[10], does nothing as you immediately overwrite r[0]. You don't need to declare s and could just do "1111111111".split("") but that is 22 characters whereas [1,1,1,1,1,1,1,1,1,1] is only 21 characters.

Javascript ES6, 53
x="1".repeat(100).match(/.{10}/g).map(s=>s.split(""))

But the ones in the array are strings :)

Javscript ES6, 53
x=eval("["+("["+"1,".repeat(10)+"],").repeat(10)+"]")

JavaScript (ES6), 35 bytes
A=Array(10).fill(Array(10).fill(1))

Setting a variable isn't an approved method of output. However, you can do f=>Array(10).fill(Array(10).fill(1)) (defining an anonymous function) for 36 bytes.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Write ASCII-Art Obfuscated Code, read as, and resulting in: "DFTBA"
The challenge is to write the most elaborate code, embedded in ASCII art that reads and prints "DFTBA".  For example, the following reads DFTBA:
oooooooooo.   oooooooooooo ooooooooooooo oooooooooo.        .o.
`888'   `Y8b  `888'     `8 8'   888   `8 `888'   `Y8b      .888.
 888      888  888              888       888     888     .8"888.
 888      888  888oooo8         888       888oooo888'    .8' `888.
 888      888  888    "         888       888    `88b   .88ooo8888.
 888     d88'  888              888       888    .88P  .8'     `888.
o888bood8P'   o888o            o888o     o888bood8P'  o88o     o8888o

And the following, in bash prints DFTBA
echo "DFTBA"

The challenge is to write one that does both.
Winning conditions
Valid answers, (all conditions at my discretion)

Can be clearly read as DFTBA
Print DFTBA when executed
Must be functional with no Internet connection
have letters of equal height
must not have more than 80 columns
must not have more than 10 rows

Points (highest sum wins)

Rows * Columns / 32
Readability: 25 for legible, 50 for very clear
1 point for each different non-whitespace character used

Restrictions
These may be used for something, so all responses are assumed to be released into the public domain.  If you can't, or choose not to release your answer into the public domain: post a comment/response to the original question saying "The answer authored and/or shared by me, may not be considered to be in the public domain".
Non-public domain answers are welcome too!  Just make sure to specify :-)
What is DFTBA?
It sometimes stands for "Don't Forget To Be Awesome", but not always... Long story...  This related song might help explain (or confuse).

The winning criteria is really largest area? That will quickly turn into an arms race of people adding more and more worthless characters to get it bigger. There is really no upper bound on this.

Do upper and lower case characters count separately (as different characters)?

Also, what's to stop me from dumping random characters into the code that do nothing? Is that allowed?

@Shmiddty, yes, all characters with different ascii codes (excluding whitespace).  As long as it runs, that's fine :-)

@FakeRainBrigand what about extended ASCII? http://www.asciitable.com/

Characters 32-255 are allowed.

@FakeRainBrigand I have posted a new answer for you using both standard and extended ASCII then. Cheers :)

(I have made a full write up here as it is quite extensive how I got to these two results)
Brainfuck, Full ASCII range 0 to 255: 80x10=800/32=25+25+219=269
+l+A+O#@e@        /+@+|+2+@@X     @*3+}+@+@YZ    q4[@>@+@@           @:+@
@+B+"+~@@N        @p+K+%>@@v@     dJ+w+@+@+@@    I@+@+@+@@         (@+  @<@
@<@      @-@      @@]                 U>@        @-@    -@@f      @.r    +@E
+@@       .@@0    @>@+@+@+@@@         @+@        @.@    <@@@      @-'    -@@
-€R       -9‚     ƒ.„-….†$c‡ˆ         ‰Š‹        Œg&Ž6H        ‘h’“7”i•–—
˜u™       Qš1›    MœL                 )nG        ?žŸ x¡¢£        `¤¥¦j@§{D¨
!©ª       «P¬    ®bm                 ¬¯°        ±²³    ´µ\¶     ·¸F      ¹8º
»S¼      ½¾¿      ÀVÁ                 ÂTÃ        ÄÅk    _ÆÇÈ     ÉÊË      ÌÍÎ
ÏaÐ;ÑCÒÓsÔ        ÕÖ×                 ØoÙ        ÚÛ=Ü5ÝÞßà      áâã        äåæ
çtèéê^ëìíî        Wïð                 ñòó        ôõö÷yøùúû      üýz        þÿ,

There is a line through the middle of this top one which is not quite strait, but that is just the display here on CodeGolf. If you download the original file from the above link and view it in the Brainfuck Developer or Notepad instead of Wordpad for example, it will look correct like this.
Brainfuck, Part ASCII range 0 to 127: 80x10=800/32=25+25+95=145
+l+A+O#@e@         /+@+|+2+@@X     @*3+}+@+@YZ    q4[@>@+@@           @:+@
@+B+"+~@@N         @p+K+%>@@v@     dJ+w+@+@+@@    I@+@+@+@@         (@+  @<@
@<@      @-@       @@]                 U>@        @-@    -@@f      @.r    +@E
+@@       .@@0     @>@+@+@+@@@         @+@        @.@    <@@@      @-'    -@@
-@R       -9@@     @.@-@.@$c@@         @@@        @@g&@@6@H        @h@@7@i@@@
@u@       Q@1@     M@L                 )nG        @?@@@x@@@        `@@@j@@{D@
!@@       @P@@     @bm                 ¬@@        @@@    @@\@     @@F      @8@
@S@      @@@       @V@                 @T@        @@k    _@@@     @@@      @@@
@a@;@C@@s@         @@@                 @o@        @@=@5@@@@      @@@        @@@
@t@@@^@@@@         W@@                 @@@        @@@@y@@@@      @@z        @@,

Awesome answer!  Definitley the high score, but one of us is counting incorrectly.  I removed characters matching \s regex (whitespace), string to array |> unique |> length.

Did you run that regex above the text above or the text on the website I linked, check there as the CodeGolf version of the code is not the same (it alters the code I paste in).

Piet, Score Uncertain (153ish)

I understand that this doesn't strictly fit within the specifications (requiring ASCII art), however the source code does provide a very readable DFTBA. The trace is below.
Piet ignores every colour that doesn't mean anything. As a result, I used gray as the generic "comment colour" to outline and the like. The gray doesn't get interpreted (as you'll see in the trace). I wanted to make it clear which pixels were in the program and which were not.
I've used 15 colours, which is 13 without whitespce. It is 89x32 pixels, though could be compressed more. I used 4 op-codes (subtract, divide, push and outputc). Maybe if using scoring how I would think, 153?
Probably doesn't warrant a score, but was an interesting exercise. Having never used Piet before, I've never done so much trial-and-error programming! I needed npiet extensively, and its trace. I still can't figure out how the movement of the cursor works with any stability!
How it works:

D, F, T are constants for their respective ASCII letters that are then pushed to the stack, and the OUTC command called
B is the ASCII for B x 2 (needed to be to look good), which is pushed to the stack, then divided by two, then duplicated on the stack and the OUTC command called
Note the earlier duplication. That was because I couldn't make A look good in so few characters. I push 1 to the stack, subtract (making the ASCII code for A) and then the whole A character is the opcode for OUTC - doesn't matter the size, because it's an operation not a constant

Cool answer.  So are al the letters except A ignored?

Actually - each letter is the constant of that letter (except A). The area of each letter is the constant. Hence why they're slightly weird looking :)

Oh, that's really cool.  Nicely done :-)

Malbolge (71 80 x 10) / 32 + 25 + 94 = 141.1875 144
Update: added more spacing between the letters to raise the score.
Tested with the official Malbolge interpreter. Of course, it's really not hard to print static text using Malbolge. The encoding used by Malbolge almost guarantees you'll have the whole set of printable ASCII characters in there.
bCBA@?>=<;       :9876543210    /.-,+*)('&%$#    "!~}|{zyxwv            uts
rqp     onm      lkjihgfedcb    a`_^]\[ZYXWVU    TSR      QPO         NML KJI
HGF      EDC     BA@                 ?>=         <;:       987       654   321
0/.      -,+     *)(                 '&%         $#"      !~}       |{z     yxw
vuW       srq    ponmlkjihg`         &^]         #a`_A]\[TxX       WVU       TSR
QPO       N0L    KJIHGFEDCBA         @?>         =<;:3W16543       ,P0/.-,+*)('&
%$#      "!~     }|{                 zyx         wvu      tsr      qpo       nml
kji      hgf     edc                 ba`         _^]       \[Z     YXW       VUT
SRQ     PO1      lYK                 JIH         GFE      DCB      A@?       >=<
;:98765432       10/                 .-,         +*)('&%$#"!       ~}|       {zy

Explanation of the code (people said they didn't understand it):
(For more information about Malbolge see http://esolangs.org/wiki/Malbolge).
First, let's normalize the code to the operations given at the above page:
iooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
*ooooooooooooop<pp<ooo*ooop<ooooooooooo*ooooooooooooooooooop<poooop<oo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*<vooooo
oooooooooooooooooooooooooooooooooooooooooooo

Also note that after each instruction cycle, the executed instruction is re-encoded and the code pointer and the data pointer are increased by 1.

At the beginning, C (code ptr) = D (data ptr) = 0. This means [D] = 'b' (98) and the i instruction is selected. So we jump to address 99. (C is first set to 98 and then increased), the data pointer is now 1.
At 98 there's a string of NOPs (o). These do have the effect that they are all re-encoded and that C and D are incremented. The next real instruction (*) is found at address 140, so now C=140 and D=42.
* does a right rotate (or division by three) on what the data pointer's pointing at, and stores back into the memory and in the accumulator A. [42] = 'x' (120), so A <- [42] <- '(' (40).
Another row of NOPs causes C=154 (p) and D=62 ( [D]='j' (106) ).
p is the crazy operator. I'm not going to reproduce its table here, but what happens is A = [D] = crazy(A, [D]). A is still 42, [D] is 106, which means crazy(A, [D]) = 29504.
Next up is <, which is output. It outputs the accumulator, which is 29504, as an ASCII character. 29504 % 256 = 68, which is D, so now we have the D.
The rest of the letters are output in a similar manner.

I looked into Malbolge a little... and I don't get it! :-)  Would you mind explaining how this code works?

@FakeRainBrigand: did so

I don't understand how 141 > 144.

Javascript (80 x 10) / 32 + 25? + 94 = 144
Code:
eval('for(i      =10;i<0x24;42,  Number["prot"+  "otype"][(i++    ).toString(36\
)]=Number["p"    +"rototype"]/*  */["toString"]  );alert(((+((-   ~{}).a()+(!!{\
}+!!{}+!!{}).b   ())).c(+((+!!{  }).d()+(5).e()  ))+(     +((+!!  {}).f()+(2+!!\
{}+!      !{}+!  !{}).               g())).      h(+(      (+!!   {}).      i()\
+(7)       .j()  ))+(+((2)           .k()+(      /*TVEXFGHZKJP    Q*/(      0x1\
+0x1       +0x1  )*0x3).l(           ))).m(      +((8/4+1).n()+   (+[]).o\()))+\
(+((      +!!{}  ).p()+(-~           {}).q(      ))).      r(+((  +!!{}).s()+(!\
!{}+2/*WARP*/)   .t()                ))+(+(      (+!!     {}).u(  )+(+      [])\
.v())).w(+((+    !!{}                ).y()+      (2/*Y*/).z()))   )/**      **/\
.toUpperCase     ());                "#$%\'      /,:>?@^_`9|&M    ODLB      I"')

Demo: http://jsfiddle.net/4hyyS/3/
To add some explanation:
First I map Number.prototype.toString to each lower-case letter:
for(i=10;i<36;Number.prototype[(i++).toString(36)] = Number.prototype.toString);

This allows me to use the lowercase letters efficiently.
Next I construct the string 'DFTBA' by converting numbers to characters, eg:
(13).a(15) // 'd'

(I could have used fromCharCode or toString(36) for all of the characters, but that would have been too easy)
To fill out extra characters, and further obfuscate the code, I use a few tricks to create the numbers:
+[]        // 0
+!!{}      // 1
!!{}+!!{}  // 2

Etc.
For characters that aren't used in the actual code, I dropped them in either comment blocks /* ... */ or strings " ... ".
I started off with an 80x10 grid, then whittled that down to my letters, then adjusted my code to fit that (also, looks better in this font, the last | is just the cursor):

Nice.  If there was any way to smooth out the B it would be better (it's borderline 8).  So the score looks right to me.

Perl (75 x 7) / 32 + 25 + 59 ≈ 107.4
@D=('-4*x^2      8*x^5-72*x^3  56*x^4-260*x^1  +272*x^6',         '
4*x^2    -4*x'   );$b++   ,s/  (-)  ?(\w  +)(  .x)?    (\^       \d+
 )?/      "\$$b   \[0$4             ||$2       $3<1    ]$1=     $2^I"
 .!"       $$O"   /exgemfor         +@D;       $P=pop@2;$K     =(  pop
 @1)       /+$P   and               $_.=       chr(    --$j   ?"$K*x^$j"
:"+"     .$K),    s/^               \+|\       +\B|    \b1\   *|\    ^1$/
/gx,map$1[$      j++]-=            $_*$K,      @2while$j=    @1-@2  ;print

I'd tell you what it does, but that'd ruin the obfu, wouldn't it ;)

Awesome!  I'm just counting 59 unique characters (after removing whitespace).

@FakeRainBrigand oops, you're right. I just ran a count_char over it, and forgot to exclude whitespace.

C#, (71*7)/32+25+45 = 85.53
My first Programming Puzzles answer! C# is really not very good for these games...

/**/using/*    */System;/*  */namespace   F{class//oo.        .o.
 //8'   `Y8b  `888'             8888      `888'    `Y8b      .888.
 //8      888  888              8888       888      888     .8"888.
 /*8      8*/  I{static         void       Main(string     []  args
 ) {      /*8  888    "         8888       888     `88*/   {Console.
 //8     d88'  888              8888       888     .88P  .8'     `888.
WriteLine(     /*88             8888      */"DFTBA");   /**/      }}}}

I'm impressed!  It's not easy to do these when you have to create a class :-)

Python, (69*7)/32 + 25 + 49 = 89
oo=getattr;   o=__import__ ('sys');O='s' 'tdout';#o.        .o.
class    Y8b  :#88'     `8 8'   888   `8 `888'   `Y8b      .888.
 #88      888  888              888       888     888     .8"888.
 def      a88  (Oo,oO):         oo(       oo(o,O),'w'    'r'  'it'
 "e"      )((  (oO    )         ));       11/    0b10   ;return[88,
 88]     #d8`  888              888       888    .88P  .8'     `888.
d=Y8b().a88;  d("D"            "FT")     +[1]+d("BA"  '\n'     )#1880

It's not easy to do it in Python because of indentation and whitespace. So I did one of many things to make the indentation legit:

defined a class
used concatenation of strings
list with a trailing comma
line continuation character (which I ended up not using)

Readability can still be improved a bit...

C, (55*8)/32+25+55 = 93.35
It's quite easy to make the letters larger, and use a few more characters.
main()    {p(O(O(O(  O(O(O(O(O(  O(O(O(O(O       (O
(p(O(O(   p()))))))  ))))))))))  ));puts(""     ,p(o
(p    (o  (o             (o      (o      (o    (o  (o
(o    (o  (o             (o      (o      (o   (o    (o
(o    (o  (o())))))      ))      ))))))))    ))))));}x=
59    ;O  ()             {x      ++      ;}  o(      ){
+x    --  ;}             p(      ){      ;;  ;;      ;;
putchar   (x             +9      );x;-x;}    q(      );

Java
class  Ypnypn  {public  static    void
main(  String  []array  ){{}{}   {{{{}{
{   }  {          {     }    }   {    }
{   (  System     .     out).    print(
(   "  "          +     "    "   +
"   "  +          "     DFTBA"   )    .
trim(  )          )     ;}}}}}   }    }

Definitely the best readability of all the answers. I'm out of votes today, but I'll be back.


text:
Build a readability index
The Flesch-Kincaid readability algorithm depends on the measures of word count and syllable count, neither of which is entirely objective, or easily automatable using a computer. For example, does "code-golf", with the hyphen, count as one word or two? Is the word "million" two or three syllables? In this task, you will need to approximate, as counting exactly will take too much time, space, and most importantly, code.
Your task is to build the smallest possible program (i.e. a function) in any language that will take an English reading passage (assumed to be in complete sentences), and calculate the Flesch Reading Ease index to a tolerance of eight points (to account for variations in syllable counting and word counting). It is calculated as follows:
FRE = 206.835 - 1.015 * (words per sentence) - 84.6 * (syllables per word)

Your program must be aligned to the reference passages below, whose indices were calculated using manual counting:
I would not, could not, in the rain.
Not in the dark, not on a train.
Not in a car, not in a tree.
I do not like them, Sam, you see.
Not in a house, not in a box.
Not with a mouse, not with a fox.
I will not eat them here or there.
I do not like them anywhere!

Index: 111.38 (64 syllables in 62 words in 8 sentences)
It was a bright cold day in April, and the clocks were striking thirteen.
Winston Smith, his chin nuzzled into his breast in an effort to escape
the vile wind, slipped quickly through the glass doors of Victory Mansions,
though not quickly enough to prevent a swirl of gritty dust from entering
along with him.

Index: 65.09 (74 syllables in 55 words in 2 sentences)
When in the Course of human events, it becomes necessary for one people to
dissolve the political bands which have connected them with another, and to
assume among the powers of the earth, the separate and equal station to
which the Laws of Nature and of Nature's God entitle them, a decent respect
to the opinions of mankind requires that they should declare the causes
which impel them to the separation.

Index: 3.70 (110 syllables in 71 words in 1 sentence)
If you have any other passages for which you have manually counted the syllables and words and calculated the index, you may show them as verification.

Can it be a function?  Or does it have to take STDIN?

Do you have the syllable count available for the 3 example passages, or just the index? If you have it, the syllable count would be handy for comparison.

It can be a function. In fact, it should be a function.

Perl 120 bytes
#!perl -pa0
s@\w+|([.!?])@$s+=$#-,lc($&)=~s![aeiou]+\B|([aeiouy]$)!$y+=1-$#-/3!ger@ge}
{$_=206.835-1.015*@F/$s-84.6*$y/@F

Sample I/O:
$ perl flesch-kincaid.pl < input1.dat
110.730040322581

$ perl flesch-kincaid.pl < input2.dat
65.6097727272728

$ perl flesch-kincaid.pl < input2.dat
1.71366197183096

Counting of syllables is done by assuming that each vowel cluster is a single syllable, except for lone vowels at the end of a word, which are only counted two thirds of the time; a heuristic that seems to be fairly accurate.

K&R c  -- 188 196 199 229 characters
With the spec changed to specify a function I can get of lot of the c overhead out of the count. Also changing to use Strigoides' syllable counting hack which is better than my formula tweak and extended to deal with overcounting of words.
After I found a shorter way to do the vowel detection which was sadly based on stdchr, I had incentive to squeeze a few more out of the bit-twiddling abomination I've been using so that I didn't have to be boring.
d,a,v,s,t,w;float R(char*c){for(;*c;++c){s+=*c=='.';if(isalpha(*c)){
w+=!a++;d=(*c&30)>>1;if(*c&1&(d==7|((!(d&1))&(d<6|d>8)))){t+=!v++;}
else v=0;}else v=a=0;}return 206.835-1.*w/s-82.*t/w;}

The logic here is a simple state machine. It counts sentences by periods only, words by strings of alphabetic characters, and syllables as strings of vowels (including y).
I had to diddle the constants a little to get it to come out with the right figures, but I've borrowed Strigoides' trick of just undercounting the syllables by a fixed fraction.
Un-golfed, with comments and some debugging tools:
#include <stdlib.h>
#include <stdio.h>
d,a,/*last character was alphabetic */
  v,/*lastcharacter was a vowel */
  s, /* sentences counted by periods */
  t, /* syllables counted by non-consequtive vowels */
  w; /* words counted by non-letters after letters */
float R/*eadability*/(char*c){
  for(;*c;++c){
    s+=*c=='.';
    if(isalpha(*c)){ /* a letter might mark the start of a word or a
               vowel string */
      w+=!a++; /* It is only the start of a word if the last character
              wasn't a letter */
      /* Extract the four bits of the character that matter in determining
       * vowelness because a vowel might mark a syllable */
      d=(*c&30)>>1;
      if( *c&1  & ( d==7 | ( (!(d&1)) & (d<6|d>8) ) )
      ) { /* These bits 7 or even and not 6, 8 make for a
         vowel */
    printf("Vowel: '%c' (mangled as %d [0x%x]) counts:%d\n",*c,d,d,!v);
    t+=!v++;
      } else v=0; /* Not a vowel so set the vowel flag to zero */
    }else v=a=0; /* this input not alphabetic, so set both the
            alphabet and vowel flags to zero... */
  }
  printf("Syllables: %3i\n",t);
  printf("Words:     %3i       (t/w) = %f\n",w,(1.0*t/w));
  printf("Sentences: %3i       (w/s) = %f\n",s,(1.0*w/s));
  /* Constants tweaked here due to bad counting behavior ...
   * were:       1.015     84.6 */
  return 206.835-1.   *w/s-82. *t/w;
}
main(c){
  int i=0,n=100;
  char*buf=malloc(n);
  /* Suck in the whole input at once, using a dynamic array for staorage */
  while((c=getc(stdin))!=-1){
    if(i==n-1){ /* Leave room for the termination */
      n*=1.4;
      buf=realloc(buf,n);
      printf("Reallocated to %d\n",n);
    }
    buf[i++]=c;
    printf("%c %c\n",c,buf[i-1]);
  }
  /* Be sure the string is terminated */
  buf[i]=0;
  printf("'%s'\n",buf);
  printf("%f\n",R/*eadability*/(buf));
}

Output: (using the scaffold from the long version, but the golfed function.)
$ gcc readability_golf.c
readability_golf.c:1: warning: data definition has no type or storage class
$ ./a.out < readability1.txt
'I would not, could not, in the rain.
Not in the dark, not on a train.
Not in a car, not in a tree.
I do not like them, Sam, you see.
Not in a house, not in a box.
Not with a mouse, not with a fox.
I will not eat them here or there.
I do not like them anywhere!
'
104.074631
$ ./a.out < readability2.txt
'It was a bright cold day in April, and the clocks were striking thirteen.
Winston Smith, his chin nuzzled into his breast in an effort to escape
the vile wind, slipped quickly through the glass doors of Victory Mansions,
though not quickly enough to prevent a swirl of gritty dust from entering
along with him.
'
63.044090
$ ./a.out < readability3.txt
'When in the Course of human events, it becomes necessary for one people to
dissolve the political bands which have connected them with another, and to
assume among the powers of the earth, the separate and equal station to
which the Laws of Nature and of Nature's God entitle them, a decent respect
to the opinions of mankind requires that they should declare the causes
which impel them to the separation.
'
-1.831667

Deficiencies:

The sentence counting logic is wrong, but I get away with it because only one of the inputs has a ! or a ?.
The word counting logic will treat contractions as two words.
The syllable counting logic will treat those same contractions as one syllable. But probably overcounts on average (for instance there is counted as two and many words ending in e will be counted one too many), so I've applied a constant factor of 96.9% correction.
Assumes a ASCII character set.
I believe the vowel detection will admit [ and {, which clearly isn't right.
Lots of reliance on K&R semantics makes this ugly, but hey, it's code golf.

Things to look at:

I am (momentarily) ahead of both python solution here, even if I am trailing the perl.
Get a load of the horrible thing I did for detecting vowels. It makes some sense if you write the ASCII representations out in binary and read the comment in the long version.

"I had to alter the formula a little by hand to get acceptable results." This may be bad form.

I have now a least followed Strigoides' lead and made the adjustments on the basis of who the text comprehension makes errors rather than a purely ad hoc tweak to ring the three test cases into agreement.

Python, 202 194 188 184 171 167 characters
import re
def R(i):r=re.split;w=len(r(r'[ \n]',i));s=r('\\.',i);y=r('[^aeiou](?i)+',i);return 206.835-1.015*w/(len(s)-s.count('\n'))-84.6*(len(y)-y.count(' ')-2)*.98/w

First, get the total number of words by splitting along spaces and newlines:
w=len(r(r'[ \n]',i))

Then, the formula. Sentence and syllable counts are only used once, so they are embedded in this expression.
Sentences are simply the input split along ., with newlines filtered out:
s=r('\\.',i);s=len(s)-s.count('\n')

Syllables consist of the input split along non-vowels, with spaces removed. This seems to consistently slightly over-estimate the number of syllables, so we need to adjust it down (about .98 seems to do it):
y=r('[^aeiou](?i)+',i);y=len(y)-y.count(' ')-2;

202 -> 194:
len(x)-2 rather than len(x[1:-1]). Removed unnecesary brackets. Made syllable regex case-insensitive
194 -> 188:
The file was previously saved as dos rather than unix file format, causing wc -c to count newlines as two characters. Whoops.
188 -> 184:
Get rid of those nasty x for x in ... if x!=...s by storing the intermediate result and subtracting x.count(...)
184 -> 171:
Remove input/output, and convert to function
171 -> 167:
Insert the len(x)-x.count(...)s into the formula

Your answer does not have to include the input and output procedures.

@JoeZeng Oh, okay. I'll turn it into a function then.

Python 380 characters
import re
def t(p):
 q=lambda e: e!=''
 w=filter(q,re.split('[ ,\n\t]',p))
 s=filter(q,re.split('[.?!]',p))
 c=len(w)*1.0
 f=c/len(s)
 return w,f,c
def s(w):
 c= len(re.findall(r'([aeiouyAEIOUY]+)',w))
 v='aeiouAEIOU'
 if len(w)>2 and w[-1]=='e'and w[-2]not in v and w[-3]in v:c-= 1
 return c
def f(p):
 w,f,c=t(p)
 i=0
 for o in w:
  i+=s(o)
 x=i/c
 return 206.835-1.015*f-84.6*x

This is a rather long solution, but it works well enough, at least of the 3 test cases provided it does.
Testing code
def test():
 test_cases=[['I would not, could not, in the rain.\
        Not in the dark, not on a train.\
        Not in a car, not in a tree.\
        I do not like them, Sam, you see.\
        Not in a house, not in a box.\
        Not with a mouse, not with a fox.\
        I will not eat them here or there.\
        I do not like them anywhere!', 111.38, 103.38, 119.38],\
        ['It was a bright cold day in April, and the clocks were striking thirteen.\
        Winston Smith, his chin nuzzled into his breast in an effort to escape\
        the vile wind, slipped quickly through the glass doors of Victory Mansions,\
        though not quickly enough to prevent a swirl of gritty dust from entering\
        along with him.', 65.09, 57.09, 73.09],\
        ["When in the Course of human events, it becomes necessary for one people to\
        dissolve the political bands which have connected them with another, and to\
        assume among the powers of the earth, the separate and equal station to\
        which the Laws of Nature and of Nature's God entitle them, a decent respect\
        to the opinions of mankind requires that they should declare the causes\
        which impel them to the separation.", 3.70, -4.70, 11.70]]
 for case in test_cases:
  fre= f(case[0])
  print fre, case[1], (fre>=case[2] and fre<=case[3])

if __name__=='__main__':
 test()

Result -
elssar@elssar-laptop:~/code$ python ./golf/readibility.py
108.910685484 111.38 True
63.5588636364 65.09 True
-1.06661971831 3.7 True

I used the syllable counter from here - Counting syllables
A more readable version is available here

if len(w)>2 and w[-1]=='e'and w[-2]not in v and w[-3]in v:c-= 1 Simple minded but a good approximation. I like it.

Javascript, 191 bytes
t=prompt(q=[]);s=((t[m="match"](/[!?.]+/g)||q)[l="length"]||1);y=(t[m](/[aeiouy]+/g)||q)[l]-(t[m](/[^aeiou][aeiou][s\s,'.?!]/g)||q)[l]*.33;w=(t.split(/\s+/g))[l];alert(204-1.015*w/s-84.5*y/w)

First test case gives 112.9 (correct answer is 111.4, off by 1.5 points)
Second test case gives 67.4 (correct answer is 65.1, off by 2.3 points)
Third test case gives 1.7 (correct answer is 3.7, off by 2.0 points)


text:
Build a Killer Sudoku Solver
You thought regular sudoku was hard, now try Killer Sudoku!
In the game of Killer Sudoku, you aren't given any numbers at all. Instead, you're given regions that are said to add up to a certain number. Consider the following example, from Wikipedia:

And its solution:

The program you write will take a format consisting of a sequence of 81 letters representing regions, followed by a sequence of numbers. Then each number in the sequence represents the sum of the numbers in each of the letter regions, starting from "A", "B", etc.
It will then output a sequence of 81 digits representing the solution.
For example, the example puzzle above would have the following input:
AABBBCDEFGGHHCCDEFGGIICJKKFLMMINJKOFLPPQNJOORSPTQNUVVRSTTQWUUXXSYZWWaaXXSYZWbbbcc
3 15 22 4 16 15 25 17 9 8 20 6 14 17 17 13 20 12 27 6 20 6 10 14 8 16 15 13 17

And the resulting output would be:
215647398368952174794381652586274931142593867973816425821739546659428713437165289

You may assume that the input is valid, and that the regions will always appear in order by A, B, ..., Y, Z, a, b, ..., z.
(Shortest code that works wins.)

How do you win the competition? Shortest code? Fastest code?

Shortest code. [missed the char limit by 1 character.]

And if there are more than 52 regions, then what?

You can assume there will not be more than 45 regions.

Your "U" region is larger in your example input than in the picture

Sorry; I've fixed it.

And in your output string there is a 6 instead of 3 (in the seventh row).

Can a number repeat within a cage?

You can treat the answer as no, as that is the rule usually followed by Killer Sudoku puzzlemakers.

R - 378 characters
Assuming
x="AABBBCDEFGGHHCCDEFGGIICJKKFLMMINJKOFLPPQNJOORSPTQNUVVRSTTQWUUXXSYZWWaaXXSYZWbbbcc"
y="3 15 22 4 16 15 25 17 9 8 20 6 14 17 17 13 20 12 27 6 20 6 10 14 8 16 15 13 17"

378 characters:
z=strsplit
v=sapply
R=rep(1:9,9)
C=rep(1:9,e=9)
N=1+(R-1)%/%3+3*(C-1)%/%3
G=z(x,"")[[1]]
M=as.integer(z(y," ")[[1]])[order(unique(G))]
s=c(1,rep(NA,80))
i=1
repeat if({n=function(g)!any(v(split(s,g),function(x)any(duplicated(x,i=NA))))
S=v(split(s,G),sum)
n(R)&&n(C)&&n(N)&&n(G)&&all(is.na(S)|S==M)}){if(i==81)break;i=i+1;s[i]=1}else{while(s[i]==9){s[i]=NA
i=i-1};s[i]=s[i]+1}
s

takes about an hour on my modest PC to reach the expected solution, after  2,964,690 iterations.

De-golfed:
ROWS   <- rep(1:9, 9)
COLS   <- rep(1:9, each = 9)
NONETS <- 1 + (ROWS - 1) %/% 3 + 3 * (COLS - 1) %/% 3
CAGES  <- strsplit(x, "")[[1]]
SUMS   <- as.integer(strsplit(y, " ")[[1]])[order(unique(CAGES))]

is.valid <- function(sol) {

   has.no.repeats <- function(sol, grouping) {
      !any(vapply(split(sol, grouping),
                  function(x) any(duplicated(x, incomparables = NA)),
                  logical(1)))
   }
   has.exp.sum <- function(sol, grouping, exp.sums) {
      sums <- vapply(split(sol, grouping), sum, integer(1))
      all(is.na(sums) | sums == exp.sums)
   }

   has.no.repeats(sol, ROWS  ) &&
   has.no.repeats(sol, COLS  ) &&
   has.no.repeats(sol, NONETS) &&
   has.no.repeats(sol, CAGES ) &&
   has.exp.sum(sol, CAGES, SUMS)
}

sol <- c(1L, rep(NA, 80)) # start by putting a 1
i <- 1L                   # in the first cell
it <- 0L

repeat {
   it <- it + 1L
   if (it %% 100L == 0L) print(sol)
   if(is.valid(sol)) {         # if everything looks good
      if (i == 81L) break         # we are either done
      i <- i + 1L                 # or we move to the next cell
      sol[i] <- 1L                # and make it a 1
   } else {                    # otherwise
      while (sol[i] == 9L) {      # while 9s are found
         sol[i] <- NA             # replace them with NA
         i <- i - 1L              # and move back to the previous cell
      }
      sol[i] <- sol[i] + 1L       # when a non-9 is found, increase it
   }                           # repeat
}
sol

GolfScript, 138 characters
n%~[~]:N;1/:P.&:L;9..*?{(.[{.9%)\9/}81*;]:§;L{.`{\~@@=*}+[P§]zip%{+}*\L?N==}%§9/..zip+\3/{{3/}%zip{{+}*}%}%{+}*+{.&,9=}%+1-,!{§puts}*.}do;

This is a killer sudoku solver in GolfScript. It expects input on STDIN in two rows as given in the example above.
Please note: Since the puzzle description does not make any restrictions on execution time I preferred small code size over speed. The code tests all 9^81 grid configurations for a solution which may take some time on a slow computer ;-)

Can you verify it? :P

@JoeZeng, it looks easy enough to tweak it for 4x4. Here's a test case: AABBCADEFFDDGGGG 6 7 4 8 2 3 10

@PeterTaylor Your test case has four different valid solutions.

Ruby, 970 characters
A,B=gets,gets.split
L=[]
R=[]
U=[]
D=[]
N=[]
C=[]
S=[]
O=[0]*81
z='A'
(0..324).map{|j|U<<j;D<<j;R<<(j+1)%325;L<<(j+324)%325;N<<j;C<<j;S<<0}
X=->s,j,c,cf,n{j<81?(z==A[j]?(0..8).map{|i|X[s-1-i,j+1,c+[i],cf+[1+j,1+81+27*i+j/9,1+81+27*i+9+j%9,1+81+27*i+18+j/3%3+j/27*3],n+[i+1]]}:X[s,j+1,c,cf,n+[0]]if s>=0):(h=U.size;cf.uniq.sort.map{|l|N<<n;L<<(L[h]||h);R<<h;U<<U[l];D<<l;C<<l;S[l]+=1;L[R[-1]]=R[L[-1]]=U[D[-1]]=D[U[-1]]=L.size-1}if s==0)}
Y=->c{L[R[c]]=L[c];R[L[c]]=R[c];i=D[c];(j=R[i];(U[D[j]]=U[j];D[U[j]]=D[j];S[C[j]]-=1;j=R[j])while j!=i;i=D[i])while i!=c}
Z=->c{i=U[c];(j=L[i];(S[C[j]]+=1;U[D[j]]=j;D[U[j]]=j;j=L[j])while j!=i;i=U[i])while i!=c;L[R[c]]=c;R[L[c]]=c}
B.map{|k|X[k.to_i,0,[],[],[]];z=z=='Z'?'a':z.next}
s=->k{c=R[0];c<1?($><<(O[0,k].map{|s|N[s]}.transpose.map &:max)*""):(g=S[b=c];g=S[b=c]if S[c]<g while 0<c=R[c];Y[b];r=D[b];(O[k]=r;j=R[r];(Y[C[j]];j=R[j])while j!=r;s[k+1];r=O[k];c=C[r];j=L[r];(Z[C[j]];j=L[j])while j!=r;r=D[r])while r!=b;Z[b])}
s[0]

The above ruby code is opposite to my GolfScript subscription. It is quite long (and not yet fully golfed), but optimized for speed. The killer sudoku given above is solved in well under a second (with my original java version it was only a few milli seconds). The solver itself is a basic implementation of Knuth's DLX algorithm.
Input must be given as two lines on STDIN. Example (online):
> AABBBCDEFGGHHCCDEFGGIICJKKFLMMINJKOFLPPQNJOORSPTQNUVVRSTTQWUUXXSYZWWaaXXSYZWbbbcc
3 15 22 4 16 15 25 17 9 8 20 6 14 17 17 13 20 12 27 6 20 6 10 14 8 16 15 13 17

215647398368952174794381652586274931142593867973816425821739546659428713437165289


text:
Rail fence cipher
Write two programs:
- One which reads a string and a key and encodes the string into a rail-fence cipher using that key.
- Similarly, write a program for the reverse function: deciphering a rail fence using a key.
For those who don't know what rail fence cipher is, it is basically a method of writing plain text in a way it creates linear pattern in a spiral way.
Example - when "FOOBARBAZQUX" rail-fenced using key of 3.
F . . . A . . . Z . . . .
  O . B . R . A . Q . X
    O . . . B . . . U

Reading the above spiral line-by-line, the cipher text becomes "FAZOBRAQXOBU".
Read more at - Rail fence cipher - Wikipedia.
Code in any language is welcome.
Shortest answer in bytes wins.

What is the winning criterion ?

Python 133 bytes
def cipher(t,r):
 m=r*2-2;o='';j=o.join
 for i in range(r):s=t[i::m];o+=i%~-r and j(map(j,zip(s,list(t[m-i::m])+[''])))or s
 return o

Sample usage:
>>> print cipher('FOOBARBAZQUX', 3)
FAZOBRAQXOBU

>>> print cipher('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 4)
AGMSYBFHLNRTXZCEIKOQUWDJPV

>>> print cipher('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 5)
AIQYBHJPRXZCGKOSWDFLNTVEMU

>>> print cipher('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 6)
AKUBJLTVCIMSWDHNRXEGOQYFPZ

Note: the results from even rail counts are different than for the code you provided, but they seem to be correct. For example, 6 rails:
A         K         U
 B       J L       T V
  C     I   M     S   W
   D   H     N   R     X
    E G       O Q       Y
     F         P         Z

corresponds to AKUBJLTVCIMSWDHNRXEGOQYFPZ, and not AKUTBLVJICMSWXRDNHQYEOGZFP as your code produces.
The basic idea is that each rail can be found directly by taking string slices [i::m], where i is the rail number (0-indexed), and m is (num_rails - 1)*2. The inner rails additionally need to be interwoven with [m-i::m], achieved by zipping and joining the two sets of characters. Because the second of these can potentially be one character shorter, it is padded with a character assumed not to appear anywhere (_), and then that character is stripped off if necessary it is converted to a list, and padded with an empty string.

A slightly more human readable form:
def cipher(text, rails):
  m = (rails - 1) * 2
  out = ''
  for i in range(rails):
    if i % (rails - 1) == 0:
      # outer rail
      out += text[i::m]
    else:
      # inner rail
      char_pairs = zip(text[i::m], list(text[m-i::m]) + [''])
      out += ''.join(map(''.join, char_pairs))
  return out

A deciphering function is also needed.

@ShuklaSannidhya Then why did you accept an incomplete answer?

@JoKing for clarity, the "two programs" requirement was added one year after I posted my solution.

APL 52 41
i←⍞⋄n←⍎⍞⋄(,((⍴i)⍴(⌽⍳n),1↓¯1↓⍳n)⊖(n,⍴i)⍴(n×⍴i)↑i)~' '

If the input text string i and the key number n are preinitialised the solution can be shortened by 9 characters. Running the solution against the examples given by primo gives identical answers:
FOOBARBAZQUX
3
FAZOBRAQXOBU

ABCDEFGHIJKLMNOPQRSTUVWXYZ
4
AGMSYBFHLNRTXZCEIKOQUWDJPV

ABCDEFGHIJKLMNOPQRSTUVWXYZ
5
AIQYBHJPRXZCGKOSWDFLNTVEMU

ABCDEFGHIJKLMNOPQRSTUVWXYZ
6
AKUBJLTVCIMSWDHNRXEGOQYFPZ

On further reflection there appears to be a shorter index based solution:
i[⍋+\1,(y-1)⍴((n←⍎⍞)-1)/1 ¯1×1 ¯1+y←⍴i←⍞]

A deciphering function is also needed.

Python 2, 124 + 179 = 303 bytes
Encode:

lambda t,k:''.join(t[i+j]for r in R(k)for i in R(k-1,len(t)+k,2*k-2)for j in[r-k+1,k+~r][:1+(k-1>r>0)]if i+j<len(t))
R=range

Try it online!
Decode:

lambda t,k:''.join(t[dict((b,a)for a,b in enumerate(i+j for r in R(k)for i in R(k-1,len(t)+k,2*k-2)for j in[r-k+1,k+~r][:1+(k-1>r>0)]if i+j<len(t)))[m]]for m in R(len(t)))
R=range

Try it online!

You also need a deciphering function

@Jo King: I have belatedly added a deciphererer.

Java 10, 459 451 445 439 327 325 bytes
(s,k,M)->{int l=s.length,i=-1,f=0,r=0,c=0;var a=new char[k][l];for(;++i<l;a[r][c++]=M?s[i]:1,r+=f>0?1:-1)f=r<1?M?f^1:1:r>k-2?M?f^1:0:f;for(c=i=0;i<k*l;i++)if(a[r=i/l][i%l]>0)if(M)System.out.print(a[r][i%l]);else a[r][i%l]=s[c++];if(!M)for(r=c=i=0;i++<l;f=r<1?1:r>k-2?0:f,r+=f>0?1:-1)if(a[r][c]>1)System.out.print(a[r][c++]);}

-14 bytes thanks to @ceilingcat.
-112 bytes combining the two functions with an additional mode-flag as input.
The function takes a third input M. If this is true it will encipher, and if it is false it will decipher.
Try it online.
Explanation:
(s,k,M)->{              // Method with character-array, integer, and boolean parameters
                        // and no return-type
  int l=s.length,       //  Length of the input char-array
      i=-1,             //  Index-integer, starting at -1
      f=0,              //  Flag-integer, starting at 0
      r=0,c=0;          //  Row and column integers, starting both at 0
  var a=new char[k][l]; //  Create a character-matrix of size `k` by `l`
  for(;++i<l            //  Loop `i` in the range (-1, `l`):
      ;                 //    After every iteration:
       a[r][c++]=       //     Set the matrix-cell at `r,c` to:
         M?s[i++]       //      If we're enciphering: set it to the current character
         :1,            //      If we're deciphering: set it to 1 instead
       r+=f>0?          //     If the flag is 1:
           1            //      Go one row down
          :             //     Else (flag is 0):
           -1)          //      Go one row up
    f=r<1?              //   If we're at the first row:
       M?f^1            //    If we're enciphering: toggle the flag (0→1; 1→0)
       :1               //    If we're deciphering: set the flag to 1
      :r>k-2?           //   Else-if we're at the last row:
       M?f^1            //    If we're enciphering: toggle the flag (0→1; 1→0)
       :0               //    If we're deciphering: set the flag to 0
      :                 //   Else (neither first nor last row):
       f;               //    Leave the flag unchanged regardless of the mode
  for(c=i=0;            //  Reset `c` to 0
            i<k*l;i++)  //  Loop `i` in the range [0, `k*l`):
    if(a[r=i/l][i%l]>0) //   If the current matrix-cell is filled with a character:
      if(M)             //    If we're enciphering:
        System.out.print(a[r][i%l]);}
                        //     Print this character
      else              //    Else (we're deciphering):
        a[r][i]=s[c++]; //     Fill this cell with the current character
  if(!M)                //  If we're deciphering:
    for(r=c=i=0;        //   Reset `r` and `c` both to 0
        i++<l           //   Loop `i` in the range [0, `l`)
        ;               //     After every iteration:
         f=r<1?         //      If we are at the first row:
            1           //       Set the flag to 1
           :r>k-2?      //      Else-if we are at the last row:
            0           //       Set the flag to 0
           :            //      Else:
            f,          //       Leave the flag the same
         r+=f>0?        //      If the flag is now 1:
             1          //       Go one row up
            :           //      Else (flag is 0):
             -1)        //       Go one row down
      if(a[r][c]>1)     //    If the current matrix-cell is filled with a character:
        System.out.print(a[r][c++]);}
                        //     Print this character

MATL, 70 bytes (total)
f'(.{'iV'})(.{1,'2GqqV'})'5$h'$1'0'$2'0K$hYX2Get2LZ)P2LZ(!tg)i?&S]1Gw)

Try it on MATL Online
Try multiple test cases
Takes a flag as third input, F to encipher the string, T to decipher it (thanks to  Kevin Cruijssen  for that idea).
This started as a Julia answer until I realized strict typing got in the way too much, especially for decipherment. Here's the Julia code I had for encipherment (backported to v0.6 for TIO):
Julia 0.6, 191 bytes
!M=(M[2:2:end,:]=flipdim(M[2:2:end,:],2);M)
s|n=replace(String((!permutedims(reshape([rpad(replace(s,Regex("(.{$n})(.{1,$(n-2)})"),s"\1ø\2ø"),length(s)*n,'ø')...],n,:),(2,1)))[:]),"ø","")

Try it online!
Explanation:
The rail fence operation
F . . . A . . . Z . . . .
  O . B . R . A . Q . X
    O . . . B . . . U

can be seen as reading r = 3 characters of input, then reading r-2 characters and
prefixing and suffixing that with dummy values (nulls), then reading r characters again,
etc., creating a new column every time:
F.A.Z.
OBRAQX
O.B.U.

then reversing every second column (since the zag part of zigzag goes up instead of down,
which makes a difference when r > 3),
then reading this matrix along the rows, and removing the dummy characters.
Decipherment didn't seem to have any obvious patterns like this, but when searching around
about this I came across this post, which told me that (a) this was a well known and (possibly?) published algorithm
for rail ciphers, and (b) decipherment was a simple reuse of the same method, giving it the
indices of the string and getting the indices of those indices after encipherment, and reading
the ciphertext at those places.
Since decipherment needs to do things by working on indices, this code does encipherment also by
sorting the indices of the string, and then in this case just indexing at those rearranged
indices.
              % implicit first input, say 'FOOBARBAZQUX'
f             % indices of input string (i.e. range 1 to length(input)
'(.{'iV'})(.{1,'2GqqV'})'5$h
              % Take implicit second input, say r = 3
              % Create regular expression '(.{$r})(.{1,$(r-2)})'
              % matches r characters, then 1 to r-2 characters
              %  (to allow for < r-2 characters at end of string)
'$1'0'$2'0K$h % Create replacement expression, '$1\0$2\0'
YX            % Do the regex replacement
2Ge           % reshape the result to have r rows (padding 0s if necessary)
t2LZ)         % extract out the even columns of that
P             % flip them upside down
2LZ(          % assign them back into the matrix
!             % transpose
tg)           % index into the non-zero places (i.e. remove dummy 0s)
i?            % read third input, check if it's true or false
&S]           % if it's true, decipherment needed, so get the indices of the
              %  rearranged indices
1Gw)          % index the input string at those positions

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/