mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-06-28 04:12:13 +00:00
Docs: Update benchmark for anthropic/claude-fable-5
This commit is contained in:
18
tests/2_convex_hull/outputs/anthropic_claude-fable-5.js
Normal file
18
tests/2_convex_hull/outputs/anthropic_claude-fable-5.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const findConvexHull = async points => {
|
||||
const { sortBy, uniqWith, isEqual } = await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/lodash.min.js');
|
||||
const pts = uniqWith(sortBy(points, ['x', 'y']), isEqual);
|
||||
if (pts.length < 3) return pts;
|
||||
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
|
||||
const build = list => {
|
||||
const hull = [];
|
||||
for (const p of list) {
|
||||
while (hull.length > 1 && cross(hull.at(-2), hull.at(-1), p) <= 0) hull.pop();
|
||||
hull.push(p);
|
||||
}
|
||||
return hull.slice(0, -1);
|
||||
};
|
||||
return [...build(pts), ...build([...pts].reverse())];
|
||||
};
|
||||
export default findConvexHull;
|
||||
// Generation time: 14.047s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user