Open tkellehe opened 7 years ago
Possible future 11 byte solution.
¥115ṡṬƙÞạḌO
15 bytes
ʋ115ṡḶƙÞṡạḌOṡ€ß
# Input is automatically pushed to the stack.
ʋ # Vectorize the string into an array of characters.
115 # Push on the string literal "115" to be used to create the delays.
ṡ # Swap the two items on the stack.
ḶƙÞṡạḌOṡ€ # The main loop for the animation.
Ḷ # Loops the following code based off of the length of the string.
ƙ # Push on the current iteration's element of the character array (essentially a foreach).
Þ # Pop off of the stack and push to the screen.
ṡ # Swap the string "115" and he array of characters (this is done because need array of characters on the top for the loop to know how many times to loop)
ạ # Grab the next character in the string "115" (essentially a natural animation cmd that every time called on the same object will access the next item looping)
# Also, turns the string into an array of characters.
ḌO # Pop the character off and convert to a number then multiply by 100 to get the correct delay. Then delay for that many ms.
ṡ # Swap the items again to compensate for the one earlier.
€ # The end of the loop.
ß # Clears the screen such that when implicit popping of the stack occurs it will display the correct output.
11 bytes
¥115ṡḞƙÞạḌO
# Input is automatically pushed to the stack.
¥ # Turns off auto popping.
115 # Push on the string literal "115" to be used to create the delays.
ṡ # Swap the two items on the stack.
ḞƙÞạḌO # The main loop for the animation.
Ḟ # Loops the following code over each character of the string consuming off of the stack.
ƙ # Push on the current iteration's element of the character array (essentially a foreach).
Þ # Pop off of the stack and push to the screen.
ạ # Grab the next character in the string "115" (essentially a natural animation cmd that every time called on the same object will access the next item looping)
ḌO # Pop the character off and convert to a number then multiply by 100 to get the correct delay. Then delay for that many ms.
http://codegolf.stackexchange.com/q/110467/52270
18 bytes
My answer
Try it:)