From: Jason Mayer Date: 2007-01-16T09:27:36+09:00 Subject: Re: newbie question about sets ------=_Part_99419_17691195.1168907253580 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/15/07, Daniel Finnie wrote: > > You shouldn't really have to avoid this. The 6 letter word should be 6 > unique letters, otherwise how would there be 6 letters for the user to > guess? > > Dan > So here's what one of my coworkers sent to me: Current score: 5900 Incorrect: 2 EIINSS 17 possible words left! word:inn Current score: 5990 Incorrect: 0 In this case, "inn".split(//).sort would be s2, and @s1 would be EIINSS.split(//). N did not appear in the word list twice, but the part of my code that said if s2.subset?(@s1) returned true because the actual values compared were s2= Set: {"i", "n"} @s1 = Set: {"e", "i", "n", "s"} s2 is in fact a subset of @s1, but if Set allowed for multiple non-unique values (i.e. {"i", "n", "n"}) then it wouldn't have been the case. In the end, it doesn't matter... I was just looking to make a game for me and my coworkers. Tech support is boring. But maybe finding all the words in seisin is more boring. I don't know. ------=_Part_99419_17691195.1168907253580--