From: Sam Gentle Date: 2006-01-13T06:06:28+09:00 Subject: Re: Important Algorithm Finally Ported. On 1/13/06, Phrogz wrote: > I think you missed a bit: > > def slim_shady_finder( homies ) > homies.find{ |some_guy| some_guy.name.eql?( "Slim Shady" ) and not > some_guy.imitating? } > end But surely you can't just know if a slim shady is just imitating without first asking them to stand up. Perhaps: slim_shadies.find { |slim_shady| slim_shady.stand_up_unless { slim_shady.imitating? } } Of course, that has problems - for one, it messes up the shadies' persistent 'standing' state. This could cause serious problems with false negatives if they were asked to "please stand up" twice in a row. It might be possible to subsequently make them sit again, but the whole thing loses thread safety easily (what if two programs simultaneously need to find the real slim shady?). To top it all off, there are potential accessibility issues for disabled slim shadies who are unable to stand. I consider this particularly likely to become a problem if every person is a slim shady lurking. I think the only real solution here is to accept that there is a slim shady in all of us and make slim_shady_finder simply return nil. Sam