### Re: Re: LineDraw Japh

by Roger (Parson)
 on Sep 05, 2003 at 00:46 UTC ( #289071=note: print w/replies, xml ) Need Help??

in reply to Re: LineDraw Japh

Opps, the code I posted earlier confused the HTML syntax. Here's the complete code reposted...

```for (589840, 117506056, 134225920, 671555840,
534280, 1058576, 654911248, 151718157,
269160461, 168496907, 168627981)
{
(\$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\n";

__END__
The following is the picture data in heximal format,
Each number is x1,y1,x2,y2.

0x00090010, 0x07010008, 0x08002000, 0x28072100,
0x00082708, 0x00102710, 0x27092710, 0x090B090D,
0x100B100D, 0x0A0B0F0B, 0x0A0D0F0D

Create A New User
Node Status?
node history
Node Type: note [id://289071]
help
Chatterbox?
 [1nickt]: I had an interview couople of weeks ago, heard from a principal engineer that a friend of his who works at The Google told him that the self-teaching software that determines the dynamic pricing for their adverts... [1nickt]: ... has become so complex that there is no one at the Goole who knows what it does. [marto]: William Gibson was right [moritz]: a classical problem with machine learning [1nickt]: moritz isn;t the difference today that the machine learning algos are in charge of most stuffs? [moritz]: depends on what you mean by "most stuff" [1nickt]: I am sure I don't know about most of the stuff that is no longer controlled by humans. I do know that it's past the point of determining consumer pricing and into things that can kill me with blunt force! [holli]: but is this really a problem 1nickt? Nobody knows how your human taxi drivers brain works either

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2017-11-21 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
In order to be able to say "I know Perl", you must have:

Results (301 votes). Check out past polls.

Notices?