Skip to content

Instantly share code, notes, and snippets.

@Mikoangelo
Created January 1, 2011 16:01
Show Gist options
  • Save Mikoangelo/761822 to your computer and use it in GitHub Desktop.
Save Mikoangelo/761822 to your computer and use it in GitHub Desktop.
A Ruby script that prints a matrix of valid two-letter Scrabble words.
Letters = (?A..?Z).to_a
Words = %w[AA AB AD AE AG AH AI AL AM AN AR AS AT AW AX AY BA BE BI BO
BY DE DO ED EF EH EL EM EN ER ES ET EX FA GO HA HE HI HM HO
ID IF IN IS IT JO KA LA LI LO MA ME MI MM MO MU MY NA NE NO
NU OD OE OF OH OM ON OP OR OS OW OX OY PA PE PI RE SH SI SO
TA TI TO UH UM UN UP US UT WE WO XI XU YA YE YO] # http://phrontistery.info/scrabble3.html
Separator = "|"
puts " " + Separator + Letters * (" " + Separator)
Letters.each do |first|
print first + " "
Letters.each do |second|
word = first + second
if Words.include? word
print word
else
print " "
end
print Separator
end
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment