ASCII art Bresenham line drawing Write the shortest possible program that draws a Bresenham line in ASCII art.  Your program should take two integers x and y (command line or stdin, your choice) and draw an ASCII line which starts in the upper left and goes right x units and down y units.  You must use _ and \ characters and place them in the correct location according to Bresenham's algorithm.

You may assume x &gt;= y, so no vertical segments are required.

Note that because you're using the _ character, for a line with y=3 you will likely need to output 4 lines of text (and you may emit a leading blank line when it isn't necessary).

examples:

11 3
_
 \___
     \___
         \_
11 1
_____
     \_____

5 4

\
 \_
   \
    \


For points which are exactly halfway you may choose either rounding:

10 1
____
    \_____
or
_____
     \____
Perl, 74
 
/ /;print int(.5+$_*$'/$`)&gt;int(.5+--$_*$'/$`)?$/.$&quot;x$_.'\\':'_'for 1..$`

Run with -n option (counted in code size).
$ perl -n bresenham.pl &lt;&lt;&lt;'11 3'
_
 \___
     \___
         \_
$ perl -n bresenham.pl &lt;&lt;&lt;'11 1'
_____
     \_____
$ perl -n bresenham.pl &lt;&lt;&lt;'5 4'

\
 \_
   \
    \
$ perl -n bresenham.pl &lt;&lt;&lt;'10 1'
____
    \_____