Ant Paths

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

An ant starts on a point in an integer lattice facing north. For each integer n he encounters, he first makes a 90 degree turn, to his right if n>=0 or else to his left, and then walks n units in that direction. Please draw the resulting shape followed by an empty line, for each line of input.

-- mitchs

Options

exec is denied

no deadline, the server will not save your submission

Sample input:_

1 1 1 1
2 2 2 2
1
0 0 1
2
1 0 0 0 1
0 1
0 0 0 1
1 2 3 4 5 6 7 8 9 10
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10
1 -1 2 -2 3 -3 4 -4
10 0 5 5 0 10
2 1 -1 2 1 -1 2 1 -1 2 1 -1
5 1 5 1 1 1 -1 -1 1 1 -1 -1
-2 -2 -5 -2 -2 -2 -5 -5 0 3 2 -2 -3 -2 2 1 2 -1 -5 2 2 0 2 -4 -2 -2 -5 -2 -2 -2 -3 -5 0 5 -1 -5 2 0 2 -2 -1
-2 5 1 4 0 2 3 -1 0 1 1 -1 0 1 -1 1 0 1 1 2 2 1 0 1 4 2 -1 -1 0 1 1 2 3 4 1 0 1 1 5 1 0 1 3 2 0 1 -2 -1 1 -2 1 2 -2 1 2 0 2 -1 1 -2
0 0 0 10 1 10 0 5 1 5 0 2 1 2 0 2 1 2 0 8 1 8
2 4 -2 -4 5
6 3 -3 -5 4 1 -7 -3 5 5 -8 -4
8 7 -4 -3 3 5 4 -4 3 -5 5 4 3 -6 -6 8
16 2 16 2 4 2 -4 -2 4 2 -4 14 16 2 16 2 4 2 -4 -2 4 2 -4 12 2 12 2 4 2 -4 -2 0 2 -2 12 -2 -4 -2 4 2 8 12 -2 -4 -2 4 2 0 2 -6 12 -2 -4 -2 4 2 0 2 2 -8 2 4 2 2 -8 2 4 2 4 -6 2 4 2 2 -8 2 4 2 2 -4 -4 -4 -4 -2 -4

Sample output:

 _
|_|

 ___
|   |
|___|

_

_

___

___

|

|

 _________________
|                 |
|    _________    |
|   |         |   |
|   |    _    |   |
|   |     |   |   |
|   |_____|   |   |
|             |   |
|_____________|   |
                  |
                  |

 _________________
|                 |
|    _________    |
|   |         |   |
|   |    _    |   |
|   |   |     |   |
|   |   |_____|   |
|   |             |
|   |_____________|
|
|

                   |
                   |
                   |
            _______|
           |
           |
      _____|
     |
  ___|
_|

         |
         |
         |
         |
_________|_________
         |
         |
         |
         |
         |

   ___
 _|   |_
|       |
|_     _|
  |___|

 _________
|_|_|_|_|_|

                                       ___
                |                   | |
                |                   | |_
 ___   ___   ___|  ___   ___   ___  | |
|     |   | |   | |___| |   | |   | | |
|_____|___|_|___|_|_____|___|_|___|_|_|
                            |
                         ___|

 _ ___ _______ _____
| |   |    _  |     |
| |_|___| | | |_| | |
| |   |  _| |___ _| |
| | |___|    ___|  _|
|___|_____|_________|

 _
| |
| |      _
| |     | |
| |     | |
| |_    | |
| | |   | |
| | |   | |
| | |_ _| |
| | | | | |
| | | | | |

___     _________
   |   |
   |   |
   |   |
   |___|

                                        _________
                                       |         |
                  _______              |         |               |
                 |       |_____________|         |               |
___________      |                               |               |
           |     |                               |_______________|
           |     |
           |_____|

 _______________
|               |
|               |
|               |
|               |        _____
|               |       |     |
|               |       |     |
|               |_______|     |
|___________                  |
            |          _______|
            |         |
            |         |
            |         |
            |    _____|
       _____|   |
      |         |
      |         |
      |         |
      |_________|

 _______________________________
|       |       |       |       |
|_______|_______|_______|_______|
|   |       |       |       |   |
|   |_______|_______|_______|   |
|   |   |       |       |   |   |
|___|   |_______|_______|   |___|
|   |   |   |       |   |   |   |
|   |___|   |_______|   |___|   |
|   |   |   |       |   |   |   |
|___|   |___|_______|___|   |___|
|   |   |       |       |   |   |
|   |___|_______|_______|___|   |
|   |       |       |       |   |
|___|_______|_______|_______|___|
|       |       |       |       |
|_______|_______|_______|_______|

Sample input:_

1 1 -1 1 1 -1 -1 1 1 1 -1 -1 1 -1 -1
1 1 -1 1 1 -1 -1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 -1 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1 2 -1 -2 
1 -1 2 1 1 2 1 -1 1 -1 2 2 -3 -1 -1 -3 -1 -1 -3 -1 -1 -3 -2 2 1 -1 1 -1 2 1 1 2 1 -1 1 -1 1 1 -1 1 -1 2 1 1 2 1 -1 1 -1 2 2 -3 -1 -1 -3 -1 -1 -3 -1 -1 -3 -2 2 1 -1 1 -1 2 1 1 2 1 -1
1 -1 1 2 -1 -1 1 -1 -1 1 2 -1 -1 1 1 -1 1 2 -1 -1 1 1 -1 1 2 -1 -1 2 -1 1 2 -1 -1 1 -1 -1 1 2 -1 -1 1 -1 -1 1 2 -1 -1 1 1 -1 1 2 -1 -1 1 
2 1 -2 -2 -1 2 1 -2 -2 -1 2 2 1 -2 -1 2 2 1 -2 -1 2 2 1 -2 -2 -1 2 1 -2 -2 -1 2 2 1 -2 -1 2 2 1 -2 -1 2 2 1 -2 -2 -1 2 1 -2 -2 -1 2
1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1
1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 1 -1

Sample output:

   _
    |_
     _|
   _|_
 _| |_|
|_

                     _       _
                    |_|_    |_|_
                 _   _|_|_   _|_|
                |_|_|_|_|_|_|_|_
                 _|_| |_|_|_|_|_|    _
                |_|_    |_|_|_|_    |_|_                |_   _
                  |_|    _|_|_|_|_   _|_|                _|_|_|
                        |_|_|_|_|_|_|_|_                |_|_|
     _       _       _   _|_|_|_|_|_|_|_|    _       _   _|
    |_|_    |_|_    |_|_|_|_|_|_|_|_|_|_    |_|_    |_|_|_   _
 _   _|_|_   _|_|_   _|_|_|_|_|_|_|_|_|_|_   _|_|_   _|_|_|_|_|
|_|_|_|_|_|_|_|_|_|_| |_| |_|_|_|_|_| |_| |_|_|_|_|_| |_| |_|
 _|_| |_|_|_|_|_|_|        _|_|_|_|        _|_|_|_|
|_|_    |_|_|_|_|_   _    |_| |_|_   _    |_| |_|_   _
  |_|    _|_|_|_|_|_|_|        _|_|_|_|        _|_|_|_|
        |_|_| |_| |_|         |_| |_|         |_| |_|
     _   _|
    |_|_|_   _
 _   _|_|_|_|_|
|_|_|_|_|_|_|
 _|_| |_|_|          _
|_|_    |_   _        |_
  |_|    _|_|_|        _|
        |_|_|_   _   _|_
         _|_| |_|_|_| |_|
        |_|_    |_|_
          |_|     |_|

 _   _   _   _
| |_| | | |_| |
|_   _| |_   _|
 _| |_____| |_
|  ___   ___  |
|_|  _| |_  |_|
 _  |_   _|  _
| |___| |___| |

 _   _   _   _   _   _   _   _
| |_| | | |_| | | |_| | | |_| |
|_   _| |_   _| |_   _| |_   _|
 _| |_____| |_   _| |_____| |_
|  ___   ___  | |  ___   ___  |
|_|  _| |_  |_| |_|  _| |_  |_|
 _  |_   _|  _   _  |_   _|  _
| |___| |___| |_| |___| |___| |
|_   ___   ___   ___   ___   _|
 _| |_  |_|  _| |_  |_|  _| |_
|  _  |  _  |_   _|  _  |  _  |
|_| |_| | |___| |___| | |_| |_|
 _   _  |  ___   ___  |  _   _
| |_| | |_|  _| |_  |_| | |_| |
|_   _|  _  |_   _|  _  |_   _|
 _| |___| |___| |___| |___| |_

 ___   _   ___
|_  |_| |_|  _|
 _|  _   _  |_
|___| | | |___|
 ___  | |  ___
|_  |_| |_|  _|
 _|  _   _  |_
|___| | | |___|

 _   _   _   _
| | | | | | | | |
| |_| |_| | | |_|
|  _   _  | |  _
| | | | | | | | |
|_| | | |_| |_| |
 _  | |  _   _  |
| | | | | | | | |
| |_| |_| |_| |_|

                    _
                  _| |_
                _|     |_
              _|_       _|_
            _| |_|     |_| |_
          _|                 |_
        _|_                   _|_
      _| |_|_   _       _   _|_| |_
    _|     |_|_|_|     |_|_|_|     |_
  _|_       _|_|_       _|_|_       _|_
_| |_|     |_| |_|     |_| |_|     |_| |_

          _
        _| |  _
       |_  |_| |_
      ___|    ___|
  _  |_      |_           _
_| |  _|       |        _| |  _
   |_|         |_      |_  |_|
              ___|    ___|
             |_   _  |_
               |_| |  _|
                   |_|

 ___     ___         ___     ___
|   |___|   |       |   |___|   |
|_         _|       |_         _|
  |       |    ___    |       |
 _|       |___|   |___|       |_
|    ___                 ___    |
|___|   |               |   |___|
       _|               |_
      |                   |
      |_                 _|
 ___    |               |    ___
    |___|               |___|

     _
   _| |_   _
  |_    |_| |_
   _|        _|
 _|        _|
|_   _    |_
  |_| |_   _|
        |_|

                   _
     _           _| |_   _
   _| |_   _    |_    |_| |_
  |_    |_| |_   _|        _|
   _|         |_|        _|
 _|                     |_
|_   _                   _|
  |_| |_               _|
       _|             |_   _
     _|                 |_| |_
    |_                       _|
     _|        _           _|
   _|        _| |_   _    |_
  |_   _    |_    |_| |_   _|
    |_| |_   _|         |_|
          |_|

Sample input:_

-1 0 6 -4 -2 1 0 -4 -1 2 7 6 6 0 5 -5 -2
-7 -5 -4 -1 0 -5 -6 -3 -5 -4 -2 4 3 -1 4 4 -7 4 1 -5 -4 -1 2 3 2 -7 5
0 5 -6 1 -5 8 -2 7 6 -6 -3 -3
-2 0 -4 5 -3 4 3 -2 2 -2 -3 5 -3 -2 -3 2 4 -4 -4 -2
2 1 1 1 1 1 1 1 1 2 1 1 1 2 2 2
4 2 4 8 1 1 7 3 8 4
5 5 1 4 5 4 3 5 6 2 2 3 4 1 2 2 4 1 1 4
-4 -3 -4 2 -1 -1 0 2 2 -2 -4 1 -2 -4 -3 2 1 0 2 -5 -1 -3 -3
1 3 3 3 2 2 2 3 2 1 1 3 2 1 1 2 2 1 1 1 2 1 3
-5 -5 -5 3 -1 0 0 6 2 5 1 4 -2 5 0 6 -1 3 3 3 6
3 2 1 2 2 3 2 3 3 3 2 1 1 1 2 3 2 2 1 2 3 3 3 3 3 2 1 3 3 2 2
-4 5 -4 -6 -2 -4 5 5 0 2 -2 1 -4 2 -7 3 1 6 -5 2 0 5 -1 -1 1 1 -2 6 -6 5 -6 -4
3 1 1 6 3 -2 4 3 6 1 2 3 -7 4 -2 2 -6 1 -5 -6 1 2 1 -3 -5 6 6 5
5 4 1 5 1 4 5 1 3 1 2 1 1 1 3 4 3 3 2 4 2 3 3 3
1 4 4 1 3 2 3 3 3 3 2 3 2 3 3 2 1 4 3 3 3 1 3 1 2 1 4 3 1 2 2 4
4 3 3 1 3 7 4 3 6 7 4 4 1

Sample output:

      _____________
     |        ___  |
     |_          | |
       |         | |
       |         | |
       |         | |
       |_________|_|
       |___
           |
           |
           |
___________|

             _______
       _____|       |
      |             |
      |             |
      |             |_____________
      |___                        |
 _________|_                      |
|    _____|_|_____                |
|   |     | |                    _|
|___|_____| |                   |
    |       |                   |
    |       |                   |
    |_______|                   |        ___
                                |_______|   |
                                            |
                                         ___|
                                        |
                                        |
                                        |
                                        |
                                        |
                                        |
                               _________|

|
|
|
|
|___________
            |_________
                      |
                      |
                      |
                      |
                      |
                      |
                      |
                      |___
                          |
                          |
                          |
                          |
                          |
                          |
               ___________|
              |
              |
              |
              |     |
              |     |
              |_____|

   _____
  |     |
  |_____|
        |
 _______|
|       |_____
|             |
|       |  ___|
|_______| |
     _____|
    |
    |
    |
    |_____
          |
          |
          |
          |
          |___________

 ___
  |_|
| |_|
|___|

 _______________
|               |
|            _  |
|___________|_| |
            |   |
            |
            |
            |
            |_______
            |       |
            |_______|

                             |
                             |
                        _____|_
                    ___|___  |_|
_________   _______|___|___|
        _|_|_____  |   |
       | | |     | |___|
       | | |     |
       | | |     |
       |_| |_____|

 _______
|
|
|_______   ___
        | | |
       _|_|_|_____
       ___| |     |
      |   | |     |
      |___|_|_    |
              |___|

     _____
   _|_|_|_|
  | |_|
 _|_
|_|_|_
|   | |
|___| |
|_____|

          |
 _________|
|         |
|         |  ___
|         |_|_  |
|      ___|_|_|_|_
|_____|___  | | |
      |   | | | |
      |___|_| |_|
          |_|

          _____
_________|_    |
   | | | | |___|
   |_|_| |_|
   |_|_|_|_|

 ___________
|           |
|           |
|           |
|           |
            |___________
                        |
                        |
                     _  |
                    | | |        _______
                    | | |       |       |
                    |_|_|_______|_   ___|_____
                      |     |_| | | |   |     |
                      |         | |_|___|_    |
                      |_________|   |   |_|___|_
                                |___|         |
                                |             |

          _______
         |       |
    _____|       |
   | |___|_______|
   |     |
   |     |_____________
   |                   |                          _
___|_                  |                         | |
   |_|                 |                         |_|
                       |___                      |
                           |                     |
                           |___________          |_________
                                       |_________|         |
                                               |           |
                                               |           |
                                               |           |
                                               |           |
                                               |___________|

   ___
|_|___|    _
| |___|___|_|
|_|___|   | |
| |___|_  | |
|_|_|_|_|_|_|
          |_|

                 _
|                 |
|  _       _____  |
| | |     |_|___| |
|_|_|  ___|_|___|_|
  |___|___|_|___|
      |     |
      |_____|

 _______
        |
   _____|
  |_____|
        |
        |
 _______|___
|       |   |
|       |   |
|_______|   |
    |       |
    |       |
    |       |
    |_______|

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1mitchs2240.08382016/01/01 07:13:261B / 96B / 117B
2jpl2690.78972014/06/25 00:03:260B / ?B / ?B

Ruby2 _

RankUserSizeTimeDateStatistics
1mitchs2240.24692016/01/01 07:25:070B / 95B / 119B

Perl _

RankUserSizeTimeDateStatistics
1brx(uue)2270.73732014/06/24 02:48:29117B / 61B / 42B
2brx2410.65602014/06/24 01:31:370B / 81B / 150B

Python _

RankUserSizeTimeDateStatistics
1mitchs2751.95672015/06/21 12:16:310B / 130B / 131B
2twobit3220.67222014/07/18 01:25:260B / 159B / 131B
3urupica4520.16522014/09/01 02:15:380B / ?B / ?B
4rolf7770.89952014/06/14 11:34:050B / 294B / 311B
5mitchs_ (ungolfed9190.43082014/07/02 16:01:590B / 541B / 153B
6mitchs_ (ungolfed. rolf,jpl,brx please read ideone.com/Uf2MPZ regarding upcoming FIXED version, sorry for inconvenience)9190.42922014/07/02 16:03:280B / 541B / 153B

J _

RankUserSizeTimeDateStatistics
1I., S.2120.13722014/07/09 21:45:070B / 71B / 128B

Language Ranking_

RankLangUserSizeScore
1JI., S.21210000
2Rubymitchs2249464
3Ruby2mitchs2249464
4Perlbrx(uue)2279339
5Pythonmitchs2757709

return top