Given a string of ASCII art like such (This isn't ASCII art but it will do for the example):
abc
d e
fgh
Jumble it as if it was being displayed on a screen with one character per line, like so:
a
b
c
d
e
f
g
h
Print the result, wait one second, ±0.5 seconds before clearing the terminal and the print the same thing, but with 2 characters displayed per line instead of 1. Basically, the width of the display turns from 1 to 2.
ab
c
d
e
fg
h
Note the space after the d
. Repeat waiting, then printing with an additional character per line until the inputted text is outputted.
If you hit the end of a line when trying to print characters, then you insert a newline and print the rest of them following this rule. For example the input:
abcdefg
ab
Would print the following when the display length is 4.
abcd
efg
ab
You can find the effect of the terminal resize here: https://repl.it/GoeU/1. Run the program, then drag the thing separating the terminal from the text editor back and forth.
Clarification:
Once a line appears exactly how it was inputted, you can leave that line alone for future larger character counts per line.
abc
ab
should print
ab
c
ab
when the sentence length = 2.
This is code-golf, so least amount of bytes wins!
Rules:
- Must print to STDOUT as the only output.
- Must clear the terminal, or create the illusion of clearing the terminal by adding 150 or so empty lines.
- Can take input through the standard methods.
- Default loopholes apply.
- Trailing stuff with the text is NOT OKAY.
This idea came to me when I was resizing a terminal with ASCII art on it. It looked interesting, so I decided to make a challenge out of it.
Test cases:
Since it would be too much work to show each step for each test case individually, I will review each answer to make sure it is valid. Make sure the answer can handle the test cases.
______ ______ __ __ __ ______ __ __ ______
/\ == \ /\ == \ /\ \ /\ "-.\ \ /\__ _\ /\ "-./ \ /\ ___\
\ \ _-/ \ \ __< \ \ \ \ \ \-. \ \/_/\ \/ \ \ \-./\ \ \ \ __\
\ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \ \_\ \ \_____\
\/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/
__/\__
\ /
__/\__/ \__/\__
\ /
/_ _\
\ /
__/\__ __/ \__ __/\__
\ / \ / \ /
__/\__/ \__/\__/ \__/\__/ \__/\__