Challenge
Write a full program/function to Demolish a given building at the rate 1 floor per second.
INPUT
Input is a building through STDIN(or whatever is called in your language) or through an ARGUMENT of a function. t=0 s
|
|#|
{#}
|# #|
|# # #|
|# # #|
|# # #|
TTTTTTT
input consists of :
|
marks start and end of a floor.{
,}
marks the floor with explosives.#
is a window which is for decoration .is space, which is everywhere inside the floors where
#
is not there.T
marks ground(cannot be demolished).*
marks the detonated floor.
Input rules :
- building starts from top with one
|
and ends on ground(with no(T
)=no (char used in ground floor
)). - a window
#
is at every odd place inside every floor. T
marks the end of your input.- only one floor consists of explosives.
- every floor is made of odd no. of chars.
- as you ascend down the floors, the floors can either be of equal size of that of previous floor or can be 2 chars bigger.
- Input can be taken as an array of
chars
orstrings
.
Output :
t=0.5 s
|
|#|
***
|# #|
|# # #|
|# # #|
|# # #|
TTTTTTT
t=1 s
|
|#|
|# #|
|# # #|
|# # #|
|# # #|
TTTTTTT
t=1.5 s
|
***
|# #|
|# # #|
|# # #|
|# # #|
TTTTTTT
t=2 s
|
|# #|
|# # #|
|# # #|
|# # #|
TTTTTTT
t=2.5 s
*
|# #|
|# # #|
|# # #|
|# # #|
TTTTTTT
t=3 s
|# #|
|# # #|
|# # #|
|# # #|
TTTTTTT
t=3.5 s
*****
|# # #|
|# # #|
|# # #|
TTTTTTT
t=4 s
|# # #|
|# # #|
|# # #|
TTTTTTT
t=4.5 s
*******
|# # #|
|# # #|
TTTTTTT
t=6.5 s
*******
TTTTTTT
t=7 s
TTTTTTT
Output rules :
- every floor ends with one
newline
character. - ground may/may not have a trailing newline.
- output the building(or whats left of it) every 0.5 s.
- Output is like animation which is modified every 0.5 s and is displayed.
(Also feel free to post GIFs with your answer)
This is a Code-Golf so the code in shortest bytes wins!
last date of submission is exactly 5 days from now
(But you know what ? Winning is not everything, feel free to try this challenge in your favorite language, even after a winner has been declared :] ).
EDIT : I changed the way you take input (my bad actually).