Forum: Ruby Re: Mix and Match (#186)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F50f5d582d76f98686da34917531fe56?d=identicon&s=25 unknown (Guest)
on 2008-12-15 16:27
(Received via mailing list)
Is it possible to post a solution already? (I guess the question is
poetical, just strange that no one posted one yet - was it so hard, or
no
one has time amidst the pre-XMas craze, or... ?)

Cheers,
Peter
___
http://scrubyt.org
http://www.rubyrailways.com
A61ecce13ed142622f24a5ca3a123922?d=identicon&s=25 Matthew Moss (Guest)
on 2008-12-15 16:39
(Received via mailing list)
On Dec 15, 2008, at 9:19 AM, peter@rubyrailways.com wrote:

> Is it possible to post a solution already? (I guess the question is
> poetical, just strange that no one posted one yet - was it so hard,
> or no
> one has time amidst the pre-XMas craze, or... ?)

Perhaps a little harder than it may appear, or as you suggest, people
may be busy. In the worst case, a brute force solution should be easy
to do.

I may try this later today, or tomorrow, once I'm done with the last
papers I need for school and some other errands.
1cb5d53d5bbf3e3afa7960ef55c240e4?d=identicon&s=25 Steven Shingler (sshingler)
on 2008-12-15 22:52
(Received via mailing list)
On Mon, Dec 15, 2008 at 3:31 PM, Matthew Moss <matt@moss.name> wrote:

>
> On Dec 15, 2008, at 9:19 AM, peter@rubyrailways.com wrote:
>
>  Is it possible to post a solution already? (I guess the question is
>> poetical, just strange that no one posted one yet - was it so hard, or no
>> one has time amidst the pre-XMas craze, or... ?)
>>
>
> Perhaps a little harder than it may appear, or as you suggest, people may
> be busy. In the worst case, a brute force solution should be easy to do.


Seeing as how this quiz has been so quiet, here's a v quick (and very
brute
force!) attempt: http://pastie.org/339925 - - please be kind! :)
A61ecce13ed142622f24a5ca3a123922?d=identicon&s=25 Matthew Moss (Guest)
on 2008-12-16 00:15
(Received via mailing list)
On Dec 15, 2008, at 3:44 PM, steven shingler wrote:

>>
>> Perhaps a little harder than it may appear, or as you suggest,
>> people may
>> be busy. In the worst case, a brute force solution should be easy
>> to do.
>
>
> Seeing as how this quiz has been so quiet, here's a v quick (and
> very brute
> force!) attempt: http://pastie.org/339925 - - please be kind! :)


Minor point... I probably wasn't clear by "minimize group duplication."

In your code, you use dup_count in an attempt to avoid having a
particular recipient's gift contain duplication candles. Actually, I
like this requirement, although it wasn't what I meant. (Other subs:
please try and make each gift without candle duplication.)

What I meant is that if I give Janet garden/lavender/orange, I should
not also give Nancy garden/lavender/orange. I want a distinct
combination for each recipient.
87349a7a95b3f2e83c20194ef122885c?d=identicon&s=25 Einar Magnús Boson (Guest)
on 2008-12-16 01:49
(Received via mailing list)
On 15.12.2008, at 23:07 , Matthew Moss wrote:

>>>> hard, or no
>> very brute
>
> What I meant is that if I give Janet garden/lavender/orange, I
> should not also give Nancy garden/lavender/orange. I want a distinct
> combination for each recipient.
>
>


I am not about to partake but these requirements seem to conflict, no?

ppl = [:janet, :nancy, :betty]
candles = [:lavender => 3, :garden => 3, :orange => 3].

the following seems like the best answer to me but contains duplication,

lav, lav, ger
gar, or, or
gar, or, lav


the "uniquest" would be:

lav, lav, lav
gar, gar, gar
or. or. or

but it has more duplication whereas the least duplication has no
uniqueness:
lav, gar, or
lav, gar, or
lav, gar, or

How is uniqueness supposed to be balanced against duplication?

einarmagnus
A61ecce13ed142622f24a5ca3a123922?d=identicon&s=25 Matthew Moss (Guest)
on 2008-12-16 02:07
(Received via mailing list)
On Dec 15, 2008, at 6:41 PM, Einar Magnús Boson wrote:

>>>> On Dec 15, 2008, at 9:19 AM, peter@rubyrailways.com wrote:
>>>> to do.
>> In your code, you use dup_count in an attempt to avoid having a
>
> gar, or, lav
> lav, gar, or
> lav, gar, or
> lav, gar, or
>
> How is uniqueness supposed to be balanced against duplication?

By buying more candles.  :D

But seriously, it will depend on the input. If I had to choose between
those options, I'd prefer to give individuals a variety of fragrances
(avoid duplication more than enforcing uniqueness).
F50f5d582d76f98686da34917531fe56?d=identicon&s=25 unknown (Guest)
on 2008-12-16 02:21
(Received via mailing list)
>
> But seriously, it will depend on the input. If I had to choose between
> those options, I'd prefer to give individuals a variety of fragrances
> (avoid duplication more than enforcing uniqueness).

oops that sucks (should have read the quiz more carefully) - my solution
is enforcing uniqueness but doesn't care about duplication at all :(
Shouldn't take too much effort to add that though... will do tomorrow.

Cheers,
Peter
___
http://scrubyt.org
http://www.rubyrailways.com
F50f5d582d76f98686da34917531fe56?d=identicon&s=25 unknown (Guest)
on 2008-12-16 03:08
(Received via mailing list)
> But seriously, it will depend on the input. If I had to choose between
> those options, I'd prefer to give individuals a variety of fragrances
> (avoid duplication more than enforcing uniqueness).

Ok so a beefed up version (no duplicates if possible, and as unique as
possible):

http://pastie.org/339995

Cheers,
Peter
___
http://scrubyt.org
http://www.rubyrailways.com
This topic is locked and can not be replied to.