William James schrieb:
> True.  Improvement to the reading of the word-list is also possible:
> 
> dict={}; IO.foreach(ARGV.pop||"words.txt"){|w| dict[w.chomp] = "" }
> triplets = [ %w(ubc deg lap pyq), %w(ved run pac ken alm mli rnt alg) ]
> 
> def num_to_str( n, base, ary )
>   n.to_s(base).rjust(ary.size,"0").split('').zip( ary ).
>   inject(""){|out,x| out << x.first.tr("0-9a-z",x.last) }
> end
> 
> triplets.each do |ary|   (3**ary.size).times{ |i|
>   word = (num_to_str(i,3,ary)); p word if dict[word] }
> end

One more improvement:

   def num_to_str( n, base, ary )
     n.to_s(base).rjust(ary.size,"0").split('').zip( ary ).
     inject(""){|out,(i,s)| out << i.tr("0-9a-z",s) }
   end

Regards,
Pit