--Boundary_(ID_i946CdvW4ezDb6K6qusHxA)
Content-type: text/plain; charset=ISO-8859-1; format=flowed
Content-transfer-encoding: 7BIT

I made two this time.  One plays a game and one just picks the word.

Here's the one that just picks a word.  It runs very quickly, about .155 
or .2 seconds.
#! /usr/bin/ruby -w

class Array
	def rand_elem
		self[rand(size)]
	end
end

# Open and read the dictionary.
dict  O.read("/usr/share/dict/words")

# Pick a random word with 6 letters.
baseWord  ict.scan(/^[a-z]{6}$/).rand_elem

# Find words that use the same letters
selectedWords  ict.scan(/^[#{baseWord}]{3,6}$/)

# Display the words.
puts baseWord + ":\n\t" + selectedWords.join("\n\t")

And here's the one that plays a game.  Basically, it gives you the 
letters and you enter the 5 best words you can think of.  The score is 
the length of the word ** 3 added to a running total, but subtracted if 
the word isn't valid (already said or not in the list).

#! /usr/bin/ruby -w

class Array
	def rand_elem
		self[rand(size)]
	end
	
	def english_join
		self[0...-1].join(', ') + ', and ' + self[-1]
	end
end

class String
	def letters
		unless $DEBUG
			split(//).uniq.sort_by{rand}
		else
			split(//)
		end
	end
end

class Game
	@@dict  il
	
	def initialize
		# Open and read the dictionary.
		@@dict || O.read("/usr/share/dict/words")
		
		@points  
		@round  
	end

	def play
		# Pick a random word with 6 letters.
		baseWord  @dict.scan(/^[a-z]{6}$/).rand_elem

		# Find words that use the same letters
		selectedWords  @dict.scan(/^[#{baseWord}]{3,6}$/)
		
		# Initialize word list & continue var.
		guessed  ]
		continue  alse
		
		# Display banner
		puts "",
			"Round #{@round}:",
			"Enter the 5 longest words you can make from the letters 
#{baseWord.letters.english_join}.",
			"Invalid and repeated words count towards the 5 words but subtract 
points.",
			""
		
		# Gather all the points, calculate the score, and see if the player 
should go to the next round.
		5.times do
			print "#{@points}\t"
			word  ets.chomp.downcase
			if !guessed.include?(word) && selectedWords.include?(word)
				@points + ord.length ** 3
				guessed << word
				continue  rue if word.length 6
			else
				@points - ord.length ** 3
			end
		end
		
		# Go on to the next round or lose.
		if continue
			@round + 
			play
		else
			puts "Sorry, you didn't get a 6 letter word.  You got #{@points} 
points, however."
		end
	end
end

Game.new.play

Ruby Quiz wrote:
> This is a riff on the Jumble puzzle found in many (US) newspapers. More
> specifically, it's based on the game TextTwist[1], made by GameHouse[2] and
> published in various places around the web.

--Boundary_(ID_i946CdvW4ezDb6K6qusHxA)
Content-type: application/x-ruby; name=wordjumblefast.rb
Content-transfer-encoding: base64
Content-disposition: inline; filename=wordjumblefast.rb

IyEgL3Vzci9iaW4vcnVieSAtdwoKY2xhc3MgQXJyYXkKCWRlZiByYW5kX2VsZW0KCQlzZWxm
W3JhbmQoc2l6ZSldCgllbmQKZW5kCgojIE9wZW4gYW5kIHJlYWQgdGhlIGRpY3Rpb25hcnku
CmRpY3QgPSBJTy5yZWFkKCIvdXNyL3NoYXJlL2RpY3Qvd29yZHMiKQoKIyBQaWNrIGEgcmFu
ZG9tIHdvcmQgd2l0aCA2IGxldHRlcnMuCmJhc2VXb3JkID0gZGljdC5zY2FuKC9eW2Etel17
Nn0kLykucmFuZF9lbGVtCgojIEZpbmQgd29yZHMgdGhhdCB1c2UgdGhlIHNhbWUgbGV0dGVy
cwpzZWxlY3RlZFdvcmRzID0gZGljdC5zY2FuKC9eWyN7YmFzZVdvcmR9XXszLDZ9JC8pCgoj
IERpc3BsYXkgdGhlIHdvcmRzLgpwdXRzIGJhc2VXb3JkICsgIjpcblx0IiArIHNlbGVjdGVk
V29yZHMuam9pbigiXG5cdCIp

--Boundary_(ID_i946CdvW4ezDb6K6qusHxA)
Content-type: application/x-ruby; name=wordjumblegame.rb
Content-transfer-encoding: base64
Content-disposition: inline; filename=wordjumblegame.rb

IyEgL3Vzci9iaW4vcnVieSAtdwoKY2xhc3MgQXJyYXkKCWRlZiByYW5kX2VsZW0KCQlzZWxm
W3JhbmQoc2l6ZSldCgllbmQKCQoJZGVmIGVuZ2xpc2hfam9pbgoJCXNlbGZbMC4uLi0xXS5q
b2luKCcsICcpICsgJywgYW5kICcgKyBzZWxmWy0xXQoJZW5kC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