Digging quarry timelapse
Retina 0.8.2, 163 156 bytes
.+
$*_
(_+)¶(_+)
$2¶$1¶$1
r`__\G
$%`$&
¶
;
(?<=(_+);.*)(?<=;_+;\1*)_
¶$`_
m`^_+;
__
+`(>*)_(_+)(_+<?;)\2
$1_$.2$* $3¶$1>$2<;
T`>\_` \\`>+_
T`\\\_;<`V/_`.<|;
Try it online! Explanation:
.+
$*_
Convert the inputs to unary. This gives us W¶S
.
(_+)¶(_+)
$2¶$1¶$1
Swap the inputs and duplicate the width. This gives us S¶W¶W
.
r`__\G
$%`$&
Calculate the volume of the quarry. This gives us S¶W¶V
.
¶
;
Join the inputs into one line. This gives us S;W;V
.
(?<=(_+);.*)(?<=;_+;\1*)_
¶$`_
Calculate the amount of progress for each day on its own line. Each day has the format S;W;D
, where D
is 0
on the first line and increments by S
each day until it reaches V
.
m`^_+;
__
Delete S
and increase W
by 2 on each line. This gives us G;D
for each day.
+`(>*)_(_+)(_+<?;)\2
$1_$.2$* $3¶$1>$2<;
While D
is nonzero, dig either D
or G-2
from the line (so the first and last characters are always left), moving the depth to the next line. Each line is indented with one more >
than the previous. Newly dug lines also include a <
.
T`>\_` \\`>+_
Turn the indent into spaces and the following _
into a \
.
T`\\\_;<`V/_`.<|;
If a <
is following a \
then turn it into a V
, if it's following a _
then turn it into a /
. Delete all the <
s and ;
s.