Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Not a palindrom: a boustrophedon

by BooK (Curate)
on Dec 09, 2000 at 06:54 UTC ( #45852=obfuscated: print w/replies, xml ) Need Help??

This was my other "too long for OPC5" obfuscation (the other was The Best Ever). It is a boustrophedon.

END{$00=~s/(.*)(\n)/(++$*%(@ARGV?1:2)?reverse$1:$1).$2/ge;eval$00}$00= +<<'OPC 5' "-|=I+X#.";($W,$H,$w,$h,$z,$n,$i)=(79,23,2,2,1,25,1);'esrever lave;". +#X+I=|-" ';while(@ARGV){${pop@ARGV}=pop}do{while(/([a-z])\s*([-\d.]*)/cgi){${$1 +}=$2if$1} ;#%)":^//@]n\n$<:%z$<*%a$<^%A$<_}y$<=%x$<!%h$<|%w$<[%j$<(%H$<;%W$<'#qq +=_$;_$=e$ @c=split//,$00;for(1..$i){$w*=$z;$h*=$z;$A+=$a;for(0..$H*$W-1){($U,$R, +@0)=(f($_ %$W,int$_/$W),$n);($p,$q)=($j?($x,$y):(#(:)y$,x$(?j$(=)q$,p$(;)n$,)W$/ +_$tni,W$% $U,$R));do{($U,$R)=($U*$U-$R*$R+$p,$U*2*$R+$q)}until(($U*$U+$R*$R>4)|| +--$0[0]== 0);print$c[int($0[0]*9/$n)],++$_%$W?$# : #$?W$%_$++,])n$/9*]0[0$(tni[c +$tnirp;)0 "\n"}};sub f{($w/$W*($_[0]-($W-1)/2)*cos($A)+$h/$H*(($H-1)/2-$_[1])*si +n($A)+$x, ($_[0]-($W-1)/2)*-$w/$W*sin($A)+$h/$H*(#(*H$/h$+)A$(nis*W$/w$-*)2/)1-W +$(-]0[_$( ($H-1)/2-$_[1])*cos($A)+$y)};exit if$e=~/q/;BEGIN{push@ARGV,split' ',$ +ENV{TPJ}} }#)><(elihw}tnirp;"ujd:zhoCawHmn =WxAy"{("\)*|@]^[;/:%<'!_="y;/%Y$<Y%X +$<X%/}/s; OPC 5

The README file said:
0) I shouldn't tell anything: once you've run it, what it does is obvious.
1) One hint: it has two modes, depending on its command-line parameters...
3) Try these: x .404 y -.35703 w 5 h 5 i 108 z .9 A -.3 a .3 n 100 and save the result in a file
4) Then play it with PgUp/PgDn in an advanced enough text editor.
5) It doesn't fit in any of this year's categories. :-(

Replies are listed 'Best First'.
by BooK (Curate) on Dec 09, 2000 at 07:07 UTC

    Cet assombrissement est soumis au nom de canal assombri.

    YES, BUT NO...

    This program is in fact two programs. 966 characters divided by two: 483. Each of these program would fit nicely in 512 character. And tell me about inner beauty...


    This entry is based on a suggestion made to me by Stéphane Payrard: "Why don't you try a boustrophedonic form?", he asked. So I did. Since the term is defined in "The new hackers's dictionary", I had every reason to do so.

    The first line of the program is actually a small "bootstrap" that read the rest of the file (here-document) and processes it before running the result.


    Apart from using deprecated variables like $* ($# could have been put to more work, had I had more inspiration), the first line treats the program to eval differently depending on the presence of command-line arguments. If there are, the bootstrap evals the text without modification. Else, the program is treated as a boustrophedon, and every even line is reversed. (All that is done in the END statement at the beginning.)

    The rest of it is a gross use of comments and qquoted strings, combined with the math needed for the fractals calculus and real to character screen- coordinates conversion. A few features were added to fill the last blanks, for example the use of the TPJ environment variable.

    In interactive mode, the command are given in the following manner: for example, x.404y-.35703 w5 h 5 i 108z.9A-.3 a .3 n 100 the whitespace is optionnal (this is a difference with command-line parameters)


    Here is the meaning of each command (and variable: each command is in fact a variable assignement):

    • x: x-coordinate of the center of the screen (default: 0)
    • y: y-coordinate of the center of the screen (default: 0)
    • W: width of the output in characters (default: 79)
    • H: height of the output in characters (default: 23)
    • w: width of the printed screen (in real coordinates) (default: 2)
    • h: height of the printed screen (in real coordinates) (default: 2)
    • j: if non-zero, the printed image is the Julia set of parameter (x,y) (default: 0)
    • X: x-coordinate of the center of the screen when displaying a Julia set (default: 0)
    • Y: y-coordinate of the center of the screen when displaying a Julia set (default: 0)
    • A: absolute rotation angle of the image (default: 0)
    • a: relative rotation angle between the image and the next (default: 0)
    • z: zooming factor between two images (default: 1)
    • n: number of iterations for the calculus (default: 25)
    • q: Quits the interactive program after next image.


    Line 1: The variable $00 is assigned the rest of the program's content, and eventually modified in the end.
    Line 2: The default values are affected.
    Line 3: The batch program reads its command-line parameters and affects the values.
    Line 4: The interactive program creates its prompt (with each non-zero value printed)
    Lines 5-8: Part of the math for the iterations. Note that only half of the lines are useful : the '#' splits them in two. (Line 8, it's the second '#' that starts the comment.
    Lines 9-11: The subroutine f contains all the necessary maths.
    Line 11: The BEGIN at the end reads the values in the TPJ environnement variable and puts them in @ARGV for processing by the program. Please note that this BEGIN is executed after the previous END.
    Line 12: s/// and y/// convert the prompt from garbage to human-readable stuff. Thanks.

    Lines 6, 8 and 10 are perfectly symmetric, which is some kind of waste of characters (imagine of much could have been squeezed out to fit into category 3...).


    For other ASCII-art animations, please refer to:

Re (tilly) 1: Not a palindrom: a boustrophedon
by tilly (Archbishop) on Dec 09, 2000 at 07:16 UTC
    OK, ASCII art I have heard of and seen.

    An ASCII movie???

      You mean you never saw "Bambi vs. Godzilla" on a vt100/220 terminal? Back before the web, that's all the entertainment we had. :)
      I know I shouldn't mention this as it bears an <R> rating and weight somewhere in the region of 170 Meg...
      so I won't.

      Kiddies remember: If a stranger comes up to you and offers some unknown ASCII, always refuse it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://45852]
Approved by root
[choroba]: Can you steal the code from pm-cb-g?
[Tanktalus]: maybe next week at the earliest. :P
[Tux]: Don't you ♥ Unicode :)
[Tanktalus]: Tux: usually, yes. :P

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2017-09-25 21:26 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (291 votes). Check out past polls.