Created
July 24, 2012 11:56
-
-
Save c-spencer/3169547 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source Table | |
{ | |
1: 11, | |
2: 13, | |
3: 99, | |
4: 5, | |
5: 7, | |
10: 6, | |
15: 16, | |
67: 123, | |
123: 123, | |
151: 125, | |
213: 12, | |
652: 123, | |
1234: -100 | |
} | |
// Simple Compilation | |
if (x <= 1) return 11; | |
if (x <= 2) return 9 + 2*x; | |
if (x <= 3) return -159 + 86*x; | |
if (x <= 4) return 381 + -94*x; | |
if (x <= 5) return -3 + 2*x; | |
if (x <= 10) return 8 + -0.2*x; | |
if (x <= 15) return -14 + 2*x; | |
if (x <= 67) return -14.865384615384613 + 2.0576923076923075*x; | |
if (x <= 123) return 123; | |
if (x <= 151) return 114.21428571428572 + 0.07142857142857142*x; | |
if (x <= 213) return 400.2096774193548 + -1.8225806451612903*x; | |
if (x <= 652) return -41.85649202733486 + 0.2528473804100228*x; | |
if (x <= 1234) return 372.8213058419244 + -0.38316151202749144*x; | |
return -100; | |
// Advanced Compilation | |
if (x <= 15) { | |
if (x <= 4) { | |
if (x <= 2) { | |
if (x <= 1) return 11; | |
return 9 + 2*x; | |
} | |
if (x <= 3) return -159 + 86*x; | |
return 381 + -94*x; | |
} | |
if (x <= 10) { | |
if (x <= 5) return -3 + 2*x; | |
return 8 + -0.2*x; | |
} | |
return -14 + 2*x; | |
} | |
if (x <= 213) { | |
if (x <= 123) { | |
if (x <= 67) return -14.865384615384613 + 2.0576923076923075*x; | |
return 123; | |
} | |
if (x <= 151) return 114.21428571428572 + 0.07142857142857142*x; | |
return 400.2096774193548 + -1.8225806451612903*x; | |
} | |
if (x <= 1234) { | |
if (x <= 652) return -41.85649202733486 + 0.2528473804100228*x; | |
return 372.8213058419244 + -0.38316151202749144*x; | |
} | |
return -100; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment