As a script, my one-liner is down to 70 chars including
the newline. It can be shortened a bit as a command-liner.
Wow, nice. Does that include the restriction in the quiz rules that
numbers have to be left alone? Or does your solution rearrange
both numbers and letters?
I agree with you, and I'm very experienced with Ruby. In most cases
the toughness is just in the problem itself, not even the Ruby aspects
of it. I don't usually have time to solve those, but problems like
this which can be done in an hour or so are fun and worthwhile. Plus
all the various solutions usually provide some nice insights (even
from newbies!)
If a problem is so tough that it is even hard to read a solution, let
alone code one, I think the value of the quiz is diminished some. So
I'd suggest we try to keep most quizzes on the easy side and throw in
a few complicated ones now and then.
Actually in hindsight this seems to be the pattern, so keep it up!
Ryan
···
On 4/21/06, Phil Hagelberg <phil@hagelb.org> wrote:
I have to say I am in favor of making quizzes of varying
difficulty. Like some others here, I've been a bit intimidated by all
the heavy meta stuff in the past, but with varying difficulty I can
work my way up to the tough stuff.
One line?
Hmmm.... Methinks I need to go back and reexamine my own solution.
···
On 4/21/06, Yoann Guillot <john-rubytalk@ofjj.net> wrote:
On Fri, Apr 21, 2006 at 11:27:08PM +0900, Gregory Seidman wrote:
> On Fri, Apr 21, 2006 at 11:16:38PM +0900, Dirk Meijer wrote:
> } this quiz is probably easier than usually, as, for the first time
> } ever, i felt up to it, and created a solution in not so much time.
> } i'll be posting it in 48 hrs
>
Mmh, for my first participation, i get a quizz solved by a one-liner.
And still i discover things
} On Apr 21, 2006, at 9:27 AM, Gregory Seidman wrote:
}
} >On Fri, Apr 21, 2006 at 11:16:38PM +0900, Dirk Meijer wrote:
} >} this quiz is probably easier than usually, as, for the first time
} >} ever, i felt up to it, and created a solution in not so much time.
} >} i'll be posting it in 48 hrs
} >
} >Yes, I sent my solution directly to James.
}
} Random playing around...
}
} Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
} Atchtaed is my r?sum?.
} Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
} Acaehttd is my r?sum?.
} Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
} Atceahtd is my r?sum?.
} Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
} Ahaecttd is my r?sum?.
Yeah, it treats accented characters as punctuation. The two regexes could
be changed to handled accented characters, but I leave that as an exercise
for the reader <g>.
} James Edward Gray II
--Greg
···
On Sat, Apr 22, 2006 at 02:28:48AM +0900, James Edward Gray II wrote:
My solution also did not munge résumé. Seems that \w does not include
accented characters, so résumé becomes the words r and sum, which are
too small to be munged. Is there something one can require to make \w
include non-Latin characters?
Ryan
···
On 4/21/06, James Edward Gray II <james@grayproductions.net> wrote:
Random playing around...
Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
Atchtaed is my résumé.
Neo:~/Desktop$ ruby gregory_seidmans_solution.rb
test_document.txt Atchtaed is my résumé.
Neo:~/Desktop$ ruby gregory_seidmans_solution.rb
test_document.txt Acaehttd is my résumé.
Neo:~/Desktop$ ruby gregory_seidmans_solution.rb
test_document.txt Atceahtd is my résumé.
Neo:~/Desktop$ ruby gregory_seidmans_solution.rb
test_document.txt Ahaecttd is my résumé.
Keep in mind that longer words with a purely randomly munged inside will not
be "readable".
"Ahaecttd" takes effort to figure out that it was "Attached" before the
munging.
The physical process of munging is very easy (as we've seen from people
reporting one line results), but modeling something that'll also produce
"readable" results for all lengths of words is a bit more challenging.
Well, I can make one in ~60 chars that rearranges both. Still working on getting <70 for not rearranging numbers....
- Jake McArthur
···
On Apr 21, 2006, at 3:34 PM, Bill Kelly wrote:
From: "Andrew Johnson" <ajohnson@cpan.org>
As a script, my one-liner is down to 70 chars including
the newline. It can be shortened a bit as a command-liner.
Wow, nice. Does that include the restriction in the quiz rules that
numbers have to be left alone? Or does your solution rearrange
both numbers and letters?
I'm still waiting for someone to show off their solution properly handling the trivial (multi-byte) example I showed earlier...
James Edward Gray II
···
On Apr 21, 2006, at 3:34 PM, Bill Kelly wrote:
From: "Andrew Johnson" <ajohnson@cpan.org>
As a script, my one-liner is down to 70 chars including
the newline. It can be shortened a bit as a command-liner.
Wow, nice. Does that include the restriction in the quiz rules that
numbers have to be left alone? Or does your solution rearrange
both numbers and letters?
} One line?
} Hmmm.... Methinks I need to go back and reexamine my own solution.
Heh. I decided against making it a single line for readability purposes.
Yeah, it can be done in a single line, but it will be less readable and
less efficient.
--Greg
···
On Sat, Apr 22, 2006 at 12:24:06AM +0900, Matthew Moss wrote:
} On 4/21/06, Yoann Guillot <john-rubytalk@ofjj.net> wrote:
} > On Fri, Apr 21, 2006 at 11:27:08PM +0900, Gregory Seidman wrote:
} > > On Fri, Apr 21, 2006 at 11:16:38PM +0900, Dirk Meijer wrote:
} > > } this quiz is probably easier than usually, as, for the first time
} > > } ever, i felt up to it, and created a solution in not so much time.
} > > } i'll be posting it in 48 hrs
} > >
} >
} > Mmh, for my first participation, i get a quizz solved by a one-liner.
} > And still i discover things
} >
} > Yoann
} >
} >
}
}
Looks like this Quiz is too easy.
May I suggest smthng to make it more challenging?
1. Vowel can be exchanged with vowel only,
consonant can be exchanged with consonant only;
2. Parameterize the solution, so that set of exchangeable characters classes
can be specified (optionally);
Sorry, if I'm breaking the Quiz rules.
Happy Rubying,
Sergey
One line?
Hmmm.... Methinks I need to go back and reexamine my own solution.
···
----- Original Message ----- From: "Matthew Moss" <matthew.moss.coder@gmail.com>
Sent: Friday, April 21, 2006 11:24 AM
On 4/21/06, Yoann Guillot <john-rubytalk@ofjj.net> wrote:
On Fri, Apr 21, 2006 at 11:27:08PM +0900, Gregory Seidman wrote:
> On Fri, Apr 21, 2006 at 11:16:38PM +0900, Dirk Meijer wrote:
> } this quiz is probably easier than usually, as, for the first time
> } ever, i felt up to it, and created a solution in not so much time.
> } i'll be posting it in 48 hrs
>
Mmh, for my first participation, i get a quizz solved by a one-liner.
And still i discover things
Really? With everyone bragging about how easy this quiz is?
James Edward Gray II
···
On Apr 21, 2006, at 12:33 PM, Gregory Seidman wrote:
On Sat, Apr 22, 2006 at 02:28:48AM +0900, James Edward Gray II wrote:
} On Apr 21, 2006, at 9:27 AM, Gregory Seidman wrote:
}
} >On Fri, Apr 21, 2006 at 11:16:38PM +0900, Dirk Meijer wrote:
} >} this quiz is probably easier than usually, as, for the first time
} >} ever, i felt up to it, and created a solution in not so much time.
} >} i'll be posting it in 48 hrs
} >
} >Yes, I sent my solution directly to James.
}
} Random playing around...
}
} Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
} Atchtaed is my r?sum?.
} Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
} Acaehttd is my r?sum?.
} Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
} Atceahtd is my r?sum?.
} Neo:~/Desktop$ ruby gregory_seidmans_solution.rb test_document.txt
} Ahaecttd is my r?sum?.
Yeah, it treats accented characters as punctuation. The two regexes could
be changed to handled accented characters, but I leave that as an exercise
for the reader <g>.
you know, it's great that this quiz is easy! when i had read the other
ones, i'd feel hopeless and most of the times, i wouldn't even try,
but with this quiz, i knew i could come up with a solution, which made
me study the MatchData class, which'll come in handy for sure some
day!
greetings, Dirk.
···
2006/4/21, Mike <ruby@crazyted.com>:
> Random playing around...
>
> Neo:~/Desktop$ ruby gregory_seidmans_solution.rb
> test_document.txt Atchtaed is my résumé.
> Neo:~/Desktop$ ruby gregory_seidmans_solution.rb
> test_document.txt Acaehttd is my résumé.
> Neo:~/Desktop$ ruby gregory_seidmans_solution.rb
> test_document.txt Atceahtd is my résumé.
> Neo:~/Desktop$ ruby gregory_seidmans_solution.rb
> test_document.txt Ahaecttd is my résumé.
>
Keep in mind that longer words with a purely randomly munged inside will not
be "readable".
"Ahaecttd" takes effort to figure out that it was "Attached" before the
munging.
The physical process of munging is very easy (as we've seen from people
reporting one line results), but modeling something that'll also produce
"readable" results for all lengths of words is a bit more challenging.
Working on my short version. 62 chars long and works for your example, but still trying to get <70 with it working correctly with digits.
-Jake McArthur
···
On Apr 21, 2006, at 4:09 PM, James Edward Gray II wrote:
On Apr 21, 2006, at 3:34 PM, Bill Kelly wrote:
From: "Andrew Johnson" <ajohnson@cpan.org>
As a script, my one-liner is down to 70 chars including
the newline. It can be shortened a bit as a command-liner.
Wow, nice. Does that include the restriction in the quiz rules that
numbers have to be left alone? Or does your solution rearrange
both numbers and letters?
I'm still waiting for someone to show off their solution properly handling the trivial (multi-byte) example I showed earlier...
$ ./munger.rb test.txt
Attehcaed is my résmué.
$ ./munger.rb test.txt
Atthaceed is my réumsé.
$ ./munger.rb test.txt
Attacheed is my rémsué.
$ ./munger.rb test.txt
Attcaehed is my rémusé.
$ ./munger.rb test.txt
Attecahed is my rémsué.
It's four lines though.
···
On Sat, 2006-04-22 at 06:09 +0900, James Edward Gray II wrote:
On Apr 21, 2006, at 3:34 PM, Bill Kelly wrote:
> From: "Andrew Johnson" <ajohnson@cpan.org>
>>
>> As a script, my one-liner is down to 70 chars including
>> the newline. It can be shortened a bit as a command-liner.
>>
>
> Wow, nice. Does that include the restriction in the quiz rules that
> numbers have to be left alone? Or does your solution rearrange
> both numbers and letters?
I'm still waiting for someone to show off their solution properly
handling the trivial (multi-byte) example I showed earlier...
I always handle the quiz solutions that way. See the past problems
for examples.
James Edward Gray II
Aye, usually I'd agree with you. But in this case the two examples are
almost exactly the same. Just changing it to work with input instead of
a string.
The first one I posted was in reply to a post about one-liners. Not
intended as a seperate submission.
And what's with the "3D's" in the mailing list archives?