With the big crash of the universal economy also the demand for custom made planets plunged. The Magratheans had to look after more steady revenues also from a broader class of customers. Therefore, they invented the have-your-own chain of mountain (or short havoc-o-mountains) for people with smaller budget who could not afford a complete planet.
The mountains are build according to the customer's plan (a.k.a. strings of digits and dots) and delivered using ascii-art (consisting of
Write a complete program which takes input (single string) either from STDIN or as argument and outputs to STDOUT. This puzzle is a code-golf so please show some attempt at golfing.
A string of dots and digits providing the basis for the mountain chain. Each string is exactly as long as necessary to support the mountains and each peak is given by a digit instead of a dot, indicating the height of the peak.
An ascii version of the mountain chain.
- Each digit in the input represents exactly one peak (
^) at exactly the height indicated by the digit (i.e. 9 is the highest height).
- There must not be additional peaks in the output (i.e. at places where there is a dot in the input).
- Mountains are of triangular shape, i.e. slopes are created using
- Passes where two mountains overlap are shaped using the character
- No superfluous newlines nor blank lines.
- Padding lines with trailing spaces is optional.
You may assume that the input provided is valid, i.e. there always exists a solution according to the rules (e.g. an input of
13.. would not result in a valid configuration and may be ignored). Moreover, on each side there are exactly as many dots such that the mountains must no be cropped.
The first line shows the input, all other lines constitute the desired output. (Actually the mountains look much better in my console than here.)
1 ^ 11 ^^ 1.2. ^ ^/ \ .2.3.. ^ ^/ \ / \ .2..3.. ^ ^ / \ / v \ ...4...3...3.. ^ / \ ^ ^ / \/ \ / \ / v \