7
1
The goal is to display a bézier curve in any classical browser (except maybe old IE versions, because... are they really browsers?) client side.
Rules:
- You must provide one or more files (or their content). These files must contain all the code.
- The code must work offline, no imports from a remote source. No installation should be needed on the computer (except a vanilla browser).
- This is a Javascript contest. A very simple way would be to use
SVG
files that can be read with browsers. Don't! - No need to pass the W3C validator test, you can omit the doctype and the surrounding tags (
html
,head
,body
, ...) - The input can take any form: GET, POST, written in the code, etc.
- The quadratic bézier must be implemented. (2nd degree bézier: starting point, ending point and 1 intermediate point). It means 3 points (= 6 coordinates) must be given in whatever format you prefer (XML, JSON, ...).
- If you don't know what a bézier curve is, you should! Check on Wikipedia to know about it.
Scoring:
- In his great kindness, OP offers you 10'000 point just by posting a valid answer.
- The sum of the sizes of the files in bytes will give negative points. 1 byte = -1 point*.
- Implementing the cubic bézier curve instead of the quadratic multiplies your points by 120%.
- Implementing n-th degree bézier curve instead of the quadratic or cubic double your points. (Which means implementing both the cubic and the n-th degree is useless, pointless and very dumb).
- Implementing filled bézier (with inner color) will double your points again.
- There is no limit in the number of files or libraries you use, just remember adding jQuery, for example, already gives you about -26'000 points.
The contestant with the highest score wins. (duh!)
*A 10'000 characters answer gives you 0 points.
1I'm not sure I get the question. Is it allowed to generate some SVG ? Is it allowed to use canvas (in which a native bezier api is available) ? – Denys Séguret – 2013-04-19T13:15:29.150
Good question. Of course, you can't use any built-in bézier whatsoever (SVG, canvas bézier, ...) you must implement the bézier. After that, you can use canvas to display it, if you want. – SteeveDroz – 2013-04-19T14:01:49.677