Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi all, Apologies for posting something so similar to my previous effort, but the code is completely different in this one -
  • it doesn't use VT100 codes (except \ec which i think works everywhere),
  • everything is generated (except the shading scale) - compared with it being encoded in this
    theoretically you could make a new shape (along the lines of $x**2+$y**2+$z**2<$r**2 - which is used here)and it would work with that...
  • it actually uses closest path shading to the lightsource
It's also 1 ball of code shorter (a standard i intend to start using - 1 ball =~ 200 chars :-D ).
anyway, without further ado:

$_=q`$_=' @8GCI';@a=/./g; $j=9;$k=9;$w=25;$ c=35;$e= 8;$u=2;$v=1;{$k+=$v* =$k<6|$k>16?-1: 1;$j+=$u*=$j<9|$j>60?- 1:1;my(%l,$m,$n); for$y(0..22){for(0..70 ){$r=($_-$j)/1.6;$s= $y-$k;$d=(($_-$c)**2+( $y-$f)**2+(($w-$r**2-$ s**2)**.5-$e)**2)**.5; if($r**2+$s**2<$w){$m= $d<$m||!$m?$d:$m;$n= $d>$n?$d:$m;$l{$y}{$_} =$d;}}}print"\ec"; for$y(0..22){print$_>6 9?$/:(($d=$l{$y }{$_})?$a[($d-$m)*5/ $n]:$")fo r(0..70)}select$q, $q,$q,.1;redo}`; s#\s##g;eval
Enjoy!
Alex

In reply to Balls! Pt 2 by teamster_jr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-20 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found