Write a program or function which, given an input string and a standard deviation
σ, outputs that string along the normal distribution curve with mean
0 and standard deviation
Normal distribution curve
y coordinate of each character
σ is given as input, and where
x is the
x axis coordinate of
- The character in the center of the string has
x = 0. If the string's length is even, either of the two middle characters can be chosen as the center.
- Characters are separated by steps of
0.1(e.g. the character to the left of the center one has
x = -0.1, the one to the right of the middle one has
x = 0.1, etc.).
Printing the string
- Lines, like characters, are separated by steps of
- Each character is printed on the line with the
yvalue that is closest to its own
yvalue (if the value is precisely in between the values of two lines, choose the one with the biggest value (just like how
- For example, if the
ycoordinate of the center value (i.e. the maximum value) is
ycoordinate of the first character is
0.2, then there will 9 lines: the center character being printed on line
0and the first character being printed on line
Inputs and outputs
- You may take both inputs (the string and
σ) as program arguments, through
STDIN, function arguments or anything similar in your language.
- The string will only contain printable
ASCIIcharacters. The string can be empty.
σ > 0.
- You may print the output to
STDOUT, in a file, or return it from a function (as long as it is a string and not say a list of strings for each line).
- A trailing new line is acceptable.
- Trailing spaces are acceptable as long as they don't make the line exceed the last line in length (so no trailing space is acceptable on the last line).
σ String 0.5 Hello, World! , W lo or l l e d H ! 0.5 This is a perfectly normal sentence tly ec n f o r r e m p a a l s se This i ntence 1.5 Programming Puzzles & Code Golf is a question and answer site for programming puzzle enthusiasts and code golfers. d answer site for p uestion an rogramming Code Golf is a q puzzle enthusia Programming Puzzles & sts and code golfers. 0.3 ..................... . . . . . . . . . . . . . . . ... ...
This is code-golf,
nsw a er t s i e n t or by sh te so the s wins.