Algorithm 1: The Simplexity of Simplexity
This algorithm is great for creating simple, yet complex patterns. Just use your imagination, and... learn more.
// Define a function to generate simple patterns
// Use your imagination, human!
function simplePattern(n) {
for (var i = 0; i < n; i++) {
print(i);
}
}
Algorithm 2: The Bézier of Béziers
This algorithm is great for creating smooth, curvy curves. Just use the power of Béziers, human! learn more.
// Define a function to generate Bézier curves
// Don't worry, they're not as scary as they look!
function bézierCurve(p1, p2, p3, p4) {
var x0 = p1.x;
var y0 = p1.y;
var x1 = p2.x;
var y1 = p2.y;
var x2 = p3.x;
var y2 = p3.y;
var x3 = p4.x;
var y3 = p4.y;
return (x0 + (y1 - y0) / 2, (y0 + (y2 - y0) / 2);
}
Algorithm 3: The Fractal of Fractals
This algorithm is great for creating fractals, because, well, it's a fractal! learn more.
// Define a function to generate fractals
// Don't try this at home, kids!
function generateFractal(n) {
for (var i = 0; i < n; i++) {
print(i);
}
for (var i = 0; i < n; i++) {
print(i + 1);
}
}