Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Just another Bach Hacker

by benn (Priest)
on Sep 08, 2003 at 10:03 UTC ( #289733=obfuscated: print w/ replies, xml ) Need Help??

JS Bach (IMHO, the first true 'music hacker'), placed his 'sig' in many of his pieces of music - in German notation, 'H' is 'B' and 'B' is a B-flat, so Bb A C B = B A C H. Here's my attempt at a tribute...
@n= map{[($_ >4&&$_<14 &&$_%2?'-': ' ')x 56]}( 0..16 ); l($_ ,5 ,8) for (32 ,55 ,56 );p (5 ,2, 13 ,'X') ; d(1,5, "XXX");d( 16,3,"XXX" );n(20,9); n(27,10);n (37,8);n(45 ,9);for $k (6,10){l(14 , $k,2);for(0 , 1){c($k+$_ , 13-$_,"/") ;c ($k+1,13 +( 2*$_),"_" )}}c(int (2*cos ($_*0.39)+11), int(4* sin($_*0.39)+4), "X")for (-5..8);l(17,8,1);c( 9,18, ')');c( $_ ,9-$_,"X") for (2..9); sub p{c($_, $_[0] ,$_[3]) for ($_[1] .. $_[1] + $_[2]) ;} sub d{ $x= $_[1] ; c( $_[0] ,$x++ ,$_ )for split(//,$_[2]);} sub l {p(@_,"|");} sub n {($x ,$y)= @_;l ($x, $y+1 ,3); d($y, $x, "(_)");c ($y -1,$x-2,"_" ); }sub c{$n[ $_[0] ][$_[1]]= $_[2] ;}print join ("\n", map{join("",@$_)} @n),"\n";
Cheers, Ben.

Comment on Just another Bach Hacker
Download Code
Re: Just another Bach Hacker
by halley (Prior) on Sep 08, 2003 at 14:32 UTC
    This is very pretty and simple! I like the fact that you're not afraid to use syntax that requires the whitespace where it is, and doesn't split tokens, instead of using a spaceless syntax and using a s/\s*//g-and-eval.

    --
    [ e d @ h a l l e y . c c ]

      I agree it's nice. Note however that there's also the sub'name{body} syntax (I wonder who discovered it, maybe domm in Space Invaders) and of course BEGIN{*name=sub{body}} too.

Re: Just another Bach Hacker
by davido (Archbishop) on Sep 08, 2003 at 17:51 UTC
    If Bach were looking in on Perl's Monastery Gates from behind the Pearly gates, I'm sure he would give you the ++ of approval for a job well done with this artistic OBFU.

    Dave

    "If I had my life to do over again, I'd be a plumber." -- Albert Einstein

Re: Just another Bach Hacker
by wufnik (Friar) on Sep 08, 2003 at 20:48 UTC
    correct down to the treble clef winding around g, hearty congrats.

    concrete scripting like the above beats any miserable offering from damien hirst etc imho. someone should produce a gallery of them.

    ...wufnik.
Re: Just another Bach Hacker
by jest (Pilgrim) on Sep 09, 2003 at 01:09 UTC

    My god, how do you people do this?

    I always imagine, "One day I'll write my own JAPH," and then walk in here and see something like this. It's really amazing. ++benn for giving me something to shoot for.

Re: Just another Bach Hacker
by chanio (Priest) on Sep 09, 2003 at 03:20 UTC
    Can someone tell me how is this done?

    Not by hand, I suppose.

    I always loved those pictures made of characters that do the different shades and are weighted by the surface of black that they occupy.

    They must use some sort of 'mask'. To addapt those characters to some areas of a picture . Something interesting to learn, don't you think?

    This is a masterpiece!

      Not by hand, I suppose.
      Actually, this one was all done by hand (as opposed to Just Another Larry, where I freely admit to using a tool to get my initial picture :)). I *looked* at some generated-ASCII-art as a starting point for the formatting, but with something like this (where, as halley says, the code is using compulsory whitespace etc.) it's near-impossible to automate. You just have to fiddle around until it fits. If you look carefully, you'll see there's lots of 'cheating' going on - the '+' sign in the middle of the downstroke for instance (where I would have loved to have been able to stick another 'sub' or 'for'), or the 'print join' in the tail...an automatic version would presumably have found a better 'fit'.

      Glad you liked it,
      Ben.


        Ok now i want to learn how to do this stuff.
        Is there a tutorial somewhere in which i can learn some basics and get a hang of how to think in this direction
        If there isn't ,why dont one of you gurus write one :)

        Nice obfu! If you peer at the Snowflakes section of Acme::EyeDrops there's an example of how you can make composing these type of obfus a little bit less tedious, though it usually requires quite a bit of manual adjustment, unfortunately. /me scribbles note to add a similar shape to next release of A::E.

Re: Just another Bach Hacker
by Roger (Parson) on Sep 09, 2003 at 04:12 UTC
    Certainly a masterpiece, one of a kind! Great work!
Re: Just another Bach Hacker
by sweetblood (Parson) on Sep 10, 2003 at 15:21 UTC
    What more can I add that hasn't already been said. Who says programming isn't an artistic endevour?

    ++Ben .. It's a real inspiration!

Re: Just another Bach Hacker
by Notromda (Pilgrim) on Sep 10, 2003 at 17:49 UTC
    Great JAPH, but I don't understand what you mean by "in German notation, 'H' is 'B' and 'B' is a B-flat".
      In a German orchestral score, "Klarinetten in B" would mean "Clarinets in Bb', whereas "Pauken in H" would be "Timpani in B". Don't ask me why (I must research it some day), but it's been like that for hundreds of years, and has caught me (and many others) out before now, necessitating a swift retune after playing the 1st note :)

      Cheers, Ben.

        I think here is the "why," fairly clearly written in the first two paragraphs of the message ... thanks to Bear Woodson of the "Horn" group from yahoo groups.

        >Yes, the Note "H" evolved out of the Medieval
        >German Note of "H" or rather a "Hard B", or now
        >called "B Natural". Our Modern "Flat" Sign evolved
        >out of a "Soft B" or "Bb". In Modern German, "B"
        >equals the note "Bb", and "H" means "B-Natural".

        >From this evolved the Musical Motive "B, A, C,
        >H", or rather "B-Flat, A, C, B-Natural", which even
        >Johann Sebastian Bach used in a keyboard fugue,
        >that he never finished.

        Here is the link:

        http://groups.yahoo.com/group/horn/message/4632

        Wow... I have some experience in music, but I had never heard that.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://289733]
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-08-01 07:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (257 votes), past polls