Gradient interpolation
Description:
You're involved in the creation of a game.
In the game, a certain color function is to be used, such that, say, different temperatures will have different colors. This color function can be changed during the game, and even be chosen by the player.
The exact choices aren't finalized, but you know that a simple linear gradient will be used. For this you will create a higher order function, i e, a function that returns another function. This is somewhat similar to dependency injection in OO systems.
The resulting function must take a single parameter x between 0 and 100 and return a color.
Create a function that, given two colors in a vector RGB format (such as [255 255 255] for white or [0 0 0] for black in Clojure) returns another function that interpolates between the two functions and returns a resulting color in the same format.
The resulting color should be rounded down to the closest lower or equal integer.
Similar Kata:
Stats:
Created | Feb 24, 2017 |
Published | Feb 24, 2017 |
Warriors Trained | 152 |
Total Skips | 17 |
Total Code Submissions | 242 |
Total Times Completed | 63 |
Clojure Completions | 34 |
Haskell Completions | 31 |
Total Stars | 6 |
% of votes with a positive feedback rating | 94% of 18 |
Total "Very Satisfied" Votes | 16 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 3 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |