Not terribly good ASCII art, but another fun principle that I don't think I've seen used before (though I'm sure I'll be corrected if wrong :)). All analysis and suggestions for improvement / golfing most welcome.
for(2424832,201326592,203754496,2427941,50987779,117900295,151259139,
134613253,51317003,152306448,101778958,152371989,51905302,68813593,688
+14358,
152896285,102827550,153223970){($x,$y,$v,$w)=unpack"c*",pack"l",$_;$e=
+$v-$x;
$g=$w-$y;$h=abs$e;$k=abs$g;$d=$h>$k;for(0..(($d)?$h:$k)){$f+=$d?$g/$e:
+$e/$g;
$f1=$f;int$f&&do{$y+=$d?$g>0?1:-1:0;$x+=$d?0:$e>0?1:-1;$f+=$f>0?-1:1};
$c[$y]||=' 'x 60;substr($c[$y],$x+1,1)=abs$f1>=1?$f1>0?"\\":"/":$d?"-"
+:"|";
$d?($x+=$e>0?1:-1):($y+=$g>0?1:-1);}};$"="\n";print"@c";
Cheers, Ben.
update Removed all those brackets left over from starting life as a C coder :)
update Stripped a few spare vars etc.
-
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.