g | x | w | all
Bytes Lang Time Link
003Vyxal240820T201408Zemanresu
155Perl 5 + p0513240820T200438ZDom Hast
003APL141020T043751Zjimmy230
004GolfScript141018T220245ZOptimize
007Golfscript141018T084931ZJohn Dvo

Vyxal, N=3

› ›
›› 
0  

Try it Online!

Unrolled:

   ››
   › 
0   ›

     ››
0   › ›

       ›
0   › ››
0   › ›››

increments a number, so the rolled version prints 0, the once-unrolled version prints 0+1=1, the twice-unrolled version prints 0+1+1=2 and so on. This could probably be extended to arbitrary-sized grids.

Perl 5 + -p0513, 155 bytes, N=12

Not particularly competitive, but it was fun trying to get to this point. I tried with 1s originally, but struggled to make it work with 1s only separated by newlines. Also investigated using just list length (N=6) but had issues without using length and join.

#          #
 #        #;
  #      # w
   #    #  q
    #  #   ,
     ##    '
    # #    '
   #   #   n
  #     #  i
 #       # o
#         #j
$\+=length  

Try it online!

1, 2, 3, ..., 18, 19, 20, 21, 22

APL, N = 3

201
340
5|0

Unrolled:

   32
   40
5|001

     43
5|00102

       4
5|001023

5|0010234

Try it online.

It calculates the remainder of that number divided by 5. Only the result of last line is printed.

APL, N = 2

⍬∞
≡0

Unrolled:

  ⍬
≡0∞

≡0∞⍬

Try it online.

returns the depth (not to be confused with the dimension or length) of an array:

These two programs also works in the online interpreter. I'm not sure if the later one is syntactically correct.

⍬0
≡∞


⍬¯
≡0

APL, for any N >= 4

For N = 4:

∞  ∞
 ∞∞
∞ ∞
⍴1↓∞

Fully unrolled:

⍴1↓∞  ∞  ∞ ∞ ∞∞∞

For N = 5:

∞   ∞
 ∞ ∞
 ∞∞
∞  ∞
⍴1↓ ∞

Fully unrolled:

⍴1↓ ∞   ∞   ∞  ∞  ∞ ∞ ∞∞∞

1↓ removes an item in the array. It also returns the empty array if the argument is scalar. gets the array length.

GolfScript, N = 4

This one right rolls as original spec.

.. . 
...# 
.#.~
],8-

Here are the unrolls:

    ...
    #..
    ..
],8-~#.

       .#.
       ...
],8-~#. ..

          ..
          .#
],8-~#. ....

            ..
],8-~#. ....#.

              .
],8-~#. ....#..

],8-~#. ....#...

Try it here

Golfscript, N <- [5,7..]

.   .
 . . 
 ..  
.  .#
],9\-

Fully unrolled:

],9\-#  .   .  .  . . ...

Explanation:

Whitespace is a NOP, but any other NOP would have worked just as well.

Fully rolled up, it uses nine copies of the input (contents ignored) as the stack; 9 - 9 = 0; it has not been unrolled.

Each unroll hides one more dot (duplicate) behind the comment, shrinking the stack once, incrementing the output.

Fully unrolled, it uses only the input (contents ignored) as the stack; 9 - 1 = 8; it has been unrolled 8 times.

The same approach works for any N > 4: Change 9 to the appropriate value of 2*N+1, then extend the pattern of dots (duplicate) using the same spiral pattern that ensures exactly one dot gets unrolled during each unroll.