1 of 4

# Create a square of increasing size by replicating the initial code

Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code.

It is quite hard for me to define this task very well, so I'll give you an example:

• Let's say your initial code was CODE and that it printed:

0

• Then, insert CODE in the middle: your code becomes COCODEDE and it should print:

00
00

• Re-insert CODE in the middle: your code becomes COCOCODEDEDE and should print:

000
000
000

• And so on. Your answer should theoretically work after any number of iterations, but I understand if, due to language performance limitations, it cannot run reasonably over a certain threshold.

Some rules:

• You can use any printable ASCII (32-127) as the character to use for your square. Your choice needs to be constant (You should use the same character for each iteration).

• An ascii-art square is defined as a string with N lines (separated by N-1 linefeeds / newlines), and with each line containing N copies of the chosen character.

• Your output isn't allowed to containe any extraneous whitespace, other than a trailing newline.

• You can use the defaults for input and output (programs or functions are allowed, but snippets are not).

• The middle of your code is defined as the point where the source code can be split in two parts such that the two are equal.

• Your answers will be scored by the length of your original program, in bytes. The lowest byte count wins. In case there's a tie, the answer that was submitted earlier wins.

 asked Feb 2 '18 at 12:14 user77954