BBC BASIC 49 ASCII characters
Tokenised filesize 44 bytes
I.n:F.i=0TOn:RECTANGLE0,0,1189>>i/2+.5,841>>i/2N.
Much shorter than before! I always forget about the bitshift operators in BBC BASIC for windows as they weren't available on my old computer back in the day.
BBC BASIC 63 ASCII characters
Tokenised filesize 58 bytes
Dowload interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html
A%=841C%=1189d=4I.n:F.i=0TOn:RECTANGLE0,0,C%,A%:d!^B%/=2d=-d:N.
Uses zero indexing, which I prefer. Thus 0 outputs the paper for A0, 1 outputs A0 divided into a pair of A1s, etc.
It is necessary to alternate between halving the X and Y coordinates, but doing that in an array would have cost too many bytes. Instead I use the fact that BBC basic has a block of static integer variables A%..Z%
of 4 bytes each stored in contiguous memory. I store the X and Y values in A%
and C%
and access using the pointer to %B
modified by the value of d, which alternates between 4
and -4
.
Ungolfed
A%=841
C%=1189
d=4
INPUTn
FORi=0TOn
RECTANGLE0,0,C%,A%
d!^B%/=2
d=-d
NEXT
Output
![enter image description here](../../I/static/images/47310e30829d0edd1e06c912cd71180b96ef3a641271620d27574f38bcf2c440.png)
1Shouldn't
f[2]
be anA0
with a horizontal line dividing it? i.e., isn't thef[2]
in the test case actuallyf[3]
? – JungHwan Min – 2016-12-18T01:35:46.270@JungHwanMin adjusted now – martin – 2016-12-18T02:15:30.550