title: Code Golf: Connecting the dots
body: <p>You may remember these drawings from when you were a child, but now it's time to let the computer draw them (in full ascii splendour). Have fun!</p>
  
  <p><strong>Description:</strong></p>
  
  <p>The input are multiple lines (terminated by a newline) which describe a 'field'. There are 'numbers' scattered across this field (seperated by whitespace). All lines can be considered to be the same length (you can pad spaces to the end).</p>
  
  <ul>
  <li>the numbers always start at 1</li>
  <li>they follow the ordering of the natural numbers: every 'next number' is incremented with 1</li>
  <li>every number is surrounded by (at least) one whitespace on its left and right</li>
  </ul>
  
  <p><strong>Task:</strong></p>
  
  <p>Draw <em>lines</em> between these numbers in their natural order 
  <code>(1 -&gt; 2 -&gt; 3 -&gt; ...N)</code> (assume N &lt;= 99) with the following characteristics:</p>
  
  <ol>
  <li>replace a number with a '<code>+</code>' character</li>
  <li>for horizontal lines: use '<code>-</code>'</li>
  <li>for vertical lines: use '<code>|</code>'</li>
  <li>going left and down or right and up: <code>/</code></li>
  <li>going left and up or right and down: <code>\</code></li>
  </ol>
  
  <p><em>Important notes:</em> </p>
  
  <ol>
  <li><p>When drawing lines of type 4 and 5 you can assume (given the points to connect with coordinates x1, y1 and x2, y2) that <code>distance(x1,x2) == distance(y1,y2)</code>.   Or in other words (as user jball commented): "consecutive elements that are not horizontally or vertically aligned always align to the slope of the slash or backslash".</p></li>
  <li><p>It is important to follow the order in which the dots are connected (newer lines can strike out older lines).</p></li>
  </ol>
  
  <p><strong>-- Sample input 1 --</strong></p>
  
  <pre>
                                    8 
  
                                    7  6 
                        10       9       
  
                                          5            
  
                                       3  4        
                   11 
  
                     12                       13    
            1                          2                     
  </pre>
  
  <p><strong>-- Sample output 1 --</strong></p>
  
  <pre>
                                   +                                
                                  /|                                
                                 / +--+                             
                       +--------+      \                            
                      /                 \                           
                     /                   +                          
                    /                    |                          
                   /                  +--+                          
                  +                   |                             
                   \                  |                             
                    +------------------------+                      
           +--------------------------+        
  </pre>
  
  <p><strong>-- Sample input 2 --</strong> </p>
  
  <pre>
                          64          
                          63              
  
  
  
                      62 61                             
                 1  65                                   
                   66    57 58                               
                 2      56  59               45                
                     67  55                  46              
               3                               44           
                           54  60            47              
                            53 52   49      48              
               4                51 50       43            
  
             5                                42              
                                              41               
             6              23                                 
                            22 25  26       40              
                        20 21 24            34                 
                7 13 12                    33                    
                      19              27  32                     
                  14                        35               
             8   15                                           
                  16                                         
                                     39                        
                  17  18         28  31 36                  
                 9                     38                       
                  10 11          29  30 37                       
  </pre>
  
  <p><strong>-- Sample output 2 --</strong> (<a href="https://meta.stackexchange.com/questions/37328/my-godits-full-of-unicorns">unicorn reference</a>)</p>
  
  <pre>
                         +        
                        /+      
                       //          
                      //        
                     //           
                    /+--+        
                +  +     \         
                | +     +-\+          
                +  \   +   \                +         
               /    +   +   \               +\    
              +          \   \              | +       
              |           +   +             +/           
              |            +--+    +-------+/               
              +                +--+        +              
             /                              \              
            +                                +               
            |                                +                 
            +              +                /             
             \             +\ +---+        +           
              \        +--+  +     \      /+              
               + +--+ /             \    /+|             
              /  |  |+               +  /+ |                 
             /   +  ||              /  //  +            
            +   +   ||             /  //  /                
             \   +  ||            /  //  /              
              \  |  ||           /  +/  /                  
               \ +---+          +   +\ +                  
                +   |           |   | +|                 
                 +--+           +---+  +               
  
  </pre>
  
  <p><strong>Winner:</strong> </p>
  
  <p>Shortest solution (by code character count). Input can be read via standard input.</p>