Created
April 12, 2012 19:35
-
-
Save bmander/2370403 to your computer and use it in GitHub Desktop.
happyface
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
function makerectangle(left,right,bottom,top){ | |
return function(x,y){ | |
return (x>left && x<right && y > bottom && y < top) | |
} | |
} | |
function makecircle(cx,cy,r){ | |
return function(x,y){ | |
return Math.pow(x-cx,2)+Math.pow(y-cy,2)<Math.pow(r,2) | |
} | |
} | |
function makesmile(width, thickness, cx, cy){ | |
return function(x,y){ | |
return makecircle(cx,cy,width)(x,y) && !(makecircle(cx,cy,width-thickness)(x,y)) && y>cy; | |
} | |
} | |
function foobar(x,y){ | |
return makecircle(120,120,100)(x,y) && !(makesmile(70, 10, 120, 120)(x,y) || makecircle(90,70,15)(x,y) || makecircle(150,70,15)(x,y)) || makecircle(156,70,5)(x,y) || makecircle(96,70,5)(x,y) | |
} | |
emit(foobar); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment