11
1
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).
What is answers are supposed to be posted after 1 hrs from now about? – Dennis – 2016-11-25T05:37:15.833
1 hr from the time of my post. so that I get at least 1 hr to rectify any question related doubts. – Mukul Kumar – 2016-11-25T05:41:13.873
8
I'm not sure if the community would be willing to enforce this kind of limitation. If you're not sure that your specification is solid, you can post the challenge draft in our sandbox to get feedback before posting it on main.
– Dennis – 2016-11-25T05:54:48.060@dennis Hmm...removed – Mukul Kumar – 2016-11-25T05:57:23.320
Two questions: (1) May we assume there's no trailing whitespace on any floor? (2) May we assume there are no more lines of input after the ground? – H Walters – 2016-11-25T19:58:43.820
@walters No trailing whitespace = true(
every floor ends with a newline
). No lines of output after ground = true. – Mukul Kumar – 2016-11-26T02:55:37.977