Your goal is to map a piece of text to a sine curve of the form:
a sin ( mx - b )
Where a and m are non-zero rational numbers, b is a rational number, and the calculations are in radians.
It doesn't really matter where the origin of your graph is, as long as you fit all the letters in your output. Also, it must be ASCII art, no graphical output.
You can take the equation input in as a string OR you can have a separate input for each parameter: a, m, and b.
Also
Examples:
Input: "A-well-a", "3sin(x)" or (3,1,0)
Output:
-w a A e - l l
Explanation:
The index of the character is the x-value, and each line represents one y-value. So we take 3sin(x) of the appropriate indices and round them to the nearest integer to get our values:
'A' : 3sin(0) = 0 => (0,0) '-' : 3sin(1) = 2.5244 => (1,3) 'w' : 3sin(2) = 2.7279 => (2,3) etc. , to give you the rest of the word.
Input: "Everybody's", "3.5sin(x-2)" or (3.5,1,2)
Calculations:
3.5sin(x-2), x = 0,1,2,3,...,10 -3.1815,-2.9435,0,2.9435,3.1815,0.4935,-2.6495,-3.3565,-0.9765,2.2995,3.4615,
Output:
ry s ' e b y Ev od
Input: "heard", "4sin(2x)" or (4,2,0)
4sin(2x) [0-4] = 0,3.636,-3.028,-1.116,3.956,
Output:
e d h r a
Input: "about","-5sin(x+1)" or (-5,1,-1)
-5sin(x+1) [0-4] : -4.205,-4.545,-0.705,3.785,4.795,
Output:
t u o a b
Input: "the word", "-2.4sin(0.5x-1.2)" or (-2.4,0.5,1.2)
-2.4sin(0.5x-1.2) [0-7] : 2.2368,1.5456,0.4776,-0.7104,-1.7208,-2.3136,-2.3376,-1.7904
Output:
th e word