24
3
You know—they look like this:
The goal is to draw a music beats illustration like the following:
= = =
= = = = =
== = == = == = ====
== ==== == === = = =======
======== == ==== = ========= =
=================================
The rules are:
- The width of the illustration is 33 symbols, but if you need—any trailing spaces exceeding this width are allowed.
- Each column is made of equals signs (
=
). - Each column has a random height (the height of the next column shouldn’t depend in any way on the height of the previous column), varying from 1 to 6. It’s also fine if it’s at least possible to get some input with no strict math probability (i.e. some inputs could appear more rarely than others).
- A column can’t float above the bottom and have gaps in it.
- Since every column has the minimal height of 1, the last row can’t have any gaps either—it always consists of 33 equals signs.
- Since it’s possible to have no columns with the height of 6 (it’s all random after all): in this case you don’t need to have a top line made of spaces. Applies to any edge cases of this nature: if suddenly your code provided no columns with the height greater than 1, you don’t need to have additional lines made of spaces above the bottom line.
- You don’t take any input.
@Lynn Oh, originally it did specify, but I accidentally removed it from the post. – nicael – 2016-07-10T18:59:53.313
11(Nitpicking) That looks to me like a spectrogram at a given instant, rather than a representation of any beats – Luis Mendo – 2016-07-10T19:00:52.173
@Luis Oh, that could be. But I love music and this is my first association :)) – nicael – 2016-07-10T19:15:11.907
Is
=================================
allowed as an output, or do we need to put newlines before it? – Leaky Nun – 2016-07-10T19:52:11.217@Leaky Nice example, edited. – nicael – 2016-07-10T20:01:54.020
Plot twist: you need to output a fixed (maybe a number given as the input) number of total
=
signs. – user6245072 – 2016-07-10T20:30:16.8872Are columns allowed to be separated by spaces? (i.e., bottom row would be
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
) – LegionMammal978 – 2016-07-10T22:12:27.1372Is it OK to have extra lines above the output? – John Dvorak – 2016-07-11T05:46:16.623
@LegionMa Nope. – nicael – 2016-07-11T12:40:21.663
@Jan You could, not required though. – nicael – 2016-07-11T12:41:16.803
1"the height of the next column shouldn’t depend in any way on the height of the previous column" -- most languages' built-in random number generators are seeded. For this reason a function like
Math.random()
is directly calculable from its previous call if the parameters of the linear congruential generator are known, which means you'd have to modify most built-in random functionality in order to meet this criteria. I suggest that this is better-worded. – Patrick Roberts – 2016-07-13T07:00:13.863@Patrick I mean, you shouldn't specifically implement the dependance. – nicael – 2016-07-13T08:25:01.990