------_extPart_001_01C743F3.21809F30
Content-Type: text/plain;
	charsets-ascii"
Content-Transfer-Encoding: quoted-printable

I have a fairly verbose submission for this quiz. It's probably quite
slow compared to others, but at least I can follow my own code :) One
question for the more advanced rubyists - I use sets in one place, and
tried to unit test the results, but Set.== didn't perform as I would
have expected... for instance:

require 'set'
s1 = Set.new
s1 << {1=>2}
s1 << {2=>3}
s2 = Set.new
s2 << {1=>2}
s2 << {2=>3}
s1 == s2

is false. Presumably this is due to reference v.s. values equality, but
I thought that since Hash defines values-based ==, Set.== would use it,
but it appears not. This is somewhat surprising, I'll warrant.

Oh, and what's the preferred submission method - attachment, inclusion,
or pastie?

- donald

------_extPart_001_01C743F3.21809F30
Content-Type: application/octet-stream;
	nameoothpicks.rb"
Content-Transfer-Encoding: base64
Content-Description: toothpicks.rb
Content-Disposition: attachment;
	filenameoothpicks.rb"

IyFjOlxydWJ5XGJpblxydWJ5LmV4ZQ0KIw0KIyBJbXBsZW1lbnRzIHRvb3RocGljayBleHByZXNz
aW9ucyBmb3IgaW50ZWdlcnMNCiMNCiMgUnVieSBRdWl6IDExMQ0KIw0KIyBEb25hbGQgQmFsbCAy
MDA3LTAxLTI5DQoNCnJlcXVpcmUgJ3NldCcNCg0KbW9kdWxlIFRvb3RocGlja3MNCg0KICAjIFBS
SU1FUyBhcmUgbW9zdCBzdWNjaW5jdGx5IGV4cHJlc3NlZCBpbiB0b290aHBpY2tzIGFzIHRoZW1z
ZWx2ZXMNCiAgUFJJTUVTID0gWyAyLCAzLCA1LCA3LCAxMSBdDQogICMgRVhQQU5TSU9OUyBhcmUg
bW9zdCBzdWNjaW5jdGx5IGV4cHJlc3NlZCBpbiB0b290aHBpY2tzIGFzIGNvZGVkIGhlcmUNCiAg
RVhQQU5TSU9OUyA9IHt7Mj0+M30gPT4gOCwgezI9PjEsIDM9PjF9ID0+IDYsIHsyPT4yfSA9PiA0
fQ0KDQogIG1vZHVsZSBDbGFzc01ldGhvZHMNCg0KICAgICMgRXhwYW5k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